@Test public void testGroupIdAndVersionFiltering() { Properties instructions = new Properties(); instructions.setProperty(DependencyEmbedder.EMBED_DEPENDENCY, "acme:*:*:1"); DependencyEmbedder dependencyEmbedder = new DependencyEmbedder(instructions, reporter); Artifact acme = create("acme", "acme-sample", "1"); acme.setScope("provided"); Artifact acme2 = create("acme", "acme-sample-2", "1"); ProjectDependencies dependencies = new ProjectDependencies( ImmutableList.of(create("org.wisdom-framework", "wisdom-api", "1"), acme, acme2), ImmutableList.of(create("org.wisdom-framework", "wisdom-api", "1"), acme, acme2) ); Properties properties = dependencyEmbedder.generate(instructions, dependencies); assertThat(properties.getProperty(Constants.INCLUDE_RESOURCE)) .contains("@" + acme.getFile().getAbsolutePath()) .contains("@" + acme2.getFile().getAbsolutePath()); assertThat(properties.getProperty(Constants.BUNDLE_CLASSPATH)).isNull(); instructions.setProperty(DependencyEmbedder.EMBED_DEPENDENCY, "acme:*:*:2"); dependencyEmbedder = new DependencyEmbedder(instructions, reporter); acme = create("acme", "acme-sample", "2"); acme.setScope("provided"); acme2 = create("acme", "acme-sample-2", "1"); dependencies = new ProjectDependencies( ImmutableList.of(create("org.wisdom-framework", "wisdom-api", "1"), acme, acme2), ImmutableList.of(create("org.wisdom-framework", "wisdom-api", "1"), acme, acme2) ); properties = dependencyEmbedder.generate(instructions, dependencies); assertThat(properties.getProperty(Constants.INCLUDE_RESOURCE)) .contains("@" + acme.getFile().getAbsolutePath()) .doesNotContain("@" + acme2.getFile().getAbsolutePath()); assertThat(properties.getProperty(Constants.BUNDLE_CLASSPATH)).isNull(); }
public Properties generate(Properties instructions, ProjectDependencies dependencies) { Properties result = new Properties(); result.putAll(instructions); StringBuilder include = new StringBuilder(); if (instructions.getProperty(Constants.INCLUDE_RESOURCE) != null) { include.append(instructions.getProperty(Constants.INCLUDE_RESOURCE)); } StringBuilder classpath = new StringBuilder(); final String originalClassPath = instructions.getProperty(Constants.BUNDLE_CLASSPATH); if (originalClassPath != null) { classpath.append(originalClassPath); } for (EmbeddedDependency configuration : embedded) { configuration.addClause(dependencies, include, classpath, reporter); } if (include.length() != 0) { result.setProperty(Constants.INCLUDE_RESOURCE, include.toString()); } if (classpath.length() != 0) { if (originalClassPath != null) { result.setProperty(Constants.BUNDLE_CLASSPATH, classpath.toString()); } else { result.setProperty(Constants.BUNDLE_CLASSPATH, "., " + classpath.toString()); } } return result; }
DependencyEmbedder { public Properties generate(Properties instructions, ProjectDependencies dependencies) { Properties result = new Properties(); result.putAll(instructions); StringBuilder include = new StringBuilder(); if (instructions.getProperty(Constants.INCLUDE_RESOURCE) != null) { include.append(instructions.getProperty(Constants.INCLUDE_RESOURCE)); } StringBuilder classpath = new StringBuilder(); final String originalClassPath = instructions.getProperty(Constants.BUNDLE_CLASSPATH); if (originalClassPath != null) { classpath.append(originalClassPath); } for (EmbeddedDependency configuration : embedded) { configuration.addClause(dependencies, include, classpath, reporter); } if (include.length() != 0) { result.setProperty(Constants.INCLUDE_RESOURCE, include.toString()); } if (classpath.length() != 0) { if (originalClassPath != null) { result.setProperty(Constants.BUNDLE_CLASSPATH, classpath.toString()); } else { result.setProperty(Constants.BUNDLE_CLASSPATH, "., " + classpath.toString()); } } return result; } }
DependencyEmbedder { public Properties generate(Properties instructions, ProjectDependencies dependencies) { Properties result = new Properties(); result.putAll(instructions); StringBuilder include = new StringBuilder(); if (instructions.getProperty(Constants.INCLUDE_RESOURCE) != null) { include.append(instructions.getProperty(Constants.INCLUDE_RESOURCE)); } StringBuilder classpath = new StringBuilder(); final String originalClassPath = instructions.getProperty(Constants.BUNDLE_CLASSPATH); if (originalClassPath != null) { classpath.append(originalClassPath); } for (EmbeddedDependency configuration : embedded) { configuration.addClause(dependencies, include, classpath, reporter); } if (include.length() != 0) { result.setProperty(Constants.INCLUDE_RESOURCE, include.toString()); } if (classpath.length() != 0) { if (originalClassPath != null) { result.setProperty(Constants.BUNDLE_CLASSPATH, classpath.toString()); } else { result.setProperty(Constants.BUNDLE_CLASSPATH, "., " + classpath.toString()); } } return result; } DependencyEmbedder(Properties instructions, Reporter reporter); }
DependencyEmbedder { public Properties generate(Properties instructions, ProjectDependencies dependencies) { Properties result = new Properties(); result.putAll(instructions); StringBuilder include = new StringBuilder(); if (instructions.getProperty(Constants.INCLUDE_RESOURCE) != null) { include.append(instructions.getProperty(Constants.INCLUDE_RESOURCE)); } StringBuilder classpath = new StringBuilder(); final String originalClassPath = instructions.getProperty(Constants.BUNDLE_CLASSPATH); if (originalClassPath != null) { classpath.append(originalClassPath); } for (EmbeddedDependency configuration : embedded) { configuration.addClause(dependencies, include, classpath, reporter); } if (include.length() != 0) { result.setProperty(Constants.INCLUDE_RESOURCE, include.toString()); } if (classpath.length() != 0) { if (originalClassPath != null) { result.setProperty(Constants.BUNDLE_CLASSPATH, classpath.toString()); } else { result.setProperty(Constants.BUNDLE_CLASSPATH, "., " + classpath.toString()); } } return result; } DependencyEmbedder(Properties instructions, Reporter reporter); Properties generate(Properties instructions, ProjectDependencies dependencies); }
DependencyEmbedder { public Properties generate(Properties instructions, ProjectDependencies dependencies) { Properties result = new Properties(); result.putAll(instructions); StringBuilder include = new StringBuilder(); if (instructions.getProperty(Constants.INCLUDE_RESOURCE) != null) { include.append(instructions.getProperty(Constants.INCLUDE_RESOURCE)); } StringBuilder classpath = new StringBuilder(); final String originalClassPath = instructions.getProperty(Constants.BUNDLE_CLASSPATH); if (originalClassPath != null) { classpath.append(originalClassPath); } for (EmbeddedDependency configuration : embedded) { configuration.addClause(dependencies, include, classpath, reporter); } if (include.length() != 0) { result.setProperty(Constants.INCLUDE_RESOURCE, include.toString()); } if (classpath.length() != 0) { if (originalClassPath != null) { result.setProperty(Constants.BUNDLE_CLASSPATH, classpath.toString()); } else { result.setProperty(Constants.BUNDLE_CLASSPATH, "., " + classpath.toString()); } } return result; } DependencyEmbedder(Properties instructions, Reporter reporter); Properties generate(Properties instructions, ProjectDependencies dependencies); static final String EMBED_DEPENDENCY; static final String EMBED_TRANSITIVE; }