Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetya Sabeva2012-11-08 16:19:43 +0000
committerPetya Sabeva2012-11-08 16:19:43 +0000
commitc7d9cd3bf69c8fe2f3274b43eab9147573d1b275 (patch)
tree47b32ca17b6b2cc6b40e48969efcda3674b2cf02 /jpa_diagram_editor/tests
parent1e2bfd070a8a180d2e83ab421935d7e17e96db4b (diff)
downloadwebtools.dali-c7d9cd3bf69c8fe2f3274b43eab9147573d1b275.tar.gz
webtools.dali-c7d9cd3bf69c8fe2f3274b43eab9147573d1b275.tar.xz
webtools.dali-c7d9cd3bf69c8fe2f3274b43eab9147573d1b275.zip
Fix failing swtbot tests and small bugs.v201211081521
Diffstat (limited to 'jpa_diagram_editor/tests')
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EditorProxy.java303
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EmbeddableInDiagramSWTBotTest.java430
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EntitiesInDiagramSWTBotTest.java150
-rw-r--r--jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/MappedSuperclassesInDiagramSWTBotTest.java173
4 files changed, 543 insertions, 513 deletions
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EditorProxy.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EditorProxy.java
index 75e2fc2e24..cbea87afa5 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EditorProxy.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EditorProxy.java
@@ -13,11 +13,16 @@ import static org.junit.Assert.fail;
import java.awt.AWTException;
import java.awt.Robot;
import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.GraphicalEditPart;
@@ -25,25 +30,27 @@ import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.LayerConstants;
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.internal.ExternalPictogramLink;
-import org.eclipse.graphiti.mm.Property;
import org.eclipse.graphiti.mm.pictograms.FreeFormConnection;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.graphiti.ui.internal.contextbuttons.ContextButton;
import org.eclipse.graphiti.ui.internal.contextbuttons.ContextButtonPad;
import org.eclipse.graphiti.ui.internal.parts.DiagramEditPart;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.context.PersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
import org.eclipse.jpt.jpadiagrameditor.swtbot.tests.internal.Utils;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.propertypage.JPADiagramPropertyPage;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.HasReferanceRelation;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.HasReferanceRelation.HasReferenceType;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation.RelType;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation;
@@ -73,7 +80,7 @@ import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
-@SuppressWarnings("restriction")
+@SuppressWarnings({"restriction", "deprecation", "unchecked"})
public class EditorProxy {
private final SWTWorkbenchBot workbenchBot;
@@ -298,21 +305,24 @@ public class EditorProxy {
return figure.isVisible();
}
- /**
- * Adds an entity to the diagram
- *
- * @param entityName
- * - the name of the entity to be added
- * @return the added entity
- */
- public SWTBotGefEditPart addEntityToDiagram(int x, int y, String entityName) {
+ /**
+ * Add entity to diagram
+ * @param x
+ * @param y
+ * @param jpaProject
+ * @return the newly added entity
+ */
+ public SWTBotGefEditPart addEntityToDiagram(int x, int y, JpaProject jpaProject) {
+
+ String entityName = getUniqueEntityName(jpaProject);
+
jpaDiagramEditor
.activateTool(JPAEditorMessages.CreateJPAEntityFeature_jpaEntityFeatureName);
jpaDiagramEditor.doubleClick(x, y);
-
+
try {
bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
- 30000);
+ 15000);
} catch (TimeoutException e) {
jpaDiagramEditor.activateDefaultTool();
@@ -321,8 +331,9 @@ public class EditorProxy {
jpaDiagramEditor.doubleClick(x, y);
bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
- 30000);
+ 15000);
}
+
List<SWTBotGefEditPart> entities = jpaDiagramEditor.mainEditPart()
.children();
@@ -354,22 +365,25 @@ public class EditorProxy {
return entity;
}
- /**
- * Adds mapped superclass to the diagram
- *
- * @param entityName
- * - the name of the mapped superclass to be added
- * @return the added mapped superclass
- */
+ /**
+ * Add mapped superclass to diagram
+ * @param x
+ * @param y
+ * @param jpaProject
+ * @return the newly added mapped superclass
+ */
public SWTBotGefEditPart addMappedSuperclassToDiagram(int x, int y,
- String entityName) {
+ JpaProject jpaProject) {
+
+ String mappedSuperclassName = getUniqueMappedSuperclassName(jpaProject);
+
jpaDiagramEditor
.activateTool(JPAEditorMessages.CreateMappedSuperclassFeature_createMappedSuperclassFeatureName);
jpaDiagramEditor.doubleClick(x, y);
try {
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
- 30000);
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, mappedSuperclassName),
+ 15000);
} catch (TimeoutException e) {
jpaDiagramEditor.activateDefaultTool();
@@ -377,17 +391,16 @@ public class EditorProxy {
.activateTool(JPAEditorMessages.CreateMappedSuperclassFeature_createMappedSuperclassFeatureName);
jpaDiagramEditor.doubleClick(x, y);
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
- 30000);
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, mappedSuperclassName),
+ 15000);
}
-
List<SWTBotGefEditPart> entities = jpaDiagramEditor.mainEditPart()
.children();
assertFalse("Editor must contains at least one mapped superclass!",
entities.isEmpty());
SWTBotGefEditPart mappedSuperclass = jpaDiagramEditor
- .getEditPart(entityName);
+ .getEditPart(mappedSuperclassName);
assertNotNull("Mapped superclass is not added!", mappedSuperclass);
List<SWTBotGefEditPart> parts = new ArrayList<SWTBotGefEditPart>();
@@ -417,22 +430,25 @@ public class EditorProxy {
return mappedSuperclass;
}
- /**
- * Adds mapped superclass to the diagram
- *
- * @param entityName
- * - the name of the mapped superclass to be added
- * @return the added mapped superclass
- */
+ /**
+ * Add embeddable to diagram
+ * @param x
+ * @param y
+ * @param jpaProject
+ * @return the newly added embeddable
+ */
public SWTBotGefEditPart addEmbeddableToDiagram(int x, int y,
- String entityName) {
+ JpaProject jpaProject) {
+
+ String embeddableName = getUniqueEmbeddableName(jpaProject);
+
jpaDiagramEditor
.activateTool(JPAEditorMessages.CreateEmbeddableFeature_EmbeddableFeatureName);
jpaDiagramEditor.doubleClick(x, y);
try {
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
- 30000);
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, embeddableName),
+ 15000);
} catch (TimeoutException e) {
jpaDiagramEditor.activateDefaultTool();
@@ -440,8 +456,8 @@ public class EditorProxy {
.activateTool(JPAEditorMessages.CreateEmbeddableFeature_EmbeddableFeatureName);
jpaDiagramEditor.doubleClick(x, y);
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
- 30000);
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, embeddableName),
+ 15000);
}
List<SWTBotGefEditPart> entities = jpaDiagramEditor.mainEditPart()
@@ -449,7 +465,7 @@ public class EditorProxy {
assertFalse("Editor must contains at least one embeddable!",
entities.isEmpty());
- SWTBotGefEditPart embeddable = jpaDiagramEditor.getEditPart(entityName);
+ SWTBotGefEditPart embeddable = jpaDiagramEditor.getEditPart(embeddableName);
assertNotNull("Embeddable is not added!", embeddable);
List<SWTBotGefEditPart> editParts = new ArrayList<SWTBotGefEditPart>();
@@ -564,7 +580,6 @@ public class EditorProxy {
public void deleteDiagramElements() {
jpaDiagramEditor.save();
-
List<SWTBotGefEditPart> entitiesInDiagram = jpaDiagramEditor
.mainEditPart().children();
// assertFalse("Diagram must contain at least one entity!",
@@ -584,6 +599,8 @@ public class EditorProxy {
waitASecond();
entitiesInDiagram = jpaDiagramEditor.mainEditPart().children();
assertTrue("Diagram must be empty!", entitiesInDiagram.isEmpty());
+
+ jpaDiagramEditor.save();
// assertTrue("Editor must be dirty!", jpaDiagramEditor.isDirty());
}
@@ -677,7 +694,6 @@ public class EditorProxy {
*
* @return the entity's context button pad
*/
- @SuppressWarnings("restriction")
private ContextButtonPad findContextButtonPad() {
SWTBotGefEditPart rootEditPart = jpaDiagramEditor.rootEditPart();
IFigure feedbackLayer = ((ScalableFreeformRootEditPart) rootEditPart
@@ -757,7 +773,6 @@ public class EditorProxy {
* @param gefConn
* @return the IRelation object for the given GEF Connection
*/
- @SuppressWarnings("restriction")
public IRelation getConnection(SWTBotGefConnectionEditPart gefConn) {
IFeatureProvider fp = ((DiagramEditPart) jpaDiagramEditor
.mainEditPart().part()).getFeatureProvider();
@@ -777,22 +792,28 @@ public class EditorProxy {
* @param gefConn
* @return the IRelation object for the given GEF Connection
*/
- @SuppressWarnings("restriction")
public HasReferanceRelation getHasReferenceConnection(
SWTBotGefConnectionEditPart gefConn) {
- IFeatureProvider fp = ((DiagramEditPart) jpaDiagramEditor
+ IJPAEditorFeatureProvider fp = (IJPAEditorFeatureProvider) ((DiagramEditPart) jpaDiagramEditor
.mainEditPart().part()).getFeatureProvider();
FreeFormConnection conn = (FreeFormConnection) gefConn.part()
.getModel();
assertNotNull("Relation is not created.", conn);
Object ob = fp.getBusinessObjectForPictogramElement(conn);
-
- assertNotNull("Such a relation must exists.", ob);
- if (ob instanceof HasReferanceRelation) {
- return (HasReferanceRelation) ob;
+ if(ob == null){
+ HashSet<HasReferanceRelation> refs = fp.getAllExistingHasReferenceRelations();
+ for(HasReferanceRelation ref : refs){
+ FreeFormConnection connection = (FreeFormConnection) fp.getPictogramElementForBusinessObject(ref);
+ if(connection.equals(conn)){
+ return ref;
+ }
+ }
+ } else {
+ if (ob instanceof HasReferanceRelation) {
+ return (HasReferanceRelation) ob;
+ }
}
-
return null;
}
@@ -808,6 +829,8 @@ public class EditorProxy {
final IFeatureProvider fp = ((DiagramEditPart) jpaDiagramEditor
.mainEditPart().part()).getFeatureProvider();
PictogramElement el = (PictogramElement) element.part().getModel();
+ if(el == null)
+ return null;
Object bo = fp.getBusinessObjectForPictogramElement(el);
if (bo instanceof JavaPersistentType) {
return (JavaPersistentType) bo;
@@ -832,7 +855,6 @@ public class EditorProxy {
*
* @return the existing isArelation if exists, null otherwise
*/
- @SuppressWarnings("restriction")
public IsARelation getIsARelationship() {
IJPAEditorFeatureProvider fp = (IJPAEditorFeatureProvider) ((DiagramEditPart) jpaDiagramEditor
.mainEditPart().part()).getFeatureProvider();
@@ -849,7 +871,6 @@ public class EditorProxy {
* @param element
* @return true if the entity contains unsaved changes, false otherwise
*/
- @SuppressWarnings("restriction")
public boolean isJPTDirty(SWTBotGefEditPart element) {
final IFeatureProvider fp = ((DiagramEditPart) jpaDiagramEditor
.mainEditPart().part()).getFeatureProvider();
@@ -1269,7 +1290,6 @@ public class EditorProxy {
* - the title of the section to be checked
* @return true, if the sections is visible, false otherwise
*/
- @SuppressWarnings("deprecation")
public boolean isSectionVisible(SWTBotGefEditPart editPart,
String sectionTitle) {
List<SWTBotGefEditPart> children = editPart.children();
@@ -2077,12 +2097,13 @@ public class EditorProxy {
}
public void createInheritedEntity(SWTBotGefEditPart superclass,
- String subclassName, String superclassMappingLinkLabel,
+ JpaProject jpaProject, String superclassMappingLinkLabel,
boolean byMappedSuperclass, boolean existing) {
String superclassName = getJPTObjectForGefElement(superclass)
.getSimpleName();
+ String subclassName = getUniqueEntityName(jpaProject);
jpaDiagramEditor
.activateTool(JPAEditorMessages.CreateJPAEntityFromMappedSuperclassFeature_createInheritedEntityFeatureName);
jpaDiagramEditor.click(superclass);
@@ -2230,8 +2251,178 @@ public class EditorProxy {
assertTrue("There is no connection.", inverse.targetConnections()
.isEmpty());
}
+
+
+ /**
+ * Test all specific for the embedded connections properties and delete the
+ * embedded attribute and check that the connection is deleted as well.
+ *
+ * @param toolEntry
+ * - the name of the feature in the palette
+ * @param embeddingEntity
+ * @param embeddable
+ * @param refType
+ * @param embeddedMappingKey
+ * @param linkLabel
+ * @param elementsInDiagramCount1
+ */
+ public void _testEmbeddedConnection(String toolEntry,
+ SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
+ HasReferenceType refType, String embeddedMappingKey,
+ String linkLabel, int elementsInDiagramCount1) {
+ List<SWTBotGefEditPart> entitiesInDiagram = jpaDiagramEditor
+ .mainEditPart().children();
+ int elementsInDiagramCount = entitiesInDiagram.size();
+ assertEquals("Editor contains " + elementsInDiagramCount
+ + " pictogram elements.", elementsInDiagramCount1,
+ elementsInDiagramCount);
+
+ String attributeName = embedConnection(toolEntry, embeddingEntity,
+ embeddable, refType, embeddedMappingKey, linkLabel,
+ elementsInDiagramCount);
+
+ deleteAttributeInJPT(embeddingEntity, attributeName);
+
+ waitASecond();
+
+ entitiesInDiagram = jpaDiagramEditor.mainEditPart().children();
+ assertEquals("Connection must disappear.", elementsInDiagramCount,
+ entitiesInDiagram.size());
+ }
+
+ /**
+ * Test all specific for the embedded connections properties.
+ *
+ * @param toolEntry
+ * @param embeddingEntity
+ * @param embeddable
+ * @param refType
+ * @param embeddedMappingKey
+ * @param linkLabel
+ * @param elementsInDiagramCount
+ * @return the name of the embedded attribute
+ */
+ public String embedConnection(String toolEntry,
+ SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
+ HasReferenceType refType, String embeddedMappingKey,
+ String linkLabel, int elementsInDiagramCount) {
+
+ jpaDiagramEditor.activateTool(toolEntry);
+
+ jpaDiagramEditor.click(embeddingEntity);
+ jpaDiagramEditor.click(embeddable);
+
+ String attributeName = checkEmbeddedConnectionProperties(
+ embeddingEntity, embeddable, refType, embeddedMappingKey,
+ linkLabel);
+ return attributeName;
+ }
+
+ public String embedConnection(SWTBotGefEditor gefEditor, String toolEntry,
+ SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
+ HasReferenceType refType, String embeddedMappingKey,
+ String linkLabel, int elementsInDiagramCount) {
+
+ gefEditor.activateTool(toolEntry);
+
+ gefEditor.click(embeddingEntity);
+ gefEditor.click(embeddable);
+
+ String attributeName = checkEmbeddedConnectionProperties(
+ embeddingEntity, embeddable, refType, embeddedMappingKey,
+ linkLabel);
+ return attributeName;
+ }
+
+ public String checkEmbeddedConnectionProperties(
+ SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
+ HasReferenceType refType, String embeddedMappingKey,
+ String linkLabel) {
+
+ bot.waitUntil(new ConnectionIsShown(embeddingEntity), 30000);
+
+ assertFalse("The connection must appear", embeddingEntity
+ .sourceConnections().isEmpty());
+ SWTBotGefConnectionEditPart connection = embeddingEntity
+ .sourceConnections().get(0);
+
+ JavaPersistentType emb = getJPTObjectForGefElement(embeddable);
+ String embAttr = JPAEditorUtil.decapitalizeFirstLetter(emb.getSimpleName());
+
+ List<SWTBotGefEditPart> editParts = new ArrayList<SWTBotGefEditPart>();
+ editParts.add(embeddingEntity);
+ SWTBotGefEditPart attribute = jpaDiagramEditor.getEditpart(
+ embAttr, editParts);
+
+ assertNotNull("Embedded attribute must be added.", attribute);
+
+ HasReferanceRelation rel = getHasReferenceConnection(connection);
+ assertNotNull("Such a connection must exist.", rel);
+ assertEquals(refType, rel.getReferenceType());
+
+ String attributeName = testEmbeddedAttributeProperties(rel,
+ embeddedMappingKey);
+ assertNotNull(rel.getEmbeddedAnnotatedAttribute());
+
+ assertAttributeIsCorretlyMapped(attributeName, linkLabel);
+
+ JavaPersistentType parententity = (JavaPersistentType) rel
+ .getEmbeddedAnnotatedAttribute().getOwningPersistentType();
+ assertEquals("The entity must contain an embedded attribute.",
+ parententity, getJPTObjectForGefElement(embeddingEntity));
+ assertEquals(rel.getEmbeddingEntity(), getJPTObjectForGefElement(embeddingEntity));
+ assertEquals(rel.getEmbeddable(), getJPTObjectForGefElement(embeddable));
+ return attributeName;
+ }
public void setJpaDiagramEditor(SWTBotGefEditor jpaDiagramEditor) {
this.jpaDiagramEditor = jpaDiagramEditor;
}
+
+ public String getUniqueMappedSuperclassName(JpaProject jpaProject) {
+ IJPAEditorFeatureProvider fp = (IJPAEditorFeatureProvider) ((DiagramEditPart) jpaDiagramEditor
+ .mainEditPart().part()).getFeatureProvider();
+
+ String mappedSuperclassName = fp.getJPAEditorUtil().generateUniqueTypeName(jpaProject,
+ JPADiagramPropertyPage.getDefaultPackage(jpaProject.getProject()),
+ ".MpdSuprcls", fp); //$NON-NLS-1$
+
+ return JPAEditorUtil.returnSimpleName(mappedSuperclassName);
+ }
+
+ public String getUniqueEntityName(JpaProject jpaProject) {
+ IJPAEditorFeatureProvider fp = (IJPAEditorFeatureProvider) ((DiagramEditPart) jpaDiagramEditor
+ .mainEditPart().part()).getFeatureProvider();
+
+ String entityName = fp.getJPAEditorUtil().generateUniqueTypeName(jpaProject,
+ JPADiagramPropertyPage.getDefaultPackage(jpaProject.getProject()),
+ ".Entity", fp); //$NON-NLS-1$
+
+ return JPAEditorUtil.returnSimpleName(entityName);
+ }
+
+ public String getUniqueEmbeddableName(JpaProject jpaProject) {
+ IJPAEditorFeatureProvider fp = (IJPAEditorFeatureProvider) ((DiagramEditPart) jpaDiagramEditor
+ .mainEditPart().part()).getFeatureProvider();
+
+ String embeddableName = fp.getJPAEditorUtil().generateUniqueTypeName(jpaProject,
+ JPADiagramPropertyPage.getDefaultPackage(jpaProject.getProject()),
+ ".Embeddable", fp); //$NON-NLS-1$
+
+ return JPAEditorUtil.returnSimpleName(embeddableName);
+ }
+
+ public void deleteResources(JpaProject jpaProject) throws CoreException{
+ deleteDiagramElements();
+ Utils.printFormatted(">>>>>>>>>>>> elements are deleted from the diagram.");
+
+ ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().getRoot().getPersistenceUnits().iterator();
+ PersistenceUnit pu = lit.next();
+ Iterator<PersistentType> persistentTypesIterator = (Iterator<PersistentType>) pu.getPersistentTypes().iterator();
+ while(persistentTypesIterator.hasNext()){
+ Utils.printFormatted(">>>>>>>>>>>>>> persistent type resource must be deleted.");
+ PersistentType type = persistentTypesIterator.next();
+ type.getResource().delete(true, new NullProgressMonitor());
+ }
+ }
}
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EmbeddableInDiagramSWTBotTest.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EmbeddableInDiagramSWTBotTest.java
index a80baea140..c6d25e6f8a 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EmbeddableInDiagramSWTBotTest.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EmbeddableInDiagramSWTBotTest.java
@@ -1,36 +1,24 @@
package org.eclipse.jpt.jpadiagrameditor.swtbot.tests.ui.editor;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.ui.internal.parts.DiagramEditPart;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
import org.eclipse.jpt.jpa.ui.internal.jpa2.details.JptUiDetailsMessages2_0;
import org.eclipse.jpt.jpadiagrameditor.swtbot.tests.internal.JPACreateFactory;
import org.eclipse.jpt.jpadiagrameditor.swtbot.tests.internal.Utils;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
-import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.HasReferanceRelation;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.HasReferanceRelation.HasReferenceType;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation;
-import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.gef.finder.SWTBotGefTestCase;
import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
-import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefConnectionEditPart;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
@@ -79,10 +67,12 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
jpaProject = factory.createJPA20Project(TEST_PROJECT);
assertNotNull(jpaProject);
+ workbenchBot.closeAllEditors();
+
jpaDiagramEditor = editorProxy
.openDiagramOnJPAProjectNode(TEST_PROJECT, true);
editorProxy.setJpaDiagramEditor(jpaDiagramEditor);
-
+
Thread.sleep(2000);
}
@@ -96,7 +86,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
- editorProxy.addEmbeddableToDiagram(50, 50, "Embeddable1");
+ editorProxy.addEmbeddableToDiagram(50, 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
jpaDiagramEditor.save();
@@ -119,7 +109,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.deleteJPTViaButton(embeddable);
@@ -141,7 +131,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.deleteJPTViaMenu(embeddable);
@@ -163,7 +153,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
assertFalse(
@@ -189,7 +179,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEmbeddableToDiagram(50, 50, "Embeddable1");
+ SWTBotGefEditPart entity = editorProxy.addEmbeddableToDiagram(50, 50, jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
@@ -220,11 +210,11 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable1 = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddable2 = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable2");
+ 200, jpaProject);
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(200, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(200, 50, jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
@@ -239,7 +229,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.testNoEmbeddedConnectionIsCreated(
JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, 0, embeddable2, embeddable1, false);
- _testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
+ editorProxy._testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
embeddable2, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -261,7 +251,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.removeAttributeViaButton(embeddable, "attribute1");
@@ -283,7 +273,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.removeAttributeViaMenu(embeddable, "attribute1");
@@ -305,7 +295,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.directEditAttribute(embeddable, "attribute1");
@@ -329,7 +319,8 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
+ String oldEmbeddableName = editorProxy.getJPTObjectForGefElement(embeddable).getSimpleName();
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
@@ -339,7 +330,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.moveMouse(0, 0);
SWTBotGefEditPart oldEmbeddable = jpaDiagramEditor
- .getEditPart("Embeddable1");
+ .getEditPart(oldEmbeddableName);
SWTBotGefEditPart newEmbeddable = jpaDiagramEditor
.getEditPart("NewEntityName");
assertNotNull("The entity must be renamed!", newEmbeddable);
@@ -365,7 +356,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
@@ -393,7 +384,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
assertFalse(
@@ -474,7 +465,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
+ String oldEmbeddableName = editorProxy.getJPTObjectForGefElement(embeddable).getSimpleName();
+
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
embeddable.click();
@@ -500,8 +493,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
embeddable = jpaDiagramEditor.getEditPart("NewEntityName");
assertNotNull("Entity name must be changed!", embeddable);
+
assertNull("Entity naem must be changed!",
- jpaDiagramEditor.getEditPart("Embeddable1"));
+ jpaDiagramEditor.getEditPart(oldEmbeddableName));
embeddable.click();
editorProxy.deleteDiagramElements();
@@ -522,7 +516,8 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
+ String embeddableName = editorProxy.getJPTObjectForGefElement(embeddable).getSimpleName();
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
JpaArtifactFactory factory = JpaArtifactFactory.instance();
@@ -542,7 +537,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.getOkButton(moveEntityDialog).click();
editorProxy.waitASecond();
- embeddable = jpaDiagramEditor.getEditPart("Embeddable1");
+ embeddable = jpaDiagramEditor.getEditPart(embeddableName);
String newEntityPackage = factory
.getMappedSuperclassPackageDeclaration(editorProxy
.getJPTObjectForGefElement(embeddable));
@@ -567,7 +562,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.addAttributeToJPT(embeddable, "attribute1");
@@ -590,7 +585,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.addAttributeToJPT(embeddable, "attribute1");
@@ -616,7 +611,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.discardChanges(embeddable, "attribute1");
@@ -642,7 +637,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.removeAndDiscardChangesViaMenu(embeddable, "attribute1");
@@ -668,7 +663,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.removeAndSaveChangesViaMenu(embeddable, "attribute1");
@@ -692,7 +687,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.saveOnlyJPT(embeddable, "attribute1");
@@ -715,12 +710,12 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable1");
+ 200, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
- _testEmbeddedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, entity, embeddable,
+ editorProxy._testEmbeddedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, entity, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 2);
@@ -744,12 +739,12 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable1");
+ 200, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
- _testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, entity,
+ editorProxy._testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, entity,
embeddable, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -773,12 +768,12 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable1 = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddable2 = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable2");
+ 200, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
- _testEmbeddedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddable1,
+ editorProxy._testEmbeddedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddable1,
embeddable2, HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 2);
@@ -802,12 +797,12 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable1 = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddable2 = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable2");
+ 200, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
- _testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
+ editorProxy._testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
embeddable2, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -833,25 +828,25 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable1 = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddable2 = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable2");
+ 200, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
embeddable2, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
2);
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(200, 50,
- "Entity1");
+ jpaProject);
editorProxy.testNoEmbeddedConnectionIsCreated(
JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, 0, entity, embeddable1, true);
- _testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, entity,
+ editorProxy._testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, entity,
embeddable2, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -879,25 +874,25 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart embeddable1 = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddable2 = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable2");
+ 200, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable1,
embeddable2, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
2);
SWTBotGefEditPart embeddable3 = editorProxy.addEmbeddableToDiagram(200, 50,
- "Embeddable3");
+ jpaProject);
editorProxy.testNoEmbeddedConnectionIsCreated(
JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, 0, embeddable3, embeddable1, true);
- _testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable3,
+ editorProxy._testEmbeddedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddable3,
embeddable2, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -922,9 +917,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -948,9 +943,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -974,9 +969,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1000,9 +995,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1026,9 +1021,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1052,9 +1047,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1078,9 +1073,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1109,9 +1104,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1119,9 +1114,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
1, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1172,9 +1167,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1182,9 +1177,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
1, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1239,9 +1234,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1249,9 +1244,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
1, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1301,9 +1296,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1311,9 +1306,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
0, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1355,9 +1350,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1365,9 +1360,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
0, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1409,9 +1404,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1419,9 +1414,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
0, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1463,9 +1458,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1473,9 +1468,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
1, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
embeddable, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -1527,9 +1522,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1537,9 +1532,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
1, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
embeddable, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -1589,22 +1584,22 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddingEntity1 = editorProxy.addEntityToDiagram(
- 200, 50, "Entity2");
+ 200, 50, jpaProject);
SWTBotGefEditPart embeddingEntity2 = editorProxy.addEntityToDiagram(
- 200, 200, "Entity3");
+ 200, 200, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity1, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity1, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity2, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity2, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1647,22 +1642,22 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddingEntity1 = editorProxy.addEntityToDiagram(
- 200, 50, "Entity2");
+ 200, 50, jpaProject);
SWTBotGefEditPart embeddingEntity2 = editorProxy.addEntityToDiagram(
- 200, 200, "Entity3");
+ 200, 200, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity1, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity1, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity2, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity2, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1705,22 +1700,22 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddingEntity1 = editorProxy.addEntityToDiagram(
- 200, 50, "Entity2");
+ 200, 50, jpaProject);
SWTBotGefEditPart embeddingEntity2 = editorProxy.addEntityToDiagram(
- 200, 200, "Entity3");
+ 200, 200, jpaProject);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity1, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity1, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
- embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity2, embeddable,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, embeddingEntity2, embeddable,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 3);
@@ -1767,9 +1762,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1777,9 +1772,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
0, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
embeddable, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -1822,9 +1817,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1832,9 +1827,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
1, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
embeddable, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -1874,9 +1869,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1889,9 +1884,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
1, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
embeddable, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -1924,9 +1919,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart embeddable = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1934,9 +1929,9 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
0, embeddable, entity);
SWTBotGefEditPart embeddingEntity = editorProxy.addEntityToDiagram(200,
- 50, "Entity2");
+ 50, jpaProject);
- embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
+ editorProxy.embedConnection(JPAEditorMessages.EmbedCollectionOfObjectsFeature_ElementCollectionFeatureName, embeddingEntity,
embeddable, HasReferenceType.COLLECTION,
MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages2_0.ElementCollectionMapping2_0_linkLabel,
@@ -1969,12 +1964,12 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.setJpaDiagramEditor(jpaDiagramEditor10);
SWTBotGefEditPart embeddable1 = editorProxy.addEmbeddableToDiagram(50,
- 50, "Embeddable1");
+ 50, jpaProject);
SWTBotGefEditPart embeddable2 = editorProxy.addEmbeddableToDiagram(50,
- 200, "Embeddable2");
+ 200, jpaProject);
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(300, 50,
- "Entity1");
+ jpaProject);
boolean notAllowed = false;
@@ -1990,13 +1985,13 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.testNoEmbeddedConnectionIsCreated(JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, 0, embeddable1, embeddable2, false);
- embedConnection(jpaDiagramEditor10, JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, entity, embeddable1,
+ editorProxy.embedConnection(jpaDiagramEditor10, JPAEditorMessages.EmbedSingleObjectFeature_EmbeddedFeatureName, entity, embeddable1,
HasReferenceType.SINGLE,
MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
JptUiDetailsMessages.EmbeddedMappingUiProvider_linkLabel, 2);
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(300, 300,
- "Entity2");
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
@@ -2041,151 +2036,10 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase {
Utils.sayTestFinished("testJPA10WithEmbeddables");
}
-
- /**
- * Test all specific for the embedded connections properties and delete the
- * embedded attribute and check that the connection is deleted as well.
- *
- * @param toolEntry
- * - the name of the feature in the palette
- * @param embeddingEntity
- * @param embeddable
- * @param refType
- * @param embeddedMappingKey
- * @param linkLabel
- * @param elementsInDiagramCount1
- */
- private void _testEmbeddedConnection(String toolEntry,
- SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
- HasReferenceType refType, String embeddedMappingKey,
- String linkLabel, int elementsInDiagramCount1) {
- List<SWTBotGefEditPart> entitiesInDiagram = jpaDiagramEditor
- .mainEditPart().children();
- int elementsInDiagramCount = entitiesInDiagram.size();
- assertEquals("Editor contains " + elementsInDiagramCount
- + " pictogram elements.", elementsInDiagramCount1,
- elementsInDiagramCount);
-
- String attributeName = embedConnection(toolEntry, embeddingEntity,
- embeddable, refType, embeddedMappingKey, linkLabel,
- elementsInDiagramCount);
-
- editorProxy.deleteAttributeInJPT(embeddingEntity, attributeName);
-
- editorProxy.waitASecond();
-
- entitiesInDiagram = jpaDiagramEditor.mainEditPart().children();
- assertEquals("Connection must disappear.", elementsInDiagramCount,
- entitiesInDiagram.size());
- }
-
- /**
- * Test all specific for the embedded connections properties.
- *
- * @param toolEntry
- * @param embeddingEntity
- * @param embeddable
- * @param refType
- * @param embeddedMappingKey
- * @param linkLabel
- * @param elementsInDiagramCount
- * @return the name of the embedded attribute
- */
- private String embedConnection(String toolEntry,
- SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
- HasReferenceType refType, String embeddedMappingKey,
- String linkLabel, int elementsInDiagramCount) {
-
- jpaDiagramEditor.activateTool(toolEntry);
-
- jpaDiagramEditor.click(embeddingEntity);
- jpaDiagramEditor.click(embeddable);
-
- String attributeName = checkEmbeddedConnectionProperties(
- embeddingEntity, embeddable, refType, embeddedMappingKey,
- linkLabel);
- return attributeName;
- }
-
- private String embedConnection(SWTBotGefEditor gefEditor, String toolEntry,
- SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
- HasReferenceType refType, String embeddedMappingKey,
- String linkLabel, int elementsInDiagramCount) {
-
- gefEditor.activateTool(toolEntry);
-
- gefEditor.click(embeddingEntity);
- gefEditor.click(embeddable);
-
- String attributeName = checkEmbeddedConnectionProperties(
- embeddingEntity, embeddable, refType, embeddedMappingKey,
- linkLabel);
- return attributeName;
- }
-
- private String checkEmbeddedConnectionProperties(
- SWTBotGefEditPart embeddingEntity, SWTBotGefEditPart embeddable,
- HasReferenceType refType, String embeddedMappingKey,
- String linkLabel) {
-
- bot.waitUntil(new ConnectionIsShown(embeddingEntity), 30000);
-
-// List<SWTBotGefEditPart> entitiesInDiagram = jpaDiagramEditor
-// .mainEditPart().children();
-// assertEquals("Connection must appear.", entitiesInDiagram.size(),
-// elementsInDiagramCount + 1);
-
- assertFalse("The connection must appear", embeddingEntity
- .sourceConnections().isEmpty());
- SWTBotGefConnectionEditPart connection = embeddingEntity
- .sourceConnections().get(0);
-
- JavaPersistentType emb = editorProxy.getJPTObjectForGefElement(embeddable);
- String embAttr = JPAEditorUtil.decapitalizeFirstLetter(emb.getSimpleName());
-
- List<SWTBotGefEditPart> editParts = new ArrayList<SWTBotGefEditPart>();
- editParts.add(embeddingEntity);
- SWTBotGefEditPart attribute = jpaDiagramEditor.getEditpart(
- embAttr, editParts);
-
- assertNotNull("Embedded attribute must be added.", attribute);
-
- HasReferanceRelation rel = editorProxy
- .getHasReferenceConnection(connection);
- assertNotNull(rel);
- assertEquals(refType, rel.getReferenceType());
-
- String attributeName = editorProxy.testEmbeddedAttributeProperties(rel,
- embeddedMappingKey);
- assertNotNull(rel.getEmbeddedAnnotatedAttribute());
-
- editorProxy.assertAttributeIsCorretlyMapped(attributeName, linkLabel);
-
- JavaPersistentType parententity = (JavaPersistentType) rel
- .getEmbeddedAnnotatedAttribute().getOwningPersistentType();
- assertEquals("The entity must contain an embedded attribute.",
- parententity,
- editorProxy.getJPTObjectForGefElement(embeddingEntity));
- assertEquals(rel.getEmbeddingEntity(),
- editorProxy.getJPTObjectForGefElement(embeddingEntity));
- assertEquals(rel.getEmbeddable(),
- editorProxy.getJPTObjectForGefElement(embeddable));
- return attributeName;
- }
@After
public void tearDown() throws Exception {
- editorProxy.deleteDiagramElements();
- Utils.printFormatted(">>>>>>>>>>>> elements are deleted from the diagram.");
-
- ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().getRoot().getPersistenceUnits().iterator();
- PersistenceUnit pu = lit.next();
- Iterator<PersistentType> persistentTypesIterator = (Iterator<PersistentType>) pu.getPersistentTypes().iterator();
- while(persistentTypesIterator.hasNext()){
- Utils.printFormatted(">>>>>>>>>>>>>> persistent type resource must be deleted.");
- PersistentType type = persistentTypesIterator.next();
- type.getResource().delete(true, new NullProgressMonitor());
- }
+ editorProxy.deleteResources(jpaProject);
}
}
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EntitiesInDiagramSWTBotTest.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EntitiesInDiagramSWTBotTest.java
index cc98f33e05..5ecabead0a 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EntitiesInDiagramSWTBotTest.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/EntitiesInDiagramSWTBotTest.java
@@ -1,17 +1,12 @@
package org.eclipse.jpt.jpadiagrameditor.swtbot.tests.ui.editor;
-import java.util.Iterator;
import java.util.List;
-import java.util.ListIterator;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.graphiti.ui.internal.parts.DiagramEditPart;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
import org.eclipse.jpt.jpadiagrameditor.swtbot.tests.internal.JPACreateFactory;
import org.eclipse.jpt.jpadiagrameditor.swtbot.tests.internal.Utils;
@@ -71,6 +66,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
factory = JPACreateFactory.instance();
jpaProject = factory.createJPA20Project(TEST_PROJECT);
assertNotNull(jpaProject);
+
+ workbenchBot.closeAllEditors();
jpaDiagramEditor = editorProxy.openDiagramOnJPAProjectNode(
TEST_PROJECT, true);
@@ -91,7 +88,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
- editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ editorProxy.addEntityToDiagram(50, 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
jpaDiagramEditor.save();
@@ -115,7 +112,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.deleteJPTViaButton(entity);
@@ -137,7 +134,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.deleteJPTViaMenu(entity);
@@ -159,7 +156,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
@@ -186,7 +183,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
@@ -216,7 +213,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.removeAttributeViaButton(entity, "attribute1");
@@ -238,7 +235,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.removeAttributeViaMenu(entity, "attribute1");
@@ -260,7 +257,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.directEditAttribute(entity, "attribute1");
@@ -284,7 +281,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
+
+ String oldEntityName = editorProxy.getJPTObjectForGefElement(entity).getSimpleName();
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
@@ -293,7 +292,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
jpaDiagramEditor.directEditType("NewEntityName");
editorProxy.moveMouse(0, 0);
- SWTBotGefEditPart oldEntity = jpaDiagramEditor.getEditPart("Entity1");
+ SWTBotGefEditPart oldEntity = jpaDiagramEditor.getEditPart(oldEntityName);
SWTBotGefEditPart newEntity = jpaDiagramEditor
.getEditPart("NewEntityName");
assertNotNull("The entity must be renamed!", newEntity);
@@ -320,7 +319,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
jpaDiagramEditor.doubleClick(entity);
@@ -348,7 +347,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
@@ -429,7 +428,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
+ String oldEntityName = editorProxy.getJPTObjectForGefElement(entity).getSimpleName();
entity.click();
jpaDiagramEditor
@@ -455,7 +455,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
entity = jpaDiagramEditor.getEditPart("NewEntityName");
assertNotNull("Entity name must be changed!", entity);
assertNull("Entity naem must be changed!",
- jpaDiagramEditor.getEditPart("Entity1"));
+ jpaDiagramEditor.getEditPart(oldEntityName));
entity.click();
editorProxy.deleteDiagramElements();
@@ -477,7 +477,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
+ String entityName = editorProxy.getJPTObjectForGefElement(entity).getSimpleName();
JpaArtifactFactory factory = JpaArtifactFactory.instance();
String packageName = factory
@@ -495,7 +496,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.getOkButton(moveEntityDialog).click();
editorProxy.waitASecond();
- entity = jpaDiagramEditor.getEditPart("Entity1");
+ entity = jpaDiagramEditor.getEditPart(entityName);
String newEntityPackage = factory
.getMappedSuperclassPackageDeclaration(editorProxy
.getJPTObjectForGefElement(entity));
@@ -521,7 +522,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.collapseExpandJPTViaButton(entity);
@@ -542,7 +543,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.collapseExpandJPTViaMenu(entity);
@@ -563,9 +564,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(300, 50,
- "Entity2");
+ jpaProject);
editorProxy.collapseExpandAllJPTsViaMenu(entity1, entity2);
@@ -588,7 +589,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.discardChanges(entity, "attribute1");
@@ -613,7 +614,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.removeAndDiscardChangesViaMenu(entity, "attribute1");
@@ -639,7 +640,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.removeAndSaveChangesViaMenu(entity, "attribute1");
@@ -663,7 +664,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
editorProxy.saveOnlyJPT(entity, "attribute1");
editorProxy.deleteDiagramElements();
@@ -719,7 +720,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
- editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ editorProxy.addEntityToDiagram(50, 50, jpaProject);
editorProxy.moveMouse(100, 100);
SWTBotGefEditPart primaryKeySection = jpaDiagramEditor
@@ -767,7 +768,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// editorProxy.moveMouse(jpaDiagramEditor, 100, 100);
SWTBotGefEditPart primaryKeySection = editorProxy.getSectionInJPT(
@@ -828,7 +829,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
workbenchBot.viewByTitle("JPA Details").close();
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
+ String entityName = editorProxy.getJPTObjectForGefElement(entity).getSimpleName();
jpaDiagramEditor.save();
jpaDiagramEditor
@@ -843,10 +845,10 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
entity.click();
SWTBot jpaDetailsBot = jpaDetailsView.bot();
SWTBotStyledText styledText = jpaDetailsBot.styledText();
- assertEquals("Type 'Entity1' is mapped as entity.",
+ assertEquals("Type '" +entityName+ "' is mapped as entity.",
styledText.getText());
assertNotNull("Entity must be shown in the diagram!",
- jpaDiagramEditor.getEditPart("Entity1"));
+ jpaDiagramEditor.getEditPart(entityName));
// assert that the entity's sections are enabled
assertTrue(jpaDetailsBot.label("Entity").isEnabled());
assertTrue(jpaDetailsBot.label("Queries").isEnabled());
@@ -861,10 +863,10 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.clickOnStyledText(styledText, 30);
editorProxy.changeMappingtype("Mapped Superclass");
styledText = jpaDetailsBot.styledText();
- assertEquals("Type 'Entity1' is mapped as mapped superclass.",
+ assertEquals("Type '" + entityName + "' is mapped as mapped superclass.",
styledText.getText());
assertNotNull("Entity must be shown in the diagram!",
- jpaDiagramEditor.getEditPart("Entity1"));
+ jpaDiagramEditor.getEditPart(entityName));
// assert that the mapped superclass'es sections are enabled
assertTrue(jpaDetailsBot.label("Mapped Superclass").isEnabled());
assertTrue(jpaDetailsBot.label("Queries").isEnabled());
@@ -875,10 +877,10 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.clickOnStyledText(styledText, 30);
editorProxy.changeMappingtype("Embeddable");
styledText = jpaDetailsBot.styledText();
- assertEquals("Type 'Entity1' is mapped as embeddable.",
+ assertEquals("Type '" + entityName + "' is mapped as embeddable.",
styledText.getText());
assertNotNull("Entity must disappear from the diagram!",
- jpaDiagramEditor.getEditPart("Entity1"));
+ jpaDiagramEditor.getEditPart(entityName));
// assert that the embeddable's section is enabled
// assertTrue(jpaDetailsBot.label("Embeddable").isEnabled());
@@ -886,13 +888,13 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.clickOnStyledText(styledText, 30);
editorProxy.changeMappingtype("Entity");
assertNotNull("Entity must disappear from the diagram!",
- jpaDiagramEditor.getEditPart("Entity1"));
+ jpaDiagramEditor.getEditPart(entityName));
jpaDiagramEditor.click(0, 0);
- jpaDiagramEditor.select("Entity1");
+ jpaDiagramEditor.select(entityName);
styledText = jpaDetailsBot.styledText();
- assertEquals("Type 'Entity1' is mapped as entity.",
+ assertEquals("Type '" + entityName + "' is mapped as entity.",
styledText.getText());
// assert that the entity's sections are enabled
assertTrue(jpaDetailsBot.label("Entity").isEnabled());
@@ -932,7 +934,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
workbenchBot.viewByTitle("JPA Details").close();
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
jpaDiagramEditor.save();
jpaDiagramEditor
@@ -1081,9 +1083,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
- "Entity2");
+ jpaProject);
// create One-to-One unidirectional relation from entity1 to entity2
editorProxy
@@ -1123,7 +1125,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// create One-to-One unidirectional self relation from entity1 to
// entity1
@@ -1157,9 +1159,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
- "Entity2");
+ jpaProject);
// create One-to-One bidirectional relation from entity1 to entity2
editorProxy
@@ -1208,7 +1210,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// create One-to-One bidirectional self relation from entity1 to entity1
editorProxy
@@ -1240,9 +1242,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
- "Entity2");
+ jpaProject);
// create One-to-Many unidirectional relation from entity1 to entity2
editorProxy
@@ -1282,7 +1284,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// create One-to-Many unidirectional self relation from entity1 to
// entity1
@@ -1316,9 +1318,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
- "Entity2");
+ jpaProject);
// create Many-to-One unidirectional relation from entity1 to entity2
editorProxy
@@ -1358,7 +1360,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// create Many-to-One unidirectional self relation from entity1 to
// entity1
@@ -1392,9 +1394,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
- "Entity2");
+ jpaProject);
// create Many-to-One bidirectional relation from entity1 to entity2
editorProxy
@@ -1446,7 +1448,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// create Many-to-Many bidirectional self relation from entity1 to
// entity1
@@ -1479,9 +1481,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
- "Entity2");
+ jpaProject);
// create Many-to-Many unidirectional relation from entity1 to entity2
editorProxy
@@ -1521,7 +1523,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// create Many-to-Many unidirectional self relation from entity1 to
// entity1
@@ -1555,9 +1557,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
- "Entity2");
+ jpaProject);
// create Many-to-Many bidirectional relation from entity1 to entity2
editorProxy
@@ -1606,7 +1608,7 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
// create Many-to-Many bidirectional self relation from entity1 to
// entity1
@@ -1636,9 +1638,9 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
- editorProxy.createInheritedEntity(entity1, "Entity2",
+ editorProxy.createInheritedEntity(entity1, jpaProject,
JptUiDetailsMessages.EntityUiProvider_linkLabel, false, false);
editorProxy.deleteDiagramElements();
@@ -1661,12 +1663,12 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart superclass = editorProxy.addEntityToDiagram(50, 50,
- "Entity1");
+ jpaProject);
String superclassName = editorProxy.getJPTObjectForGefElement(
superclass).getSimpleName();
SWTBotGefEditPart subclass = editorProxy.addEntityToDiagram(50, 300,
- "Entity2");
+ jpaProject);
String subclassName = editorProxy.getJPTObjectForGefElement(subclass)
.getSimpleName();
@@ -1730,18 +1732,6 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase {
@After
public void tearDown() throws Exception {
- editorProxy.deleteDiagramElements();
- Utils.printFormatted(">>>>>>>>>>>> elements are deleted from the diagram.");
-
- ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode()
- .getPersistenceXml().getRoot().getPersistenceUnits().iterator();
- PersistenceUnit pu = lit.next();
- Iterator<PersistentType> persistentTypesIterator = (Iterator<PersistentType>) pu
- .getPersistentTypes().iterator();
- while (persistentTypesIterator.hasNext()) {
- Utils.printFormatted(">>>>>>>>>>>>>> persistent type resource must be deleted.");
- PersistentType type = persistentTypesIterator.next();
- type.getResource().delete(true, new NullProgressMonitor());
- }
+ editorProxy.deleteResources(jpaProject);
}
}
diff --git a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/MappedSuperclassesInDiagramSWTBotTest.java b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/MappedSuperclassesInDiagramSWTBotTest.java
index 189f62a385..739f0a4bba 100644
--- a/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/MappedSuperclassesInDiagramSWTBotTest.java
+++ b/jpa_diagram_editor/tests/org.eclipse.jpt.jpadiagrameditor.swtbot.tests/src/org/eclipse/jpt/jpadiagrameditor/swtbot/tests/ui/editor/MappedSuperclassesInDiagramSWTBotTest.java
@@ -1,19 +1,10 @@
package org.eclipse.jpt.jpadiagrameditor.swtbot.tests.ui.editor;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Iterator;
-import java.util.ListIterator;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.ui.internal.parts.DiagramEditPart;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.ui.internal.details.JptUiDetailsMessages;
-import org.eclipse.jpt.jpa.ui.selection.JpaEditorManager;
import org.eclipse.jpt.jpadiagrameditor.swtbot.tests.internal.JPACreateFactory;
import org.eclipse.jpt.jpadiagrameditor.swtbot.tests.internal.Utils;
import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
@@ -68,6 +59,8 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
factory = JPACreateFactory.instance();
jpaProject = factory.createJPA20Project(TEST_PROJECT);
assertNotNull(jpaProject);
+
+ workbenchBot.closeAllEditors();
jpaDiagramEditor = editorProxy.openDiagramOnJPAProjectNode(
TEST_PROJECT, true);
@@ -87,8 +80,8 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
-
- editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+
+ editorProxy.addMappedSuperclassToDiagram(50, 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
jpaDiagramEditor.save();
@@ -112,7 +105,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.deleteJPTViaButton(mappedSuperclass);
@@ -132,9 +125,9 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
-
+
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.deleteJPTViaMenu(mappedSuperclass);
@@ -156,7 +149,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
@@ -182,20 +175,20 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
editorProxy
.isSectionVisible(
JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
- entity));
+ mappedSuperclass));
- editorProxy.addElementCollectionAttributeToJPT(entity, "attribute1");
+ editorProxy.addElementCollectionAttributeToJPT(mappedSuperclass, "attribute1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
- entity.click();
+ mappedSuperclass.click();
editorProxy.deleteDiagramElements();
jpaDiagramEditor.save();
@@ -213,7 +206,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.removeAttributeViaButton(mappedSuperclass, "attribute1");
@@ -235,7 +228,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.removeAttributeViaMenu(mappedSuperclass, "attribute1");
@@ -257,7 +250,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.directEditAttribute(mappedSuperclass, "attribute1");
@@ -281,7 +274,8 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+ String oldMpdSuprclsName = editorProxy.getJPTObjectForGefElement(mappedSuperclass).getSimpleName();
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
@@ -291,7 +285,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.moveMouse(0, 0);
SWTBotGefEditPart oldMappedSuperclass = jpaDiagramEditor
- .getEditPart("MpdSuprcls1");
+ .getEditPart(oldMpdSuprclsName);
SWTBotGefEditPart newMappedSuperclass = jpaDiagramEditor
.getEditPart("NewEntityName");
assertNotNull("The entity must be renamed!", newMappedSuperclass);
@@ -318,7 +312,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
jpaDiagramEditor.doubleClick(mappedSuperclass);
@@ -346,7 +340,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
assertFalse(
"\"Other Attributes\" section must not be visible!",
@@ -427,7 +421,8 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+ String oldMappedSuperclassName = editorProxy.getJPTObjectForGefElement(mappedSuperclass).getSimpleName();
mappedSuperclass.click();
jpaDiagramEditor
@@ -452,8 +447,9 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
mappedSuperclass = jpaDiagramEditor.getEditPart("NewEntityName");
assertNotNull("Entity name must be changed!", mappedSuperclass);
+
assertNull("Entity naem must be changed!",
- jpaDiagramEditor.getEditPart("MpdSuprcls1"));
+ jpaDiagramEditor.getEditPart(oldMappedSuperclassName));
mappedSuperclass.click();
editorProxy.deleteDiagramElements();
@@ -475,9 +471,10 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- JpaArtifactFactory factory = JpaArtifactFactory.instance();
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+ String mappedSuperclassName = editorProxy.getJPTObjectForGefElement(mappedSuperclass).getSimpleName();
+ JpaArtifactFactory factory = JpaArtifactFactory.instance();
String packageName = factory
.getMappedSuperclassPackageDeclaration(editorProxy
.getJPTObjectForGefElement(mappedSuperclass));
@@ -493,7 +490,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
editorProxy.getOkButton(moveEntityDialog).click();
editorProxy.waitASecond();
- mappedSuperclass = jpaDiagramEditor.getEditPart("MpdSuprcls1");
+ mappedSuperclass = jpaDiagramEditor.getEditPart(mappedSuperclassName);
String newEntityPackage = factory
.getMappedSuperclassPackageDeclaration(editorProxy
.getJPTObjectForGefElement(mappedSuperclass));
@@ -519,7 +516,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.addAttributeToJPT(mappedSuperclass, "attribute1");
@@ -542,7 +539,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.addAttributeToJPT(mappedSuperclass, "attribute1");
@@ -567,7 +564,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(200, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.discardChanges(mappedSuperclass, "attribute1");
@@ -593,7 +590,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.removeAndDiscardChangesViaMenu(mappedSuperclass,
"attribute1");
@@ -621,7 +618,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.removeAndSaveChangesViaMenu(mappedSuperclass, "attribute1");
@@ -646,7 +643,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
editorProxy.saveOnlyJPT(mappedSuperclass, "attribute1");
editorProxy.deleteDiagramElements();
@@ -667,9 +664,9 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
-
- editorProxy.createInheritedEntity(mappedSuperclass, "Entity1",
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
+ editorProxy.createInheritedEntity(mappedSuperclass, jpaProject,
JptUiDetailsMessages.MappedSuperclassUiProvider_linkLabel,
true, false);
@@ -694,12 +691,12 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart superclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
String superclassName = editorProxy.getJPTObjectForGefElement(
superclass).getSimpleName();
SWTBotGefEditPart subclass = editorProxy.addEntityToDiagram(50, 300,
- "Entity1");
+ jpaProject);
String subclassName = editorProxy.getJPTObjectForGefElement(subclass)
.getSimpleName();
@@ -739,12 +736,12 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart superclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
String superclassName = editorProxy.getJPTObjectForGefElement(
superclass).getSimpleName();
SWTBotGefEditPart subclass = editorProxy.addEntityToDiagram(50, 300,
- "Entity1");
+ jpaProject);
String subclassName = editorProxy.getJPTObjectForGefElement(subclass)
.getSimpleName();
@@ -760,7 +757,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
true, superclassName, subclass, false);
SWTBotGefEditPart secondSuperclass = editorProxy.addEntityToDiagram(
- 300, 50, "Entity2");
+ 300, 50, jpaProject);
jpaDiagramEditor
.activateTool(JPAEditorMessages.CreateIsARelationFeature_CreateIsARelationFeatureName);
@@ -793,9 +790,10 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
// create One-to-One unidirectional relation from the mapped superclass
// to entity
@@ -827,9 +825,10 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
// create One-to-many unidirectional relation from the mapped superclass
// to entity1
@@ -861,9 +860,10 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
// create Many-to-One unidirectional relation from the mapped superclass
// to entity1
@@ -895,9 +895,10 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
.mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
+ jpaProject);
// create Many-to-Many unidirectional relation from the mapped
// superclass
@@ -929,10 +930,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -961,10 +963,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -988,10 +991,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1014,11 +1018,12 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
+
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1046,11 +1051,12 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
+
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1074,10 +1080,10 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1105,11 +1111,12 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
assertTrue("The diagram must be empty.", jpaDiagramEditor
.mainEditPart().children().isEmpty());
+
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, jpaProject);
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
- "Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy
- .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ jpaProject);
editorProxy
.testNoConnectionIsCreated(
@@ -1124,19 +1131,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
@After
public void tearDown() throws Exception {
- editorProxy.deleteDiagramElements();
- Utils.printFormatted(">>>>>>>>>>>> elements are deleted from the diagram.");
-
- ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode()
- .getPersistenceXml().getRoot().getPersistenceUnits().iterator();
- PersistenceUnit pu = lit.next();
- Iterator<PersistentType> persistentTypesIterator = (Iterator<PersistentType>) pu
- .getPersistentTypes().iterator();
- while (persistentTypesIterator.hasNext()) {
- Utils.printFormatted(">>>>>>>>>>>>>> persistent type resource must be deleted.");
-
- PersistentType type = persistentTypesIterator.next();
- type.getResource().delete(true, new NullProgressMonitor());
- }
+ editorProxy.deleteResources(jpaProject);
}
+
}

Back to the top