@SuppressWarnings("deprecation") @Test public void testExpandReferences() throws Exception { subject = new FeatureXmlTransformer(new SilentLog(), new NoopFileLockService()); Feature feature = Feature .read(new File(TestUtil.getBasedir("projects/featureXmlVersionExpansion/"), "feature.xml")); TargetPlatform tp = mock(TargetPlatform.class); when(tp.resolveArtifact("eclipse-feature", "org.eclipse.rcp", "4.5.0.qualifier")).thenReturn(rcpFeatureInTP); when(tp.resolveArtifact("eclipse-plugin", "org.junit4", "4.8.1.qualifier")).thenReturn(junit4InTP); when(tp.getArtifactLocation(junit4InTP)).thenReturn(junit4JarLocation); subject.expandReferences(feature, tp); assertThat(feature.getIncludedFeatures(), hasItem(feature("org.eclipse.rcp", "4.5.0.v20140918"))); assertThat(feature.getPlugins(), hasItem(plugin("org.junit4", "4.8.1.v20100302"))); PluginRef plugin = feature.getPlugins().get(0); assertThat(plugin.getId(), is("org.junit4")); assertThat(plugin.getDownloadSize(), is(1L)); assertThat(plugin.getInstallSize(), is(2L)); assertThat(plugin.isUnpack(), is(false)); }
public Feature expandReferences(Feature feature, TargetPlatform targetPlatform) throws MojoFailureException { for (PluginRef pluginRef : feature.getPlugins()) { ArtifactKey plugin = resolvePluginReference(targetPlatform, pluginRef); pluginRef.setVersion(plugin.getVersion()); File location = targetPlatform.getArtifactLocation(plugin); setDownloadAndInstallSize(pluginRef, location); } for (FeatureRef featureRef : feature.getIncludedFeatures()) { ArtifactKey includedFeature = resolveFeatureReference(targetPlatform, featureRef); featureRef.setVersion(includedFeature.getVersion()); } return feature; }
FeatureXmlTransformer { public Feature expandReferences(Feature feature, TargetPlatform targetPlatform) throws MojoFailureException { for (PluginRef pluginRef : feature.getPlugins()) { ArtifactKey plugin = resolvePluginReference(targetPlatform, pluginRef); pluginRef.setVersion(plugin.getVersion()); File location = targetPlatform.getArtifactLocation(plugin); setDownloadAndInstallSize(pluginRef, location); } for (FeatureRef featureRef : feature.getIncludedFeatures()) { ArtifactKey includedFeature = resolveFeatureReference(targetPlatform, featureRef); featureRef.setVersion(includedFeature.getVersion()); } return feature; } }
FeatureXmlTransformer { public Feature expandReferences(Feature feature, TargetPlatform targetPlatform) throws MojoFailureException { for (PluginRef pluginRef : feature.getPlugins()) { ArtifactKey plugin = resolvePluginReference(targetPlatform, pluginRef); pluginRef.setVersion(plugin.getVersion()); File location = targetPlatform.getArtifactLocation(plugin); setDownloadAndInstallSize(pluginRef, location); } for (FeatureRef featureRef : feature.getIncludedFeatures()) { ArtifactKey includedFeature = resolveFeatureReference(targetPlatform, featureRef); featureRef.setVersion(includedFeature.getVersion()); } return feature; } FeatureXmlTransformer();  FeatureXmlTransformer(Logger log, FileLockService fileLockService); }
FeatureXmlTransformer { public Feature expandReferences(Feature feature, TargetPlatform targetPlatform) throws MojoFailureException { for (PluginRef pluginRef : feature.getPlugins()) { ArtifactKey plugin = resolvePluginReference(targetPlatform, pluginRef); pluginRef.setVersion(plugin.getVersion()); File location = targetPlatform.getArtifactLocation(plugin); setDownloadAndInstallSize(pluginRef, location); } for (FeatureRef featureRef : feature.getIncludedFeatures()) { ArtifactKey includedFeature = resolveFeatureReference(targetPlatform, featureRef); featureRef.setVersion(includedFeature.getVersion()); } return feature; } FeatureXmlTransformer();  FeatureXmlTransformer(Logger log, FileLockService fileLockService); Feature expandReferences(Feature feature, TargetPlatform targetPlatform); }
FeatureXmlTransformer { public Feature expandReferences(Feature feature, TargetPlatform targetPlatform) throws MojoFailureException { for (PluginRef pluginRef : feature.getPlugins()) { ArtifactKey plugin = resolvePluginReference(targetPlatform, pluginRef); pluginRef.setVersion(plugin.getVersion()); File location = targetPlatform.getArtifactLocation(plugin); setDownloadAndInstallSize(pluginRef, location); } for (FeatureRef featureRef : feature.getIncludedFeatures()) { ArtifactKey includedFeature = resolveFeatureReference(targetPlatform, featureRef); featureRef.setVersion(includedFeature.getVersion()); } return feature; } FeatureXmlTransformer();  FeatureXmlTransformer(Logger log, FileLockService fileLockService); Feature expandReferences(Feature feature, TargetPlatform targetPlatform);  }