Search in sources :

Example 11 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceFilesTest method testParseBuildPropertiesRelativeFileWithAndWithoutConfigs.

@Test
public void testParseBuildPropertiesRelativeFileWithAndWithoutConfigs() {
    Properties buildProperties = createBuildPropertiesWithoutRootKeys();
    buildProperties.put("root." + WINDOWS_SPEC_FOR_PROPERTIES_KEY, "file:rootfiles/file1.txt");
    buildProperties.put("root." + LINUX_SPEC_FOR_PROPERTIES_KEY, "file:rootfiles/file2.txt");
    buildProperties.put("root", "rootfiles/dir");
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    FileToPathMap winFilesMap = getSourceToDestinationMap(advice, WINDOWS_SPEC_FOR_ADVICE);
    assertEquals(1, winFilesMap.size());
    assertRootFileEntry(winFilesMap, "rootfiles/file1.txt", "file1.txt");
    FileToPathMap linuxFilesMap = getSourceToDestinationMap(advice, LINUX_SPEC_FOR_ADVICE);
    assertEquals(1, linuxFilesMap.size());
    assertRootFileEntry(linuxFilesMap, "rootfiles/file2.txt", "file2.txt");
    FileToPathMap globalFilesMap = getSourceToDestinationMap(advice, GLOBAL_SPEC);
    assertEquals(1, globalFilesMap.size());
    assertRootFileEntry(globalFilesMap, "rootfiles/dir/file3.txt", "file3.txt");
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) Properties(java.util.Properties) Test(org.junit.Test)

Example 12 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceLinksTest method testGlobalLinks.

@Test
public void testGlobalLinks() {
    Properties buildProperties = createBuildPropertiesWithDefaultRootFiles();
    buildProperties.put("root.link", "dir/file3.txt,alias1.txt,file1.txt,alias2.txt");
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    String actualLink = advice.getDescriptor(GLOBAL_SPEC).getLinks();
    assertEquals("dir/file3.txt,alias1.txt,file1.txt,alias2.txt", actualLink);
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) Properties(java.util.Properties) Test(org.junit.Test)

Example 13 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceLinksTest method testLinkValueNotInPairs.

@Test(expected = IllegalArgumentException.class)
public void testLinkValueNotInPairs() throws Exception {
    Properties buildProperties = createBuildPropertiesWithDefaultRootFiles();
    buildProperties.put("root.link", "file1.txt,alias1.txt,file2.txt");
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    callGetDescriptorsForAllConfigurations(advice);
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) Properties(java.util.Properties) Test(org.junit.Test)

Example 14 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceLinksTest method testSpecificLinks.

@Test
public void testSpecificLinks() {
    Properties buildProperties = createBuildPropertiesWithDefaultRootFiles();
    buildProperties.put("root." + LINUX_SPEC_FOR_PROPERTIES_KEY, "file:rootfiles/dir/file3.txt");
    buildProperties.put("root." + LINUX_SPEC_FOR_PROPERTIES_KEY + ".link", "file3.txt,alias.txt");
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    String globalLink = advice.getDescriptor(GLOBAL_SPEC).getLinks();
    assertEquals("", globalLink);
    String specificLink = advice.getDescriptor(LINUX_SPEC_FOR_ADVICE).getLinks();
    assertEquals("file3.txt,alias.txt", specificLink);
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) Properties(java.util.Properties) Test(org.junit.Test)

Example 15 with IFeatureRootAdvice

use of org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice in project tycho by eclipse.

the class FeatureRootAdviceLinksTest method testGlobalLinkButNoFiles.

@Test(expected = IllegalArgumentException.class)
public void testGlobalLinkButNoFiles() throws Exception {
    Properties buildProperties = createBuildPropertiesWithoutRootKeys();
    buildProperties.put("root.link", "file1.txt,alias.txt");
    IFeatureRootAdvice advice = createAdvice(buildProperties);
    callGetDescriptorsForAllConfigurations(advice);
}
Also used : IFeatureRootAdvice(org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice) Properties(java.util.Properties) Test(org.junit.Test)

Aggregations

IFeatureRootAdvice (org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice)17 Test (org.junit.Test)15 Properties (java.util.Properties)14 File (java.io.File)1 ArrayList (java.util.ArrayList)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 IPublisherAdvice (org.eclipse.equinox.p2.publisher.IPublisherAdvice)1 BuildPropertiesParserForTesting (org.eclipse.tycho.test.util.BuildPropertiesParserForTesting)1