RyaDetailsToConfiguration { public static void addRyaDetailsToConfiguration(final RyaDetails details, final Configuration conf) { requireNonNull(details); requireNonNull(conf); checkAndSet(conf, ConfigurationFields.USE_ENTITY, details.getEntityCentricIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); if(conf.getBoolean(ConfigurationFields.USE_MONGO, false) ) { if(pcjDetails.isEnabled()) { conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "MONGO"); checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); } } else { if (pcjDetails.isEnabled() ) { conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "ACCUMULO"); if (pcjDetails.getFluoDetails().isPresent()) { checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); } else { checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); } } } }  static void addRyaDetailsToConfiguration(final RyaDetails details, final Configuration conf);  }
@Test public void populateConfigTest() { final RyaDetails.Builder builder = RyaDetails.builder(); builder.setRyaInstanceName("test_instance") .setRyaVersion("1.2.3.4") .setEntityCentricIndexDetails( new EntityCentricIndexDetails(true) ) .setTemporalIndexDetails( new TemporalIndexDetails(true) ) .setFreeTextDetails( new FreeTextIndexDetails(false) ) .setPCJIndexDetails( PCJIndexDetails.builder() .setEnabled(true) .setFluoDetails( new FluoDetails("test_instance_rya_pcj_updater") ) .addPCJDetails( PCJDetails.builder() .setId("pcj 1") .setUpdateStrategy(PCJUpdateStrategy.BATCH) .setLastUpdateTime( new Date() )) .addPCJDetails( PCJDetails.builder() .setId("pcj 2") .setUpdateStrategy(PCJUpdateStrategy.INCREMENTAL))) .setProspectorDetails( new ProspectorDetails(Optional.of(new Date())) ) .setJoinSelectivityDetails( new JoinSelectivityDetails(Optional.of(new Date())) ); final Configuration conf = new Configuration(); RyaDetailsToConfiguration.addRyaDetailsToConfiguration(builder.build(), conf); assertTrue(conf.getBoolean(USE_ENTITY, false)); assertFalse(conf.getBoolean(USE_FREETEXT, true)); assertTrue(conf.getBoolean(USE_TEMPORAL, false)); assertTrue(conf.getBoolean(USE_PCJ_UPDATER, false)); }