// Path: src/main/java/nl/esciencecenter/ahn/pointcloud/job/SchedulerConfiguration.java
// public class SchedulerConfiguration {
//     /**
//      * Scheme of scheduler used to submit jobs
//      */
//     @NotEmpty
//     @JsonProperty
//     private String scheme;
// 
//     /**
//      * Location of scheduler used to submit jobs.
//      * eg. For scheme=='ssh' use 'username@hostname:port'.
//      */
//     @JsonProperty
//     private String location;
// 
//     /**
//      * Queue of scheduler used to submit jobs
//      */
//     @NotEmpty
//     @JsonProperty
//     private String queue;
// 
//     /**
//      * Xenon scheduler properties
//      */
//     @JsonProperty
//     private ImmutableMap<String, String> properties = ImmutableMap.of();
// 
//     private SchedulerConfiguration() {
//     }
// 
//     public SchedulerConfiguration(String scheme, String location, String queue, ImmutableMap<String, String> properties) {
//         this.scheme = scheme;
//         this.location = location;
//         this.queue = queue;
//         this.properties = properties;
//     }
// 
//     public String getScheme() {
//         return scheme;
//     }
// 
//     public String getLocation() {
//         return location;
//     }
// 
//     public String getQueue() {
//         return queue;
//     }
// 
//     public ImmutableMap<String, String> getProperties() {
//         return properties;
//     }
// }
// 
// Path: src/main/java/nl/esciencecenter/ahn/pointcloud/job/XenonConfiguration.java
// public class XenonConfiguration {
//     /**
//      * Scheduler configuration used to submit jobs
//      */
//     @Valid
//     @JsonProperty
//     private SchedulerConfiguration scheduler;
// 
//     /**
//      * Xenon global properties
//      */
//     @JsonProperty
//     private ImmutableMap<String, String> properties = ImmutableMap.of();
// 
//     private XenonConfiguration() {
//     }
// 
//     public XenonConfiguration(SchedulerConfiguration scheduler, ImmutableMap<String, String> properties) {
//         this.scheduler = scheduler;
//         this.properties = properties;
//     }
// 
//     public SchedulerConfiguration getScheduler() {
//         return scheduler;
//     }
// 
//     public Map<String, String> getProperties() {
//         return properties;
//     }
// }
// 
// Path: src/main/java/nl/esciencecenter/ahn/pointcloud/resources/AbstractResource.java
// public class AbstractResource {
//     private final PointCloudStore store;
// 
//     public AbstractResource(PointCloudStore store) {
//         this.store = store;
//     }
// 
//     public PointCloudStore getStore() {
//         return store;
//     }
// }


