use of org.eclipse.scout.rt.shared.extension.IExtensionRegistry in project scout.rt by eclipse.
the class NestedContributionTest method testNestedContribution.
@Test
public void testNestedContribution() throws Exception {
// find the contribution that will be at the second position in a HashMap
final Map<Class, Boolean> findOrder = new HashMap<>(2);
findOrder.put(FirstGroupBox.class, Boolean.TRUE);
findOrder.put(SecondGroupBox.class, Boolean.FALSE);
final Iterator<Class> iterator = findOrder.keySet().iterator();
// skip first;
iterator.next();
// will be the second element in the contribution map. The element to search (boolean field) must be a child contribution of this class.
final Class second = iterator.next();
final IExtensionRegistry registry = BEANS.get(IExtensionRegistry.class);
registry.register(Contribution1.class);
registry.register(Contribution2.class);
// register the boolean field contribution into the second contribution (which is either FirstGroupBox or SecondGroupBox).
registry.register(BooleanField.class, second);
final MyForm frm = new MyForm();
final MainBox mainBox = frm.getMainBox();
assertNotNull(mainBox.getContribution(FirstGroupBox.class));
assertNotNull(mainBox.getContribution(SecondGroupBox.class));
assertNotNull(mainBox.getContribution(BooleanField.class));
}
use of org.eclipse.scout.rt.shared.extension.IExtensionRegistry in project scout.rt by eclipse.
the class ContributionOnlyOneTemplateTest method testContributeToDtoInOnlyOneTemplate.
@Test
public void testContributeToDtoInOnlyOneTemplate() throws Exception {
IExtensionRegistry extensionRegistry = BEANS.get(IExtensionRegistry.class);
extensionRegistry.register(PropertyExtensionData.class, new ClassIdentifier(SecondUseOfTemplateBox.class, SecondStringInTemplate.class));
doTest();
}
Aggregations