public static String getTargetVersionString() { IMonitorModelBase model = MonitorRegistry.findModel(IPDEBuildConstants.BUNDLE_OSGI); if (model == null) return ICoreConstants.TARGET37; String version = model.getMonitorBase().getVersion(); if (VersionUtil.validateVersion(version).getSeverity() == IStatus.OK) { Version vid = new Version(version); int major = vid.getMajor(); int minor = vid.getMinor(); if (major == 3 && minor == 0) return ICoreConstants.TARGET30; if (major == 3 && minor == 1) return ICoreConstants.TARGET31; if (major == 3 && minor == 2) return ICoreConstants.TARGET32; if (major == 3 && minor == 3) return ICoreConstants.TARGET33; if (major == 3 && minor == 4) return ICoreConstants.TARGET34; if (major == 3 && minor == 5) return ICoreConstants.TARGET35; if (major == 3 && minor == 6) return ICoreConstants.TARGET36; } return ICoreConstants.TARGET37; }
public void testGetAction() { final ArrayList actionsList1 = new ArrayList(); InstallableUnitPhase phase1 = new InstallableUnitPhase("test", 1) { protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) { List<ProvisioningAction> actions = getActions(operand.second(), "test1"); actionsList1.addAll(actions); return actions; } }; final ArrayList actionsList2 = new ArrayList(); InstallableUnitPhase phase2 = new InstallableUnitPhase("test", 1) { protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) { List<ProvisioningAction> actions = getActions(operand.second(), "test2"); actionsList2.addAll(actions); return actions; } }; PhaseSet phaseSet = new TestPhaseSet(new Phase[] {phase1, phase2}); IProfile profile = createProfile("PhaseTest"); Map instructions = new HashMap(); instructions.put("test1", MetadataFactory.createTouchpointInstruction("test1.test()", null)); instructions.put("test2", MetadataFactory.createTouchpointInstruction("test2.test()", null)); ITouchpointData touchpointData = MetadataFactory.createTouchpointData(instructions); IInstallableUnit unit = createIU( "test", Version.create("1.0.0"), null, NO_REQUIRES, new IProvidedCapability[0], NO_PROPERTIES, ITouchpointType.NONE, touchpointData, false); IProvisioningPlan plan = engine.createPlan(profile, null); plan.addInstallableUnit(unit); IStatus status = engine.perform(plan, phaseSet, new NullProgressMonitor()); if (!status.isOK()) { fail(status.toString()); } assertEquals( TestAction.class, ((ParameterizedProvisioningAction) actionsList1.get(0)).getAction().getClass()); assertEquals( TestAction.class, ((ParameterizedProvisioningAction) actionsList2.get(0)).getAction().getClass()); }