// Path: src/outbackcdx/NanoHTTPD.java
// public enum Status implements IStatus {
//     SWITCH_PROTOCOL(101, "Switching Protocols"), OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), PARTIAL_CONTENT(206, "Partial Content"), REDIRECT(301,
//             "Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), TEMPORARY_REDIRECT(307, "Temporary Redirect"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
//             "Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), METHOD_NOT_ALLOWED(405, "Method Not Allowed"), PAYLOAD_TOO_LARGE(413, "Payload Too Large"), RANGE_NOT_SATISFIABLE(416,
//             "Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
//     private final int requestStatus;
//     private final String description;
// 
//     Status(int requestStatus, String description) {
//         this.requestStatus = requestStatus;
//         this.description = description;
//     }
// 
//     @Override
//     public int getRequestStatus() {
//         return this.requestStatus;
//     }
// 
//     @Override
//     public String getDescription() {
//         return "" + this.requestStatus + " " + description;
//     }
// }
// 
// Path: src/outbackcdx/NanoHTTPD.java
// public enum Method {
//     GET, PUT, POST, DELETE, HEAD, OPTIONS;
// 
//     static Method lookup(String method) {
//         for (Method m : Method.values()) {
//             if (m.toString().equalsIgnoreCase(method)) {
//                 return m;
//             }
//         }
//         return null;
//     }
// }


import org.junit.*;
import org.junit.rules.TemporaryFolder;
import outbackcdx.NanoHTTPD.Response.Status;
import outbackcdx.auth.Permit;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Map;
import java.util.Scanner;
import static org.junit.Assert.assertEquals;
import static outbackcdx.NanoHTTPD.Method.*;
import static outbackcdx.NanoHTTPD.Response.Status.OK;
package outbackcdx;






public class ReplicationFeaturesTest {
    @Rule
    public TemporaryFolder folder = new TemporaryFolder();

    private Webapp webapp;

    private DataStore manager;

    @Before
    public void setUp() throws IOException {
        File root = folder.newFolder();
        manager = new DataStore(root, 256, null, Long.MAX_VALUE, null);
        webapp = new Webapp(manager, false, Collections.emptyMap(), null, Collections.emptyMap(), 10000);
    }

    @After
    public void tearDown() {
    }

    // tests for replication features:
    // ensure that write urls are disabled on secondary
    // ensure that we can retrieve a sequenceNumber on secondary
    // ensure that we can delete WALs on primary
    @Test
    public void testReadOnly() throws Exception {
        FeatureFlags.setSecondaryMode(true);
        // make a request to a write-able url
        // it should 401.
// Path: src/outbackcdx/NanoHTTPD.java
// public enum Status implements IStatus {
//     SWITCH_PROTOCOL(101, "Switching Protocols"), OK(200, "OK"), CREATED(201, "Created"), ACCEPTED(202, "Accepted"), NO_CONTENT(204, "No Content"), PARTIAL_CONTENT(206, "Partial Content"), REDIRECT(301,
//             "Moved Permanently"), NOT_MODIFIED(304, "Not Modified"), TEMPORARY_REDIRECT(307, "Temporary Redirect"), BAD_REQUEST(400, "Bad Request"), UNAUTHORIZED(401,
//             "Unauthorized"), FORBIDDEN(403, "Forbidden"), NOT_FOUND(404, "Not Found"), METHOD_NOT_ALLOWED(405, "Method Not Allowed"), PAYLOAD_TOO_LARGE(413, "Payload Too Large"), RANGE_NOT_SATISFIABLE(416,
//             "Requested Range Not Satisfiable"), INTERNAL_ERROR(500, "Internal Server Error");
//     private final int requestStatus;
//     private final String description;
// 
//     Status(int requestStatus, String description) {
//         this.requestStatus = requestStatus;
//         this.description = description;
//     }
// 
//     @Override
//     public int getRequestStatus() {
//         return this.requestStatus;
//     }
// 
//     @Override
//     public String getDescription() {
//         return "" + this.requestStatus + " " + description;
//     }
// }
// 
// Path: src/outbackcdx/NanoHTTPD.java
// public enum Method {
//     GET, PUT, POST, DELETE, HEAD, OPTIONS;
// 
//     static Method lookup(String method) {
//         for (Method m : Method.values()) {
//             if (m.toString().equalsIgnoreCase(method)) {
//                 return m;
//             }
//         }
//         return null;
//     }
// }


// Path: test/outbackcdx/ReplicationFeaturesTest.java
import org.junit.*;
import org.junit.rules.TemporaryFolder;
import outbackcdx.NanoHTTPD.Response.Status;
import outbackcdx.auth.Permit;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.Map;
import java.util.Scanner;
import static org.junit.Assert.assertEquals;
import static outbackcdx.NanoHTTPD.Method.*;
import static outbackcdx.NanoHTTPD.Response.Status.OK;

package outbackcdx;






public class ReplicationFeaturesTest {
    @Rule
    public TemporaryFolder folder = new TemporaryFolder();

    private Webapp webapp;

    private DataStore manager;

    @Before
    public void setUp() throws IOException {
        File root = folder.newFolder();
        manager = new DataStore(root, 256, null, Long.MAX_VALUE, null);
        webapp = new Webapp(manager, false, Collections.emptyMap(), null, Collections.emptyMap(), 10000);
    }

    @After
    public void tearDown() {
    }

    // tests for replication features:
    // ensure that write urls are disabled on secondary
    // ensure that we can retrieve a sequenceNumber on secondary
    // ensure that we can delete WALs on primary
    @Test
    public void testReadOnly() throws Exception {
        FeatureFlags.setSecondaryMode(true);
        // make a request to a write-able url
        // it should 401.
        POST("/test", "- 20050614070159 http://nla.gov.au/ text/html 200 AKMCCEPOOWFMGGO5635HFZXGFRLRGWIX - 337023 NLA-AU-CRAWL-000-20050614070144-00003-crawling016.archive.org\n- 20030614070159 http://example.com/ text/html 200 AKMCCEPOOWFMGGO5635HFZXGFRLRGWIX - - - 337023 NLA-AU-CRAWL-000-20050614070144-00003-crawling016.archive.org\n", Status.FORBIDDEN);