import com.codahale.metrics.health.HealthCheckRegistry;
import com.google.common.collect.ImmutableMap;
import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.jersey.setup.JerseyEnvironment;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;
import io.dropwizard.setup.Environment;
import nl.esciencecenter.ahn.pointcloud.job.SchedulerConfiguration;
import nl.esciencecenter.ahn.pointcloud.job.XenonConfiguration;
import nl.esciencecenter.ahn.pointcloud.resources.AbstractResource;
import org.junit.Before;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.URL;
import static org.mockito.Mockito.*;
        config = getViewerConfiguration();
        env = getEnvironment();
        app = new ViewerApplication();
    }

    private Environment getEnvironment() {
        Environment environment = mock(Environment.class);
        JerseyEnvironment jersey = mock(JerseyEnvironment.class);
        when(environment.jersey()).thenReturn(jersey);
        LifecycleEnvironment lifecycle = mock(LifecycleEnvironment.class);
        when(environment.lifecycle()).thenReturn(lifecycle);
        HealthCheckRegistry healthchecks = mock(HealthCheckRegistry.class);
        when(environment.healthChecks()).thenReturn(healthchecks);
        return environment;
    }

    private ViewerConfiguration getViewerConfiguration() throws MalformedURLException {
        ImmutableMap<String, String> props = ImmutableMap.of();
        SchedulerConfiguration scheduler = new SchedulerConfiguration("local", "/", "multi", props);
        XenonConfiguration xenon = new XenonConfiguration(scheduler, props);
        DataSourceFactory database = new DataSourceFactory();

        ScriptConfiguration scriptConfig = new ScriptConfiguration(28992, "/bin/echo", "ahn2", "/data/jobs", "http://localhost/jobs");
        return new ViewerConfiguration(5, database, xenon, scriptConfig);
    }

    @Test
    public void testRun() throws Exception {
        app.run(config, env);

// Path: src/main/java/nl/esciencecenter/ahn/pointcloud/job/SchedulerConfiguration.java
// public class SchedulerConfiguration {
//     /**
//      * Scheme of scheduler used to submit jobs
//      */
//     @NotEmpty
//     @JsonProperty
//     private String scheme;
// 
//     /**
//      * Location of scheduler used to submit jobs.
//      * eg. For scheme=='ssh' use 'username@hostname:port'.
//      */
//     @JsonProperty
//     private String location;
// 
//     /**
//      * Queue of scheduler used to submit jobs
//      */
//     @NotEmpty
//     @JsonProperty
//     private String queue;
// 
//     /**
//      * Xenon scheduler properties
//      */
//     @JsonProperty
//     private ImmutableMap<String, String> properties = ImmutableMap.of();
// 
//     private SchedulerConfiguration() {
//     }
// 
//     public SchedulerConfiguration(String scheme, String location, String queue, ImmutableMap<String, String> properties) {
//         this.scheme = scheme;
//         this.location = location;
//         this.queue = queue;
//         this.properties = properties;
//     }
// 
//     public String getScheme() {
//         return scheme;
//     }
// 
//     public String getLocation() {
//         return location;
//     }
// 
//     public String getQueue() {
//         return queue;
//     }
// 
//     public ImmutableMap<String, String> getProperties() {
//         return properties;
//     }
// }
// 
// Path: src/main/java/nl/esciencecenter/ahn/pointcloud/job/XenonConfiguration.java
// public class XenonConfiguration {
//     /**
//      * Scheduler configuration used to submit jobs
//      */
//     @Valid
//     @JsonProperty
//     private SchedulerConfiguration scheduler;
// 
//     /**
//      * Xenon global properties
//      */
//     @JsonProperty
//     private ImmutableMap<String, String> properties = ImmutableMap.of();
// 
//     private XenonConfiguration() {
//     }
// 
//     public XenonConfiguration(SchedulerConfiguration scheduler, ImmutableMap<String, String> properties) {
//         this.scheduler = scheduler;
//         this.properties = properties;
//     }
// 
//     public SchedulerConfiguration getScheduler() {
//         return scheduler;
//     }
// 
//     public Map<String, String> getProperties() {
//         return properties;
//     }
// }
// 
// Path: src/main/java/nl/esciencecenter/ahn/pointcloud/resources/AbstractResource.java
// public class AbstractResource {
//     private final PointCloudStore store;
// 
//     public AbstractResource(PointCloudStore store) {
//         this.store = store;
//     }
// 
//     public PointCloudStore getStore() {
//         return store;
//     }
// }


// Path: src/test/java/nl/esciencecenter/ahn/pointcloud/ViewerApplicationTest.java
import com.codahale.metrics.health.HealthCheckRegistry;
import com.google.common.collect.ImmutableMap;
import io.dropwizard.db.DataSourceFactory;
import io.dropwizard.jersey.setup.JerseyEnvironment;
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;
import io.dropwizard.setup.Environment;
import nl.esciencecenter.ahn.pointcloud.job.SchedulerConfiguration;
import nl.esciencecenter.ahn.pointcloud.job.XenonConfiguration;
import nl.esciencecenter.ahn.pointcloud.resources.AbstractResource;
import org.junit.Before;
import org.junit.Test;
import java.net.MalformedURLException;
import java.net.URL;
import static org.mockito.Mockito.*;

        config = getViewerConfiguration();
        env = getEnvironment();
        app = new ViewerApplication();
    }

    private Environment getEnvironment() {
        Environment environment = mock(Environment.class);
        JerseyEnvironment jersey = mock(JerseyEnvironment.class);
        when(environment.jersey()).thenReturn(jersey);
        LifecycleEnvironment lifecycle = mock(LifecycleEnvironment.class);
        when(environment.lifecycle()).thenReturn(lifecycle);
        HealthCheckRegistry healthchecks = mock(HealthCheckRegistry.class);
        when(environment.healthChecks()).thenReturn(healthchecks);
        return environment;
    }

    private ViewerConfiguration getViewerConfiguration() throws MalformedURLException {
        ImmutableMap<String, String> props = ImmutableMap.of();
        SchedulerConfiguration scheduler = new SchedulerConfiguration("local", "/", "multi", props);
        XenonConfiguration xenon = new XenonConfiguration(scheduler, props);
        DataSourceFactory database = new DataSourceFactory();

        ScriptConfiguration scriptConfig = new ScriptConfiguration(28992, "/bin/echo", "ahn2", "/data/jobs", "http://localhost/jobs");
        return new ViewerConfiguration(5, database, xenon, scriptConfig);
    }

    @Test
    public void testRun() throws Exception {
        app.run(config, env);

        verify(env.jersey(), times(2)).register(any(AbstractResource.class));