protected void insertPublisherInfoBehavior() { loader = new DataLoader(configLocation, executableLocation); // configure IExecutableAdvice LauncherData launcherData = loader.getLauncherData(); LaunchingAdvice launchingAdvice = new LaunchingAdvice(launcherData, configSpec); ArrayList launchingList = new ArrayList(); launchingList.add(launchingAdvice); ProductFileAdvice productAdvice = null; try { String productFileLocation = TestData.getFile("ProductActionTest", "productFileActionTest.product") .toString(); //$NON-NLS-1$ //$NON-NLS-2$ productAdvice = new ProductFileAdvice(new ProductFile(productFileLocation), configSpec); launchingList.add(productAdvice); } catch (Exception e) { fail("Unable to create product file advice", e); // $NON-NLS-1$ } expect( publisherInfo.getAdvice( EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IExecutableAdvice.class))) .andReturn(launchingList) .anyTimes(); // configure IConfigAdvice ConfigData configData = loader.getConfigData(); ConfigAdvice configAdvice = new ConfigAdvice(configData, configSpec); ArrayList configList = new ArrayList(); configList.add(configAdvice); configList.add(productAdvice); expect( publisherInfo.getAdvice( EasyMock.matches(configSpec), EasyMock.eq(false), (String) EasyMock.anyObject(), (Version) EasyMock.anyObject(), EasyMock.eq(IConfigAdvice.class))) .andReturn(configList) .anyTimes(); // setup metadata repository IInstallableUnit[] ius = { mockIU("foo", null), mockIU("bar", null) }; //$NON-NLS-1$ //$NON-NLS-2$ metadataRepo = new TestMetadataRepository(getAgent(), ius); expect(publisherInfo.getMetadataRepository()).andReturn(metadataRepo).anyTimes(); expect(publisherInfo.getContextMetadataRepository()).andReturn(null).anyTimes(); }
private void verifyFragment(String cuType) { ArrayList IUs = new ArrayList(publisherResult.getIUs(null, IPublisherResult.NON_ROOT)); for (int i = 0; i < IUs.size(); i++) { InstallableUnit iu = (InstallableUnit) IUs.get(i); if (iu.getId() .equals(flavor + id + "." + cuType + "." + configSpec)) { // $NON-NLS-1$ //$NON-NLS-2$ assertNull(iu.getFilter()); // no filter if config spec is ANY assertTrue(iu.getVersion().equals(version)); assertFalse(iu.isSingleton()); Collection<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities(); verifyProvidedCapability( providedCapabilities, IInstallableUnit.NAMESPACE_IU_ID, flavor + id + "." + cuType + "." + configSpec, version); //$NON-NLS-1$//$NON-NLS-2$ verifyProvidedCapability( providedCapabilities, flavor + id, id + "." + cuType, version); // $NON-NLS-1$ assertTrue(providedCapabilities.size() == 2); assertTrue(iu.getRequirements().size() == 0); if (cuType.equals("ini")) // $NON-NLS-1$ verifyLauncherArgs(iu); if (cuType.equals("config")) // $NON-NLS-1$ verifyConfigProperties(iu); return; // pass } } fail( "Configuration unit of type " + cuType + " was not enocuntered among fragments"); //$NON-NLS-1$ }
private void verifyAction() { ArrayList IUs = new ArrayList(publisherResult.getIUs(null, IPublisherResult.ROOT)); assertTrue(IUs.size() == 1); InstallableUnit iu = (InstallableUnit) IUs.get(0); assertTrue(iu.getId().equalsIgnoreCase(flavor + id + ".configuration")); // $NON-NLS-1$ // verify ProvidedCapabilities Collection<IProvidedCapability> providedCapabilities = iu.getProvidedCapabilities(); verifyProvidedCapability( providedCapabilities, "org.eclipse.equinox.p2.iu", iu.getId(), version); // $NON-NLS-1$ assertTrue(providedCapabilities.size() == 1); // verify RequiredCapabilities List<IRequirement> requiredCapability = iu.getRequirements(); assertTrue(requiredCapability.size() == 3); verifyRequiredCapability( requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, flavor + id + ".config." + configSpec, new VersionRange(version, true, version, true)); // $NON-NLS-1$ verifyRequiredCapability( requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, flavor + id + ".ini." + configSpec, new VersionRange(version, true, version, true)); // $NON-NLS-1$ verifyRequiredCapability( requiredCapability, IInstallableUnit.NAMESPACE_IU_ID, flavor + configSpec + ORG_ECLIPSE_CORE_COMMANDS, new VersionRange(version, true, version, true)); // verify non root IUs verifyFragment("ini"); // $NON-NLS-1$ verifyFragment("config"); // $NON-NLS-1$ verifyBundleCU(); }