Index: src/org/eclipse/gmf/tests/runtime/emf/type/core/ElementTypeRegistryTest.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests.runtime.emf.type.core/src/org/eclipse/gmf/tests/runtime/emf/type/core/ElementTypeRegistryTest.java,v retrieving revision 1.2 diff -u -r1.2 ElementTypeRegistryTest.java --- src/org/eclipse/gmf/tests/runtime/emf/type/core/ElementTypeRegistryTest.java 6 Oct 2005 19:15:03 -0000 1.2 +++ src/org/eclipse/gmf/tests/runtime/emf/type/core/ElementTypeRegistryTest.java 7 Oct 2005 15:31:13 -0000 @@ -22,6 +22,7 @@ import org.eclipse.emf.ecore.EFactory; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.emf.type.core.ElementTypeAddedEvent; import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; import org.eclipse.gmf.runtime.emf.type.core.IElementType; @@ -31,8 +32,10 @@ import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType; import org.eclipse.gmf.runtime.emf.type.core.MetamodelType; import org.eclipse.gmf.runtime.emf.type.core.SpecializationType; +import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice; import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice; import org.eclipse.gmf.runtime.emf.type.core.internal.impl.DefaultElementTypeFactory; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.tests.runtime.emf.type.core.employee.Department; import org.eclipse.gmf.tests.runtime.emf.type.core.employee.Employee; import org.eclipse.gmf.tests.runtime.emf.type.core.employee.EmployeePackage; @@ -50,6 +53,15 @@ */ public class ElementTypeRegistryTest extends TestCase { + + private class MySpecializationAdvice extends AbstractEditHelperAdvice { + public MySpecializationAdvice() { + super(); + } + protected ICommand getBeforeCreateCommand(CreateElementRequest request) { + return super.getBeforeCreateCommand(request); + } + } private ElementTypeRegistry fixture = null; @@ -448,10 +460,12 @@ } public void test_register_specializationType() { + + IEditHelperAdvice specialAdvice = new MySpecializationAdvice(); String id = "dynamic.specialization.type"; //$NON-NLS-1$ final ISpecializationType dynamicSpecializationType = new SpecializationType(id, null, id, - new IElementType[] {EmployeeType.EMPLOYEE}, null, null, null); + new IElementType[] {EmployeeType.EMPLOYEE}, null, null, specialAdvice); final boolean[] listenerNotified = new boolean[] {false}; IElementTypeRegistryListener listener = new IElementTypeRegistryListener() { @@ -468,9 +482,15 @@ boolean result = ElementTypeRegistry.getInstance().register(dynamicSpecializationType); + // Check that the element type was registered assertTrue(result); assertTrue(listenerNotified[0]); - assertSame(dynamicSpecializationType, ElementTypeRegistry.getInstance().getType(id)); + assertSame(dynamicSpecializationType, getFixture().getType(id)); + + // Check that the advice can be retrieved + IEditHelperAdvice[] advice = getFixture().getEditHelperAdvice( + dynamicSpecializationType); + assertTrue(Arrays.asList(advice).contains(specialAdvice)); ElementTypeRegistry.getInstance().removeElementTypeRegistryListener(listener); } Index: src/org/eclipse/gmf/tests/runtime/emf/type/core/SpecializationTypeDescriptorTest.java =================================================================== RCS file: /home/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests.runtime.emf.type.core/src/org/eclipse/gmf/tests/runtime/emf/type/core/SpecializationTypeDescriptorTest.java,v retrieving revision 1.1 diff -u -r1.1 SpecializationTypeDescriptorTest.java --- src/org/eclipse/gmf/tests/runtime/emf/type/core/SpecializationTypeDescriptorTest.java 21 Sep 2005 21:01:34 -0000 1.1 +++ src/org/eclipse/gmf/tests/runtime/emf/type/core/SpecializationTypeDescriptorTest.java 7 Oct 2005 15:31:13 -0000 @@ -51,6 +51,7 @@ assertEquals(EmployeeType.MANAGER.getId(), getFixture().getId()); assertEquals(EmployeeType.MANAGER.getIconURL(), getFixture().getIconURL()); assertEquals(EmployeeType.MANAGER.getEContainerDescriptor(), getFixture().getContainerDescriptor()); + assertEquals(EmployeeType.MANAGER.getEditHelperAdvice(), getFixture().getEditHelperAdviceDescriptor().getEditHelperAdvice()); assertEquals(EmployeeType.MANAGER.getEditHelperAdvice(), getFixture().getEditHelperAdvice()); assertEquals(EmployeeType.MANAGER, getFixture().getElementType()); assertEquals(EmployeeType.MANAGER.getMatcher(), getFixture().getMatcher());