Search in sources :

Example 1 with NoopFileLockService

use of org.eclipse.tycho.test.util.NoopFileLockService in project tycho by eclipse.

the class TestResolverFactory method createLocalRepoIndices.

private LocalRepositoryP2Indices createLocalRepoIndices(MavenContext mavenContext) {
    LocalRepositoryP2IndicesImpl localRepoIndices = new LocalRepositoryP2IndicesImpl();
    localRepoIndices.setMavenContext(mavenContext);
    localRepoIndices.setFileLockService(new NoopFileLockService());
    return localRepoIndices;
}
Also used : NoopFileLockService(org.eclipse.tycho.test.util.NoopFileLockService) LocalRepositoryP2IndicesImpl(org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl)

Example 2 with NoopFileLockService

use of org.eclipse.tycho.test.util.NoopFileLockService in project tycho by eclipse.

the class FeatureXmlTransformerTest method testExpandReferences.

@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"));
    // 1720 bytes rounded to kiB
    assertThat(plugin.getDownloadSize(), is(1L));
    // 2419 bytes rounded to kiB // TODO shouldn't installSize=downloadSize for unpack=false?
    assertThat(plugin.getInstallSize(), is(2L));
    assertThat(plugin.isUnpack(), is(false));
}
Also used : SilentLog(org.apache.maven.plugin.testing.SilentLog) PluginRef(org.eclipse.tycho.model.PluginRef) NoopFileLockService(org.eclipse.tycho.test.util.NoopFileLockService) TargetPlatform(org.eclipse.tycho.artifacts.TargetPlatform) Feature(org.eclipse.tycho.model.Feature) File(java.io.File) Test(org.junit.Test)

Aggregations

NoopFileLockService (org.eclipse.tycho.test.util.NoopFileLockService)2 File (java.io.File)1 SilentLog (org.apache.maven.plugin.testing.SilentLog)1 TargetPlatform (org.eclipse.tycho.artifacts.TargetPlatform)1 Feature (org.eclipse.tycho.model.Feature)1 PluginRef (org.eclipse.tycho.model.PluginRef)1 LocalRepositoryP2IndicesImpl (org.eclipse.tycho.repository.local.index.LocalRepositoryP2IndicesImpl)1 Test (org.junit.Test)1