@Test public void testFindPrefixesForExternalImports() { TestApplication app = new TestApplication(); ImportedVariable var1 = new ImportedVariable( "something.else", true, true ); ImportedVariable var2 = new ImportedVariable( "other.stuff", true, true ); app.getWar().getComponent().importedVariables.put( var1.getName(), var1 ); app.getWar().getComponent().importedVariables.put( var2.getName(), var2 ); Set<String> prefixes = VariableHelpers.findPrefixesForExternalImports( app ); Assert.assertEquals( 2, prefixes.size()); Assert.assertTrue( prefixes.contains( "other" )); Assert.assertTrue( prefixes.contains( "something" )); }
public static Set<String> findPrefixesForExternalImports( AbstractApplication app ) { Set<String> result = new TreeSet<> (); for( Component c : ComponentHelpers.findAllComponents( app )) { for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) { if( ! var.isExternal()) continue; String prefix = VariableHelpers.parseVariableName( var.getName()).getKey(); result.add( prefix ); } } return result; }
VariableHelpers { public static Set<String> findPrefixesForExternalImports( AbstractApplication app ) { Set<String> result = new TreeSet<> (); for( Component c : ComponentHelpers.findAllComponents( app )) { for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) { if( ! var.isExternal()) continue; String prefix = VariableHelpers.parseVariableName( var.getName()).getKey(); result.add( prefix ); } } return result; } }
VariableHelpers { public static Set<String> findPrefixesForExternalImports( AbstractApplication app ) { Set<String> result = new TreeSet<> (); for( Component c : ComponentHelpers.findAllComponents( app )) { for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) { if( ! var.isExternal()) continue; String prefix = VariableHelpers.parseVariableName( var.getName()).getKey(); result.add( prefix ); } } return result; } private  VariableHelpers(); }
VariableHelpers { public static Set<String> findPrefixesForExternalImports( AbstractApplication app ) { Set<String> result = new TreeSet<> (); for( Component c : ComponentHelpers.findAllComponents( app )) { for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) { if( ! var.isExternal()) continue; String prefix = VariableHelpers.parseVariableName( var.getName()).getKey(); result.add( prefix ); } } return result; } private  VariableHelpers(); static Map.Entry<String,String> parseVariableName( String variableName ); static Map.Entry<String,String> parseExportedVariable( String exportedVariable ); static Map<String,ExportedVariable> parseExportedVariables( String line ); static Set<String> findPrefixesForExportedVariables( Instance instance ); static Set<String> findPrefixesForImportedVariables( Instance instance ); static Set<String> findPrefixesForMandatoryImportedVariables( Instance instance ); static Set<String> findPrefixesForExternalImports( AbstractApplication app ); }
VariableHelpers { public static Set<String> findPrefixesForExternalImports( AbstractApplication app ) { Set<String> result = new TreeSet<> (); for( Component c : ComponentHelpers.findAllComponents( app )) { for( ImportedVariable var : ComponentHelpers.findAllImportedVariables( c ).values()) { if( ! var.isExternal()) continue; String prefix = VariableHelpers.parseVariableName( var.getName()).getKey(); result.add( prefix ); } } return result; } private  VariableHelpers(); static Map.Entry<String,String> parseVariableName( String variableName ); static Map.Entry<String,String> parseExportedVariable( String exportedVariable ); static Map<String,ExportedVariable> parseExportedVariables( String line ); static Set<String> findPrefixesForExportedVariables( Instance instance ); static Set<String> findPrefixesForImportedVariables( Instance instance ); static Set<String> findPrefixesForMandatoryImportedVariables( Instance instance ); static Set<String> findPrefixesForExternalImports( AbstractApplication app );  }