Search in sources :

Example 1 with ClusterSpec

use of org.apache.whirr.service.ClusterSpec in project whirr by apache.

the class ClusterSpecCommandTest method testOverrides.

@Test
public void testOverrides() throws Exception {
    ClusterSpecCommand clusterSpecCommand = new ClusterSpecCommand("name", "description", new ServiceFactory()) {

        @Override
        public int run(InputStream in, PrintStream out, PrintStream err, List<String> args) throws Exception {
            return 0;
        }
    };
    OptionSet optionSet = clusterSpecCommand.parser.parse("--service-name", "overridden-test-service", "--config", "whirr-override-test.properties");
    ClusterSpec clusterSpec = clusterSpecCommand.getClusterSpec(optionSet);
    assertThat(clusterSpec.getServiceName(), is("overridden-test-service"));
    assertThat(clusterSpec.getClusterName(), is("test-cluster"));
}
Also used : PrintStream(java.io.PrintStream) ServiceFactory(org.apache.whirr.service.ServiceFactory) InputStream(java.io.InputStream) List(java.util.List) ClusterSpec(org.apache.whirr.service.ClusterSpec) OptionSet(joptsimple.OptionSet) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)1 PrintStream (java.io.PrintStream)1 List (java.util.List)1 OptionSet (joptsimple.OptionSet)1 ClusterSpec (org.apache.whirr.service.ClusterSpec)1 ServiceFactory (org.apache.whirr.service.ServiceFactory)1 Test (org.junit.Test)1