// Path: pie-core/src/test/java/com/coverity/security/pie/core/test/TestPolicyEnforcer.java
// public class TestPolicyEnforcer implements PolicyEnforcer {
// 
//     private static TestPolicyEnforcer instance = null;
// 
//     public static TestPolicyEnforcer getInstance() {
//         return instance;
//     }
// 
//     private SimplePolicy policy;
//     private PolicyConfig policyConfig;
//     private boolean isApplied = false;
// 
//     public TestPolicyEnforcer() {
//         if (instance != null) {
//             throw new IllegalStateException("Cannot instantiate more than one TestPolicyEnforcer at a time.");
//         }
//         instance = this;
//     }
// 
//     @Override
//     public void init(PieConfig pieConfig) {
//         this.policy = new SimplePolicy();
//         this.policyConfig = new PolicyConfig(policy.getName(), pieConfig);
//     }
// 
//     @Override
//     public SimplePolicy getPolicy() {
//         return policy;
//     }
// 
//     @Override
//     public PolicyConfig getPolicyConfig() {
//         return policyConfig;
//     }
// 
//     @Override
//     public void applyPolicy(ServletContext cx) {
//         isApplied = true;
//     }
// 
//     @Override
//     public void shutdown() {
//         instance = null;
//     }
// 
//     public boolean isApplied() {
//         return isApplied;
//     }
// }
// 
// Path: pie-core/src/main/java/com/coverity/security/pie/util/IOUtil.java
// public class IOUtil {
//     public static void closeSilently(Closeable closeable) {
//         if (closeable != null) {
//             try {
//                 closeable.close();
//             } catch (IOException e) {
//                 // Do nothing
//             }
//         }
//     }
//     
//     public static String readFile(File file) throws IOException {
//         return toString(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
//     }
//     public static String readFile(String file) throws IOException {
//         return toString(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
//     }
//     public static String readFile(URL file) throws IOException {
//         return toString(file.openStream());
//     }
//     
//     public static String toString(InputStream is) throws IOException {
//         try {
//             return toString(new InputStreamReader(is, StandardCharsets.UTF_8));
//         } finally {
//             closeSilently(is);
//         }
//     }
//     public static String toString(Reader reader) throws IOException {
//         StringBuilder sb = new StringBuilder();
//         try {
//             char buffer[] = new char[4096];
//             int n;
//             while ((n = reader.read(buffer)) > 0) {
//                 sb.append(buffer, 0, n);
//             }
//             reader.close();
//         } catch (IOException e) {
//             closeSilently(reader);
//             throw e;
//         }
//         return sb.toString();
//     }
//     
//     
//     public static void writeFile(File file, String content) throws IOException {
//         writeFile(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8), content);
//     }
//     private static void writeFile(Writer fw, String content) throws IOException {
//         try {
//             fw.write(content);
//             fw.close();
//         } catch (IOException e) {
//             closeSilently(fw);
//             throw e;
//         }
//     }
//     
// }


