DepTree implements Serializable { public Set<String> getNonJSExtensions(IAggregator aggregator) { final String sourceMethod = "getNonJSExtensions"; boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceClass, sourceMethod, new Object[]{aggregator}); } Set<String> result = new HashSet<String>(Arrays.asList(IDependencies.defaultNonJSExtensions)); Object cfgExtensions = aggregator.getConfig().getProperty(IDependencies.nonJSExtensionsCfgPropName, String[].class); if (cfgExtensions != null && cfgExtensions instanceof String[]) { result.addAll(Arrays.asList((String[])cfgExtensions)); } Iterable<IAggregatorExtension> aggrExts = aggregator.getExtensions(IModuleBuilderExtensionPoint.ID); if (aggrExts != null) { for (IAggregatorExtension aggrExt : aggrExts) { String ext = aggrExt.getAttribute(IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE); if (ext != null && ext.length() > 0 && !ext.equals("js") && !ext.equals("*")) { result.add(ext); } } } log.exiting(sourceClass, sourceMethod, result); return result; } protected  DepTree();  DepTree(Collection<URI> paths, IAggregator aggregator, long stamp, boolean clean, boolean validateDeps); boolean isFromCache(); DepTreeRoot mapDependencies(DepTreeRoot root, Map<String, URI> map, boolean failIfNoExist); Set<String> getNonJSExtensions(IAggregator aggregator);  }
@Test public void testGetNonJSExtensions() throws Exception { final List<IAggregatorExtension> moduleBuilderExtensions = new ArrayList<IAggregatorExtension>(); IAggregator mockAggregator = TestUtils.createMockAggregator(configRef, tmpdir); EasyMock.expect(mockAggregator.getExtensions(IModuleBuilderExtensionPoint.ID)).andAnswer(new IAnswer<Iterable<IAggregatorExtension>>() { @Override public Iterable<IAggregatorExtension> answer() throws Throwable { return moduleBuilderExtensions; } }).anyTimes(); EasyMock.replay(mockAggregator); String config = "{}"; ConfigImpl cfg = new ConfigImpl(mockAggregator, tmpdir.toURI(), config); configRef.set(cfg); DepTree depTree = new DepTree(); Set<String> exts = depTree.getNonJSExtensions(mockAggregator); Set<String> expected = new HashSet<String>(Arrays.asList(IDependencies.defaultNonJSExtensions)); Assert.assertEquals(expected, exts); config = "{" + IDependencies.nonJSExtensionsCfgPropName + ":['foo', 'bar']}"; cfg = new ConfigImpl(mockAggregator, tmpdir.toURI(), config); configRef.set(cfg); exts = depTree.getNonJSExtensions(mockAggregator); expected.addAll(Arrays.asList(new String[]{"foo", "bar"})); Assert.assertEquals(expected, exts); Properties props = new Properties(); props.put(IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE, "ext1"); moduleBuilderExtensions.add(new AggregatorExtension(new DummyModuleBuilder(), props, null, IModuleBuilderExtensionPoint.ID, "1")); props = new Properties(); props.put(IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE, "ext2"); moduleBuilderExtensions.add(new AggregatorExtension(new DummyModuleBuilder(), props, null, IModuleBuilderExtensionPoint.ID, "2")); exts = depTree.getNonJSExtensions(mockAggregator); expected.addAll(Arrays.asList(new String[]{"ext1", "ext2"})); Assert.assertEquals(expected, exts); }