use of org.eclipse.core.internal.expressions.Property in project eclipse.platform.runtime by eclipse.
the class PropertyTesterTests method test.
private boolean test(String namespace, Object receiver, String property, Object[] args, Object expectedValue) throws CoreException {
Property p = fgManager.getProperty(receiver, namespace, property);
assertTrue(p.isInstantiated());
return p.test(receiver, args, expectedValue);
}
use of org.eclipse.core.internal.expressions.Property in project eclipse.platform.runtime by eclipse.
the class PropertyTesterTests method testDynamicPlugin.
public void testDynamicPlugin() throws Exception {
if (TEST_DYNAMIC_AND_ACTIVATION) {
A receiver = new A();
// $NON-NLS-1$ //$NON-NLS-2$
Property p = fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing");
assertTrue(!p.isInstantiated());
// $NON-NLS-1$
Bundle bundle = Platform.getBundle("org.eclipse.core.expressions.tests.dynamic");
bundle.start();
// $NON-NLS-1$ //$NON-NLS-2$
p = fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing");
assertTrue(p.isInstantiated());
bundle.stop();
bundle.uninstall();
boolean exception = false;
try {
// $NON-NLS-1$ //$NON-NLS-2$
p = fgManager.getProperty(receiver, "org.eclipse.core.expressions.tests.dynamic", "testing");
} catch (CoreException e) {
exception = true;
} catch (InvalidRegistryObjectException e) {
// The uninstall events are sent out in a separate thread.
// So the type extension registry might not be flushed even
// though the bundle has already been uninstalled.
exception = true;
}
assertTrue("Core exception not thrown", exception);
}
}
use of org.eclipse.core.internal.expressions.Property in project eclipse.platform.runtime by eclipse.
the class PropertyTesterTests method testPluginActivation.
public void testPluginActivation() throws Exception {
if (TEST_DYNAMIC_AND_ACTIVATION) {
// $NON-NLS-1$
Bundle bundle = Platform.getBundle("org.eclipse.core.expressions.tests.forceActivation");
assertEquals(Bundle.STARTING, bundle.getState());
A receiver = new A();
TestExpression exp = new TestExpression("org.eclipse.core.expressions.tests.forceActivation", "testing", null, null, true);
EvaluationContext context = new EvaluationContext(null, receiver);
EvaluationResult result = exp.evaluate(context);
assertEquals(EvaluationResult.NOT_LOADED, result);
assertEquals(Bundle.STARTING, bundle.getState());
// $NON-NLS-1$ //$NON-NLS-2$
Property p = TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false);
assertTrue(!p.isInstantiated());
context.setAllowPluginActivation(true);
exp.evaluate(context);
assertEquals(Bundle.ACTIVE, bundle.getState());
// $NON-NLS-1$ //$NON-NLS-2$
p = TestExpression.testGetTypeExtensionManager().getProperty(receiver, "org.eclipse.core.expressions.tests.forceActivation", "testing", false);
assertTrue(p.isInstantiated());
}
}
Aggregations