@Test public void format_accumulo() { TimeZone.setDefault(TimeZone.getTimeZone("America/New_York")); final RyaDetails details = RyaDetails.builder().setRyaInstanceName("test_instance") .setRyaVersion("1.2.3.4") .addUser("alice") .addUser("bob") .addUser("charlie") .setEntityCentricIndexDetails( new EntityCentricIndexDetails(true) ) .setTemporalIndexDetails( new TemporalIndexDetails(true) ) .setFreeTextDetails( new FreeTextIndexDetails(true) ) .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(1252521351L) )) .addPCJDetails( PCJDetails.builder() .setId("pcj 2") .setUpdateStrategy(PCJUpdateStrategy.INCREMENTAL))) .setProspectorDetails( new ProspectorDetails(Optional.of(new Date(12525211L))) ) .setJoinSelectivityDetails( new JoinSelectivityDetails(Optional.of(new Date(125221351L))) ) .build(); final String formatted = new RyaDetailsFormatter().format(StorageType.ACCUMULO, details); final String expected = "General Metadata:\n" + " Instance Name: test_instance\n" + " RYA Version: 1.2.3.4\n" + " Users: alice, bob, charlie\n" + "Secondary Indicies:\n" + " Entity Centric Index:\n" + " Enabled: true\n" + " Free Text Index:\n" + " Enabled: true\n" + " Temporal Index:\n" + " Enabled: true\n" + " PCJ Index:\n" + " Enabled: true\n" + " Fluo App Name: test_instance_rya_pcj_updater\n" + " PCJs:\n" + " ID: pcj 1\n" + " Update Strategy: BATCH\n" + " Last Update Time: Thu Jan 15 06:55:21 EST 1970\n" + " ID: pcj 2\n" + " Update Strategy: INCREMENTAL\n" + " Last Update Time: unavailable\n" + "Statistics:\n" + " Prospector:\n" + " Last Update Time: Wed Dec 31 22:28:45 EST 1969\n" + " Join Selectivity:\n" + " Last Updated Time: Fri Jan 02 05:47:01 EST 1970\n"; assertEquals(expected, formatted); }
public String format(final StorageType storageType, final RyaDetails details) { requireNonNull(details); final StringBuilder report = new StringBuilder(); report.append("General Metadata:\n"); report.append(" Instance Name: ").append(details.getRyaInstanceName()).append("\n"); report.append(" RYA Version: ").append( details.getRyaVersion() ).append("\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Users: ").append( Joiner.on(", ").join(details.getUsers()) ).append("\n"); } report.append("Secondary Indicies:\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Entity Centric Index:\n"); report.append(" Enabled: ").append( details.getEntityCentricIndexDetails().isEnabled() ).append("\n"); } report.append(" Free Text Index:\n"); report.append(" Enabled: ").append( details.getFreeTextIndexDetails().isEnabled() ).append("\n"); report.append(" Temporal Index:\n"); report.append(" Enabled: ").append( details.getTemporalIndexDetails().isEnabled() ).append("\n"); report.append(" PCJ Index:\n"); final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); report.append(" Enabled: ").append( pcjDetails.isEnabled() ).append("\n"); if(pcjDetails.isEnabled()) { if(pcjDetails.getFluoDetails().isPresent()) { final String fluoAppName = pcjDetails.getFluoDetails().get().getUpdateAppName(); report.append(" Fluo App Name: ").append(fluoAppName).append("\n"); } final ImmutableMap<String, PCJDetails> pcjs = pcjDetails.getPCJDetails(); report.append(" PCJs:\n"); if(pcjs.isEmpty()) { report.append(" No PCJs have been added yet.\n"); } else { for(final PCJDetails pcj : pcjs.values()) { report.append(" ID: ").append(pcj.getId()).append("\n"); final String updateStrategy = format( pcj.getUpdateStrategy(), "None" ); report.append(" Update Strategy: ").append(updateStrategy).append("\n"); final String lastUpdateTime = format( pcj.getLastUpdateTime(), "unavailable"); report.append(" Last Update Time: ").append(lastUpdateTime).append("\n"); } } if (storageType == StorageType.ACCUMULO) { report.append("Statistics:\n"); report.append(" Prospector:\n"); final String prospectorLastUpdateTime = format(details.getProspectorDetails().getLastUpdated(), "unavailable"); report.append(" Last Update Time: ").append(prospectorLastUpdateTime).append("\n"); report.append(" Join Selectivity:\n"); final String jsLastUpdateTime = format(details.getJoinSelectivityDetails().getLastUpdated(), "unavailable"); report.append(" Last Updated Time: ").append(jsLastUpdateTime).append("\n"); } } return report.toString(); }
RyaDetailsFormatter { public String format(final StorageType storageType, final RyaDetails details) { requireNonNull(details); final StringBuilder report = new StringBuilder(); report.append("General Metadata:\n"); report.append(" Instance Name: ").append(details.getRyaInstanceName()).append("\n"); report.append(" RYA Version: ").append( details.getRyaVersion() ).append("\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Users: ").append( Joiner.on(", ").join(details.getUsers()) ).append("\n"); } report.append("Secondary Indicies:\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Entity Centric Index:\n"); report.append(" Enabled: ").append( details.getEntityCentricIndexDetails().isEnabled() ).append("\n"); } report.append(" Free Text Index:\n"); report.append(" Enabled: ").append( details.getFreeTextIndexDetails().isEnabled() ).append("\n"); report.append(" Temporal Index:\n"); report.append(" Enabled: ").append( details.getTemporalIndexDetails().isEnabled() ).append("\n"); report.append(" PCJ Index:\n"); final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); report.append(" Enabled: ").append( pcjDetails.isEnabled() ).append("\n"); if(pcjDetails.isEnabled()) { if(pcjDetails.getFluoDetails().isPresent()) { final String fluoAppName = pcjDetails.getFluoDetails().get().getUpdateAppName(); report.append(" Fluo App Name: ").append(fluoAppName).append("\n"); } final ImmutableMap<String, PCJDetails> pcjs = pcjDetails.getPCJDetails(); report.append(" PCJs:\n"); if(pcjs.isEmpty()) { report.append(" No PCJs have been added yet.\n"); } else { for(final PCJDetails pcj : pcjs.values()) { report.append(" ID: ").append(pcj.getId()).append("\n"); final String updateStrategy = format( pcj.getUpdateStrategy(), "None" ); report.append(" Update Strategy: ").append(updateStrategy).append("\n"); final String lastUpdateTime = format( pcj.getLastUpdateTime(), "unavailable"); report.append(" Last Update Time: ").append(lastUpdateTime).append("\n"); } } if (storageType == StorageType.ACCUMULO) { report.append("Statistics:\n"); report.append(" Prospector:\n"); final String prospectorLastUpdateTime = format(details.getProspectorDetails().getLastUpdated(), "unavailable"); report.append(" Last Update Time: ").append(prospectorLastUpdateTime).append("\n"); report.append(" Join Selectivity:\n"); final String jsLastUpdateTime = format(details.getJoinSelectivityDetails().getLastUpdated(), "unavailable"); report.append(" Last Updated Time: ").append(jsLastUpdateTime).append("\n"); } } return report.toString(); } }
RyaDetailsFormatter { public String format(final StorageType storageType, final RyaDetails details) { requireNonNull(details); final StringBuilder report = new StringBuilder(); report.append("General Metadata:\n"); report.append(" Instance Name: ").append(details.getRyaInstanceName()).append("\n"); report.append(" RYA Version: ").append( details.getRyaVersion() ).append("\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Users: ").append( Joiner.on(", ").join(details.getUsers()) ).append("\n"); } report.append("Secondary Indicies:\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Entity Centric Index:\n"); report.append(" Enabled: ").append( details.getEntityCentricIndexDetails().isEnabled() ).append("\n"); } report.append(" Free Text Index:\n"); report.append(" Enabled: ").append( details.getFreeTextIndexDetails().isEnabled() ).append("\n"); report.append(" Temporal Index:\n"); report.append(" Enabled: ").append( details.getTemporalIndexDetails().isEnabled() ).append("\n"); report.append(" PCJ Index:\n"); final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); report.append(" Enabled: ").append( pcjDetails.isEnabled() ).append("\n"); if(pcjDetails.isEnabled()) { if(pcjDetails.getFluoDetails().isPresent()) { final String fluoAppName = pcjDetails.getFluoDetails().get().getUpdateAppName(); report.append(" Fluo App Name: ").append(fluoAppName).append("\n"); } final ImmutableMap<String, PCJDetails> pcjs = pcjDetails.getPCJDetails(); report.append(" PCJs:\n"); if(pcjs.isEmpty()) { report.append(" No PCJs have been added yet.\n"); } else { for(final PCJDetails pcj : pcjs.values()) { report.append(" ID: ").append(pcj.getId()).append("\n"); final String updateStrategy = format( pcj.getUpdateStrategy(), "None" ); report.append(" Update Strategy: ").append(updateStrategy).append("\n"); final String lastUpdateTime = format( pcj.getLastUpdateTime(), "unavailable"); report.append(" Last Update Time: ").append(lastUpdateTime).append("\n"); } } if (storageType == StorageType.ACCUMULO) { report.append("Statistics:\n"); report.append(" Prospector:\n"); final String prospectorLastUpdateTime = format(details.getProspectorDetails().getLastUpdated(), "unavailable"); report.append(" Last Update Time: ").append(prospectorLastUpdateTime).append("\n"); report.append(" Join Selectivity:\n"); final String jsLastUpdateTime = format(details.getJoinSelectivityDetails().getLastUpdated(), "unavailable"); report.append(" Last Updated Time: ").append(jsLastUpdateTime).append("\n"); } } return report.toString(); }  }
RyaDetailsFormatter { public String format(final StorageType storageType, final RyaDetails details) { requireNonNull(details); final StringBuilder report = new StringBuilder(); report.append("General Metadata:\n"); report.append(" Instance Name: ").append(details.getRyaInstanceName()).append("\n"); report.append(" RYA Version: ").append( details.getRyaVersion() ).append("\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Users: ").append( Joiner.on(", ").join(details.getUsers()) ).append("\n"); } report.append("Secondary Indicies:\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Entity Centric Index:\n"); report.append(" Enabled: ").append( details.getEntityCentricIndexDetails().isEnabled() ).append("\n"); } report.append(" Free Text Index:\n"); report.append(" Enabled: ").append( details.getFreeTextIndexDetails().isEnabled() ).append("\n"); report.append(" Temporal Index:\n"); report.append(" Enabled: ").append( details.getTemporalIndexDetails().isEnabled() ).append("\n"); report.append(" PCJ Index:\n"); final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); report.append(" Enabled: ").append( pcjDetails.isEnabled() ).append("\n"); if(pcjDetails.isEnabled()) { if(pcjDetails.getFluoDetails().isPresent()) { final String fluoAppName = pcjDetails.getFluoDetails().get().getUpdateAppName(); report.append(" Fluo App Name: ").append(fluoAppName).append("\n"); } final ImmutableMap<String, PCJDetails> pcjs = pcjDetails.getPCJDetails(); report.append(" PCJs:\n"); if(pcjs.isEmpty()) { report.append(" No PCJs have been added yet.\n"); } else { for(final PCJDetails pcj : pcjs.values()) { report.append(" ID: ").append(pcj.getId()).append("\n"); final String updateStrategy = format( pcj.getUpdateStrategy(), "None" ); report.append(" Update Strategy: ").append(updateStrategy).append("\n"); final String lastUpdateTime = format( pcj.getLastUpdateTime(), "unavailable"); report.append(" Last Update Time: ").append(lastUpdateTime).append("\n"); } } if (storageType == StorageType.ACCUMULO) { report.append("Statistics:\n"); report.append(" Prospector:\n"); final String prospectorLastUpdateTime = format(details.getProspectorDetails().getLastUpdated(), "unavailable"); report.append(" Last Update Time: ").append(prospectorLastUpdateTime).append("\n"); report.append(" Join Selectivity:\n"); final String jsLastUpdateTime = format(details.getJoinSelectivityDetails().getLastUpdated(), "unavailable"); report.append(" Last Updated Time: ").append(jsLastUpdateTime).append("\n"); } } return report.toString(); }  String format(final StorageType storageType, final RyaDetails details); }
RyaDetailsFormatter { public String format(final StorageType storageType, final RyaDetails details) { requireNonNull(details); final StringBuilder report = new StringBuilder(); report.append("General Metadata:\n"); report.append(" Instance Name: ").append(details.getRyaInstanceName()).append("\n"); report.append(" RYA Version: ").append( details.getRyaVersion() ).append("\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Users: ").append( Joiner.on(", ").join(details.getUsers()) ).append("\n"); } report.append("Secondary Indicies:\n"); if(storageType == StorageType.ACCUMULO) { report.append(" Entity Centric Index:\n"); report.append(" Enabled: ").append( details.getEntityCentricIndexDetails().isEnabled() ).append("\n"); } report.append(" Free Text Index:\n"); report.append(" Enabled: ").append( details.getFreeTextIndexDetails().isEnabled() ).append("\n"); report.append(" Temporal Index:\n"); report.append(" Enabled: ").append( details.getTemporalIndexDetails().isEnabled() ).append("\n"); report.append(" PCJ Index:\n"); final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); report.append(" Enabled: ").append( pcjDetails.isEnabled() ).append("\n"); if(pcjDetails.isEnabled()) { if(pcjDetails.getFluoDetails().isPresent()) { final String fluoAppName = pcjDetails.getFluoDetails().get().getUpdateAppName(); report.append(" Fluo App Name: ").append(fluoAppName).append("\n"); } final ImmutableMap<String, PCJDetails> pcjs = pcjDetails.getPCJDetails(); report.append(" PCJs:\n"); if(pcjs.isEmpty()) { report.append(" No PCJs have been added yet.\n"); } else { for(final PCJDetails pcj : pcjs.values()) { report.append(" ID: ").append(pcj.getId()).append("\n"); final String updateStrategy = format( pcj.getUpdateStrategy(), "None" ); report.append(" Update Strategy: ").append(updateStrategy).append("\n"); final String lastUpdateTime = format( pcj.getLastUpdateTime(), "unavailable"); report.append(" Last Update Time: ").append(lastUpdateTime).append("\n"); } } if (storageType == StorageType.ACCUMULO) { report.append("Statistics:\n"); report.append(" Prospector:\n"); final String prospectorLastUpdateTime = format(details.getProspectorDetails().getLastUpdated(), "unavailable"); report.append(" Last Update Time: ").append(prospectorLastUpdateTime).append("\n"); report.append(" Join Selectivity:\n"); final String jsLastUpdateTime = format(details.getJoinSelectivityDetails().getLastUpdated(), "unavailable"); report.append(" Last Updated Time: ").append(jsLastUpdateTime).append("\n"); } } return report.toString(); }  String format(final StorageType storageType, final RyaDetails details);  }