@Test public void testCreateConfig() throws MergeConfigurationException { final AccumuloMergeToolConfiguration jConfig = mock(AccumuloMergeToolConfiguration.class); when(jConfig.getParentHostname()).thenReturn(PARENT_HOST_NAME); when(jConfig.getParentPort()).thenReturn(PARENT_PORT); when(jConfig.getParentRyaInstanceName()).thenReturn(PARENT_INSTANCE); when(jConfig.getParentUsername()).thenReturn(PARENT_USER_NAME); when(jConfig.getParentPassword()).thenReturn(PARENT_PASSWORD); when(jConfig.getParentTablePrefix()).thenReturn(PARENT_TABLE_PREFIX); when(jConfig.getParentDBType()).thenReturn(DBType.ACCUMULO); when(jConfig.getParentTomcatUrl()).thenReturn(PARENT_TOMCAT_URL); when(jConfig.getParentInstanceType()).thenReturn(INSTANCE_TYPE); when(jConfig.getParentAuths()).thenReturn(PARENT_AUTH); when(jConfig.getParentZookeepers()).thenReturn(PARENT_ZOOKEEPERS); when(jConfig.getChildHostname()).thenReturn(CHILD_HOST_NAME); when(jConfig.getChildPort()).thenReturn(CHILD_PORT); when(jConfig.getChildRyaInstanceName()).thenReturn(CHILD_INSTANCE); when(jConfig.getChildUsername()).thenReturn(CHILD_USER_NAME); when(jConfig.getChildPassword()).thenReturn(CHILD_PASSWORD); when(jConfig.getChildTablePrefix()).thenReturn(CHILD_TABLE_PREFIX); when(jConfig.getChildDBType()).thenReturn(DBType.MONGO); when(jConfig.getChildTomcatUrl()).thenReturn(CHILD_TOMCAT_URL); when(jConfig.getMergePolicy()).thenReturn(MergePolicy.TIMESTAMP); when(jConfig.getNtpServerHost()).thenReturn(TIME_SERVER); when(jConfig.isUseNtpServer()).thenReturn(USE_TIME_SYNC); final AccumuloConfigurationAdapter adapter = new AccumuloConfigurationAdapter(); final AccumuloMergeConfiguration accumuloMergeConfiguration = (AccumuloMergeConfiguration) adapter.createConfig(jConfig); assertNotNull(accumuloMergeConfiguration); assertEquals(AccumuloMergeConfiguration.class, accumuloMergeConfiguration.getClass()); assertEquals(PARENT_HOST_NAME, accumuloMergeConfiguration.getParentHostname()); assertEquals(PARENT_USER_NAME, accumuloMergeConfiguration.getParentUsername()); assertEquals(PARENT_PASSWORD, accumuloMergeConfiguration.getParentPassword()); assertEquals(PARENT_INSTANCE, accumuloMergeConfiguration.getParentRyaInstanceName()); assertEquals(PARENT_TABLE_PREFIX, accumuloMergeConfiguration.getParentTablePrefix()); assertEquals(PARENT_TOMCAT_URL, accumuloMergeConfiguration.getParentTomcatUrl()); assertEquals(DBType.ACCUMULO, accumuloMergeConfiguration.getParentDBType()); assertEquals(PARENT_PORT, accumuloMergeConfiguration.getParentPort()); assertEquals(PARENT_ZOOKEEPERS, accumuloMergeConfiguration.getParentZookeepers()); assertEquals(PARENT_AUTH, accumuloMergeConfiguration.getParentAuths()); assertEquals(InstanceType.MOCK, accumuloMergeConfiguration.getParentInstanceType()); assertEquals(CHILD_HOST_NAME, accumuloMergeConfiguration.getChildHostname()); assertEquals(CHILD_USER_NAME, accumuloMergeConfiguration.getChildUsername()); assertEquals(CHILD_PASSWORD, accumuloMergeConfiguration.getChildPassword()); assertEquals(CHILD_INSTANCE, accumuloMergeConfiguration.getChildRyaInstanceName()); assertEquals(CHILD_TABLE_PREFIX, accumuloMergeConfiguration.getChildTablePrefix()); assertEquals(CHILD_TOMCAT_URL, accumuloMergeConfiguration.getChildTomcatUrl()); assertEquals(DBType.MONGO, accumuloMergeConfiguration.getChildDBType()); assertEquals(CHILD_PORT, accumuloMergeConfiguration.getChildPort()); assertNull(accumuloMergeConfiguration.getChildZookeepers()); assertNull(accumuloMergeConfiguration.getChildAuths()); assertNull(accumuloMergeConfiguration.getChildInstanceType()); assertEquals(MergePolicy.TIMESTAMP, accumuloMergeConfiguration.getMergePolicy()); assertTrue(accumuloMergeConfiguration.getUseNtpServer()); assertEquals(TIME_SERVER, accumuloMergeConfiguration.getNtpServerHost()); }
@Override public MergeConfiguration createConfig(final MergeToolConfiguration genConfig) throws MergeConfigurationException { final AccumuloMergeToolConfiguration aConfig = (AccumuloMergeToolConfiguration) genConfig; final DBType parentType = aConfig.getParentDBType(); final DBType childType = aConfig.getChildDBType(); final MergeConfiguration.Builder configBuilder = super.getBuilder(aConfig); final AccumuloBuilder builder = new AccumuloBuilder(configBuilder); if(parentType == DBType.ACCUMULO) { verifyParentInstanceType(aConfig); builder.setParentZookeepers(aConfig.getParentZookeepers()) .setParentAuths(aConfig.getParentAuths()) .setParentInstanceType(aConfig.getParentInstanceType()); } if(childType == DBType.ACCUMULO) { verifyChildInstanceType(aConfig); builder.setChildZookeepers(aConfig.getChildZookeepers()) .setChildAuths(aConfig.getChildAuths()) .setChildInstanceType(aConfig.getChildInstanceType()); } return builder.build(); }
AccumuloConfigurationAdapter extends ConfigurationAdapter { @Override public MergeConfiguration createConfig(final MergeToolConfiguration genConfig) throws MergeConfigurationException { final AccumuloMergeToolConfiguration aConfig = (AccumuloMergeToolConfiguration) genConfig; final DBType parentType = aConfig.getParentDBType(); final DBType childType = aConfig.getChildDBType(); final MergeConfiguration.Builder configBuilder = super.getBuilder(aConfig); final AccumuloBuilder builder = new AccumuloBuilder(configBuilder); if(parentType == DBType.ACCUMULO) { verifyParentInstanceType(aConfig); builder.setParentZookeepers(aConfig.getParentZookeepers()) .setParentAuths(aConfig.getParentAuths()) .setParentInstanceType(aConfig.getParentInstanceType()); } if(childType == DBType.ACCUMULO) { verifyChildInstanceType(aConfig); builder.setChildZookeepers(aConfig.getChildZookeepers()) .setChildAuths(aConfig.getChildAuths()) .setChildInstanceType(aConfig.getChildInstanceType()); } return builder.build(); } }
AccumuloConfigurationAdapter extends ConfigurationAdapter { @Override public MergeConfiguration createConfig(final MergeToolConfiguration genConfig) throws MergeConfigurationException { final AccumuloMergeToolConfiguration aConfig = (AccumuloMergeToolConfiguration) genConfig; final DBType parentType = aConfig.getParentDBType(); final DBType childType = aConfig.getChildDBType(); final MergeConfiguration.Builder configBuilder = super.getBuilder(aConfig); final AccumuloBuilder builder = new AccumuloBuilder(configBuilder); if(parentType == DBType.ACCUMULO) { verifyParentInstanceType(aConfig); builder.setParentZookeepers(aConfig.getParentZookeepers()) .setParentAuths(aConfig.getParentAuths()) .setParentInstanceType(aConfig.getParentInstanceType()); } if(childType == DBType.ACCUMULO) { verifyChildInstanceType(aConfig); builder.setChildZookeepers(aConfig.getChildZookeepers()) .setChildAuths(aConfig.getChildAuths()) .setChildInstanceType(aConfig.getChildInstanceType()); } return builder.build(); }  }
AccumuloConfigurationAdapter extends ConfigurationAdapter { @Override public MergeConfiguration createConfig(final MergeToolConfiguration genConfig) throws MergeConfigurationException { final AccumuloMergeToolConfiguration aConfig = (AccumuloMergeToolConfiguration) genConfig; final DBType parentType = aConfig.getParentDBType(); final DBType childType = aConfig.getChildDBType(); final MergeConfiguration.Builder configBuilder = super.getBuilder(aConfig); final AccumuloBuilder builder = new AccumuloBuilder(configBuilder); if(parentType == DBType.ACCUMULO) { verifyParentInstanceType(aConfig); builder.setParentZookeepers(aConfig.getParentZookeepers()) .setParentAuths(aConfig.getParentAuths()) .setParentInstanceType(aConfig.getParentInstanceType()); } if(childType == DBType.ACCUMULO) { verifyChildInstanceType(aConfig); builder.setChildZookeepers(aConfig.getChildZookeepers()) .setChildAuths(aConfig.getChildAuths()) .setChildInstanceType(aConfig.getChildInstanceType()); } return builder.build(); }  @Override MergeConfiguration createConfig(final MergeToolConfiguration genConfig); }
AccumuloConfigurationAdapter extends ConfigurationAdapter { @Override public MergeConfiguration createConfig(final MergeToolConfiguration genConfig) throws MergeConfigurationException { final AccumuloMergeToolConfiguration aConfig = (AccumuloMergeToolConfiguration) genConfig; final DBType parentType = aConfig.getParentDBType(); final DBType childType = aConfig.getChildDBType(); final MergeConfiguration.Builder configBuilder = super.getBuilder(aConfig); final AccumuloBuilder builder = new AccumuloBuilder(configBuilder); if(parentType == DBType.ACCUMULO) { verifyParentInstanceType(aConfig); builder.setParentZookeepers(aConfig.getParentZookeepers()) .setParentAuths(aConfig.getParentAuths()) .setParentInstanceType(aConfig.getParentInstanceType()); } if(childType == DBType.ACCUMULO) { verifyChildInstanceType(aConfig); builder.setChildZookeepers(aConfig.getChildZookeepers()) .setChildAuths(aConfig.getChildAuths()) .setChildInstanceType(aConfig.getChildInstanceType()); } return builder.build(); }  @Override MergeConfiguration createConfig(final MergeToolConfiguration genConfig);  }