Search in sources :

Example 1 with CustomExecutionEnvironment

use of org.eclipse.tycho.core.ee.CustomExecutionEnvironment in project tycho by eclipse.

the class DependencyComputerTest method testWiringToPackageFromCustomProfile.

// TODO code reuse
@Test
public void testWiringToPackageFromCustomProfile() throws Exception {
    File basedir = getBasedir("projects/customProfile");
    Map<File, MavenProject> basedirMap = MavenSessionUtils.getBasedirMap(getSortedProjects(basedir, null));
    MavenProject project = basedirMap.get(new File(basedir, "bundle"));
    DependencyArtifacts platform = (DependencyArtifacts) project.getContextValue(TychoConstants.CTX_DEPENDENCY_ARTIFACTS);
    CustomExecutionEnvironment customProfile = new CustomExecutionEnvironment("custom", Arrays.asList(// 
    new SystemCapability(Type.JAVA_PACKAGE, "package.historically.not.in.jdk", "1.2.1"), // 
    new SystemCapability(Type.OSGI_EE, "OSGi/Minimum", "1.0.0"), // 
    new SystemCapability(Type.OSGI_EE, "JavaSE", "1.0.0"), // 
    new SystemCapability(Type.OSGI_EE, "JavaSE", "1.1.0"), new SystemCapability(Type.OSGI_EE, "JavaSE", "1.2.0")));
    State state = resolver.newResolvedState(project, customProfile, false, platform);
    BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
    List<DependencyEntry> dependencies = dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
    if (dependencies.size() > 0) {
        assertThat(dependencies.size(), is(1));
        assertThat(dependencies.get(0).desc.getSymbolicName(), is(Constants.SYSTEM_BUNDLE_SYMBOLICNAME));
    }
}
Also used : DependencyArtifacts(org.eclipse.tycho.artifacts.DependencyArtifacts) MavenProject(org.apache.maven.project.MavenProject) SystemCapability(org.eclipse.tycho.core.ee.shared.SystemCapability) State(org.eclipse.osgi.service.resolver.State) BundleDescription(org.eclipse.osgi.service.resolver.BundleDescription) CustomExecutionEnvironment(org.eclipse.tycho.core.ee.CustomExecutionEnvironment) DependencyEntry(org.eclipse.tycho.core.osgitools.DependencyComputer.DependencyEntry) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 MavenProject (org.apache.maven.project.MavenProject)1 BundleDescription (org.eclipse.osgi.service.resolver.BundleDescription)1 State (org.eclipse.osgi.service.resolver.State)1 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)1 CustomExecutionEnvironment (org.eclipse.tycho.core.ee.CustomExecutionEnvironment)1 SystemCapability (org.eclipse.tycho.core.ee.shared.SystemCapability)1 DependencyEntry (org.eclipse.tycho.core.osgitools.DependencyComputer.DependencyEntry)1 Test (org.junit.Test)1