import com.codahale.metrics.annotation.Timed;
import com.codahale.metrics.health.HealthCheck;
import com.coverity.security.pie.core.test.TestPolicyEnforcer;
import com.coverity.security.pie.util.IOUtil;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.eclipse.jetty.server.Server;
import org.testng.annotations.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.io.File;
import static org.testng.Assert.*;
        }

        @Override
        public void run(Configuration configuration, Environment environment) throws Exception {
            this.environment = environment;

            environment.healthChecks().register("helloWorld", new HelloWorldHealthCheck());
            environment.jersey().register(new HelloWorldResource());
        }
    }

    @Path("/hello-world")
    @Produces(MediaType.APPLICATION_JSON)
    private static class HelloWorldResource {
        @GET
        @Timed
        public String sayHello() {
            return "Hello, World!";
        }
    }

    private static class HelloWorldHealthCheck extends HealthCheck {
        @Override
        protected Result check() throws Exception {
            return Result.healthy();
        }
    }

    private static Server startupDropwizard() throws Exception {
        File file = File.createTempFile("dropwizard.yml", null);
// Path: pie-core/src/test/java/com/coverity/security/pie/core/test/TestPolicyEnforcer.java
// public class TestPolicyEnforcer implements PolicyEnforcer {
// 
//     private static TestPolicyEnforcer instance = null;
// 
//     public static TestPolicyEnforcer getInstance() {
//         return instance;
//     }
// 
//     private SimplePolicy policy;
//     private PolicyConfig policyConfig;
//     private boolean isApplied = false;
// 
//     public TestPolicyEnforcer() {
//         if (instance != null) {
//             throw new IllegalStateException("Cannot instantiate more than one TestPolicyEnforcer at a time.");
//         }
//         instance = this;
//     }
// 
//     @Override
//     public void init(PieConfig pieConfig) {
//         this.policy = new SimplePolicy();
//         this.policyConfig = new PolicyConfig(policy.getName(), pieConfig);
//     }
// 
//     @Override
//     public SimplePolicy getPolicy() {
//         return policy;
//     }
// 
//     @Override
//     public PolicyConfig getPolicyConfig() {
//         return policyConfig;
//     }
// 
//     @Override
//     public void applyPolicy(ServletContext cx) {
//         isApplied = true;
//     }
// 
//     @Override
//     public void shutdown() {
//         instance = null;
//     }
// 
//     public boolean isApplied() {
//         return isApplied;
//     }
// }
// 
// Path: pie-core/src/main/java/com/coverity/security/pie/util/IOUtil.java
// public class IOUtil {
//     public static void closeSilently(Closeable closeable) {
//         if (closeable != null) {
//             try {
//                 closeable.close();
//             } catch (IOException e) {
//                 // Do nothing
//             }
//         }
//     }
//     
//     public static String readFile(File file) throws IOException {
//         return toString(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
//     }
//     public static String readFile(String file) throws IOException {
//         return toString(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));
//     }
//     public static String readFile(URL file) throws IOException {
//         return toString(file.openStream());
//     }
//     
//     public static String toString(InputStream is) throws IOException {
//         try {
//             return toString(new InputStreamReader(is, StandardCharsets.UTF_8));
//         } finally {
//             closeSilently(is);
//         }
//     }
//     public static String toString(Reader reader) throws IOException {
//         StringBuilder sb = new StringBuilder();
//         try {
//             char buffer[] = new char[4096];
//             int n;
//             while ((n = reader.read(buffer)) > 0) {
//                 sb.append(buffer, 0, n);
//             }
//             reader.close();
//         } catch (IOException e) {
//             closeSilently(reader);
//             throw e;
//         }
//         return sb.toString();
//     }
//     
//     
//     public static void writeFile(File file, String content) throws IOException {
//         writeFile(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8), content);
//     }
//     private static void writeFile(Writer fw, String content) throws IOException {
//         try {
//             fw.write(content);
//             fw.close();
//         } catch (IOException e) {
//             closeSilently(fw);
//             throw e;
//         }
//     }
//     
// }


// Path: pie-core/src/test/java/com/coverity/security/pie/dropwizard/PieBundleTest.java
import com.codahale.metrics.annotation.Timed;
import com.codahale.metrics.health.HealthCheck;
import com.coverity.security.pie.core.test.TestPolicyEnforcer;
import com.coverity.security.pie.util.IOUtil;
import io.dropwizard.Configuration;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.eclipse.jetty.server.Server;
import org.testng.annotations.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.io.File;
import static org.testng.Assert.*;

        }

        @Override
        public void run(Configuration configuration, Environment environment) throws Exception {
            this.environment = environment;

            environment.healthChecks().register("helloWorld", new HelloWorldHealthCheck());
            environment.jersey().register(new HelloWorldResource());
        }
    }

    @Path("/hello-world")
    @Produces(MediaType.APPLICATION_JSON)
    private static class HelloWorldResource {
        @GET
        @Timed
        public String sayHello() {
            return "Hello, World!";
        }
    }

    private static class HelloWorldHealthCheck extends HealthCheck {
        @Override
        protected Result check() throws Exception {
            return Result.healthy();
        }
    }

    private static Server startupDropwizard() throws Exception {
        File file = File.createTempFile("dropwizard.yml", null);
        IOUtil.writeFile(file,