diff options
19 files changed, 1304 insertions, 514 deletions
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/icons/ent/derive_jpt.gif b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/icons/ent/derive_jpt.gif Binary files differnew file mode 100644 index 0000000000..1a7574caff --- /dev/null +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/icons/ent/derive_jpt.gif diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/command/AddAttributeCommand.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/command/AddAttributeCommand.java index 1a693d8b8e..a7d6b5297e 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/command/AddAttributeCommand.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/command/AddAttributeCommand.java @@ -100,7 +100,7 @@ public class AddAttributeCommand implements Command { JPAEditorUtil.createImports(cu, attrTypes);
}
- String contents = "";
+ String contents = ""; //$NON-NLS-1$
if (annotations != null) {
Iterator<String> it = annotations.iterator();
while (it.hasNext()) {
@@ -181,7 +181,7 @@ public class AddAttributeCommand implements Command { ((attrTypes == null) ? "" : ("<" + JPAEditorUtil.createCommaSeparatedListOfSimpleTypeNames(attrTypes) + ">")) + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
" " + JPAEditorUtil.decapitalizeFirstLetter(actName) + ";"; //$NON-NLS-1$ //$NON-NLS-2$
- String contents = "";
+ String contents = ""; //$NON-NLS-1$
if(!JpaArtifactFactory.instance().isMethodAnnotated(jpt)){
contents = annotationContents + attrFieldContent;
} else {
@@ -316,7 +316,7 @@ public class AddAttributeCommand implements Command { Locale.ENGLISH)
+ actName.substring(1);
String contents = " public " + JPAEditorUtil.returnSimpleName(type) + //$NON-NLS-1$
- "<"
+ "<" //$NON-NLS-1$
+ ((mapKeyType != null) ? (mapKeyType + ", ") : "") + attrType + "> " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"get" + attrNameWithCapitalA + "() {\n" + //$NON-NLS-1$ //$NON-NLS-2$
" return " //$NON-NLS-1$
@@ -346,12 +346,12 @@ public class AddAttributeCommand implements Command { Locale.ENGLISH)
+ actName.substring(1);
String contents = " public void set" + attrNameWithCapitalA + //$NON-NLS-1$
- "("
+ "(" //$NON-NLS-1$
+ JPAEditorUtil.returnSimpleName(type)
+ //$NON-NLS-1$
- "<"
+ "<" //$NON-NLS-1$
+ ((mapKeyType != null) ? (mapKeyType + ", ") : "") + attrType + "> param) " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "{\n"
+ "{\n" //$NON-NLS-1$
+ //$NON-NLS-1$
" this." //$NON-NLS-1$
+ JPAEditorUtil.decapitalizeFirstLetter(actName)
@@ -378,7 +378,7 @@ public class AddAttributeCommand implements Command { Locale.ENGLISH)
+ actName.substring(1);
- String contents = "";
+ String contents = ""; //$NON-NLS-1$
if(JpaArtifactFactory.instance().isMethodAnnotated(jpt)){
contents += annotationContents;
}
@@ -413,7 +413,7 @@ public class AddAttributeCommand implements Command { + " this." //$NON-NLS-1$
+ JPAEditorUtil.decapitalizeFirstLetter(actName)
+ " = param;\n" + //$NON-NLS-1$
- " }\n";
+ " }\n"; //$NON-NLS-1$
return contents;
}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/command/CreateEntityTypeHierarchy.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/command/CreateEntityTypeHierarchy.java new file mode 100644 index 0000000000..ad908629bd --- /dev/null +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/command/CreateEntityTypeHierarchy.java @@ -0,0 +1,90 @@ +/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2012 SAP AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Petya Sabeva - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpadiagrameditor.ui.internal.command;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jpt.common.utility.command.Command;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil;
+import org.eclipse.text.edits.DeleteEdit;
+import org.eclipse.text.edits.InsertEdit;
+import org.eclipse.text.edits.MalformedTreeException;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.text.edits.TextEditCopier;
+
+public class CreateEntityTypeHierarchy implements Command {
+
+ private JavaPersistentType subclass;
+ private JavaPersistentType superclass;
+ private boolean shouldCreate;
+
+ public CreateEntityTypeHierarchy(JavaPersistentType superclass, JavaPersistentType subclass, boolean shouldCreate) {
+ super();
+ this.superclass = superclass;
+ this.subclass = subclass;
+ this.shouldCreate = shouldCreate;
+
+ }
+
+ public void execute() {
+ buildHierarchy(superclass, subclass, shouldCreate);
+ this.subclass.getJavaResourceType().getJavaResourceCompilationUnit()
+ .synchronizeWithJavaSource();
+ }
+
+ private void buildHierarchy(JavaPersistentType superclass,
+ JavaPersistentType subclass, boolean build) {
+
+ try {
+ ICompilationUnit subCU = JPAEditorUtil.getCompilationUnit(subclass);
+
+ final Document document = new Document(subCU.getBuffer()
+ .getContents());
+ MultiTextEdit edit = new MultiTextEdit();
+ String str = document.get();
+
+ if (build) {
+ int offset = str.indexOf(subclass.getSimpleName())
+ + subclass.getSimpleName().length();
+ edit.addChild(new InsertEdit(offset, " extends " //$NON-NLS-1$
+ + superclass.getSimpleName()));
+ } else {
+ int length = ("extends " + superclass.getSimpleName() + " ") //$NON-NLS-1$ //$NON-NLS-2$
+ .length();
+ int offset = str.indexOf("extends"); //$NON-NLS-1$
+ edit.addChild(new DeleteEdit(offset, length));
+ }
+
+ if (edit != null) {
+ TextEditCopier copier = new TextEditCopier(edit);
+ TextEdit copy = copier.perform();
+ subCU.applyTextEdit(copy, new NullProgressMonitor());
+ }
+
+ } catch (CoreException exception) {
+ JPADiagramEditorPlugin.logError(exception);
+ } catch (MalformedTreeException exception) {
+ JPADiagramEditorPlugin.logError(exception);
+ }
+ }
+
+}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateIsARelationFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateIsARelationFeature.java new file mode 100644 index 0000000000..69c6f789a5 --- /dev/null +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/CreateIsARelationFeature.java @@ -0,0 +1,188 @@ +/*******************************************************************************
+ * <copyright>
+ *
+ * Copyright (c) 2012 SAP AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Petya Sabeva - initial API, implementation and documentation
+ *
+ * </copyright>
+ *
+ *******************************************************************************/
+
+package org.eclipse.jpt.jpadiagrameditor.ui.internal.feature;
+
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateConnectionContext;
+import org.eclipse.graphiti.features.context.impl.AddConnectionContext;
+import org.eclipse.graphiti.features.impl.AbstractCreateConnectionFeature;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.jpt.jpa.core.JpaProject;
+import org.eclipse.jpt.jpa.core.MappingKeys;
+import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
+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.ClassRef;
+import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.modelintegration.util.ModelIntegrationUtil;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.JPAEditorImageProvider;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil;
+import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory;
+
+public class CreateIsARelationFeature extends AbstractCreateConnectionFeature {
+
+ private JavaPersistentType superclass;
+
+ public CreateIsARelationFeature(IFeatureProvider fp) {
+ this(fp, JPAEditorMessages.CreateIsARelationFeature_CreateIsARelationFeatureName, JPAEditorMessages.CreateIsARelationFeature_CreateIsARelationFeatureDescription);
+ }
+
+ public CreateIsARelationFeature(IFeatureProvider fp, String name,
+ String description) {
+ super(fp, name, description);
+ }
+
+ public boolean canCreate(ICreateConnectionContext context) {
+ superclass = (JavaPersistentType)getPersistentType(context.getSourceAnchor());
+ JavaPersistentType subclass = (JavaPersistentType)getPersistentType(context.getTargetAnchor());
+ if ((superclass == null) || (subclass == null))
+ return false;
+
+ if(superclass.equals(subclass))
+ return false;
+
+ if (!JpaArtifactFactory.instance().hasEntityAnnotation(subclass) || subclass.getSuperPersistentType() != null)
+ return false;
+
+ if(!JpaArtifactFactory.instance().hasEntityAnnotation(superclass) &&
+ !JpaArtifactFactory.instance().hasMappedSuperclassAnnotation(superclass))
+ return false;
+ return true;
+ }
+
+ public Connection create(ICreateConnectionContext context) {
+ superclass = (JavaPersistentType)getPersistentType(context.getSourceAnchor());
+ JavaPersistentType subclass = (JavaPersistentType)getPersistentType(context.getTargetAnchor());
+
+ if(JpaArtifactFactory.instance().hasOrInheritsPrimaryKey(superclass)){
+ for(JavaPersistentAttribute jpa : subclass.getAttributes()){
+ if(jpa.getMappingKey().equals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY)){
+ jpa.setMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ } else if(jpa.getMappingKey().equals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY)) {
+ jpa.setMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
+ }
+ }
+ }
+
+ JpaArtifactFactory.instance().buildHierarchy(superclass, subclass, true);
+
+ JPAEditorUtil.createImport(JPAEditorUtil.getCompilationUnit(subclass), superclass.getName());
+
+ IsARelation rel = new IsARelation(subclass, superclass);
+ AddInheritedEntityFeature ft = new AddInheritedEntityFeature(getFeatureProvider());
+
+ AddConnectionContext cont = new AddConnectionContext(context.getTargetAnchor(), context.getSourceAnchor());
+ cont.setNewObject(rel);
+
+ Connection connection = (Connection) ft.add(cont);
+
+ return connection;
+ }
+
+ public boolean canStartConnection(ICreateConnectionContext context) {
+ superclass = (JavaPersistentType)getPersistentType(context.getSourceAnchor());
+
+ if (superclass == null)
+ return false;
+
+ return true;
+ }
+
+ public String getCreateImageId() {
+ return JPAEditorImageProvider.ICON_DERIVE_JPT;
+ }
+
+ protected PersistentType getPersistentType(Anchor anchor) {
+ if (anchor != null) {
+ Object refObject =
+ getBusinessObjectForPictogramElement(anchor.getParent());
+ if (refObject instanceof PersistentType) {
+ return (PersistentType) refObject;
+ }
+ }
+ return null;
+ }
+
+ public IJPAEditorFeatureProvider getFeatureProvider() {
+ return (IJPAEditorFeatureProvider)super.getFeatureProvider();
+ }
+
+ @Override
+ public void startConnecting() {
+ super.startConnecting();
+ disableAllEmbeddables();
+ }
+
+ @Override
+ public void attachedToSource(ICreateConnectionContext context) {
+ super.attachedToSource(context);
+ getFeatureProvider().setOriginalPersistentTypeColor();
+ disableUnvalidRelationTargets();
+ }
+
+ @Override
+ public void endConnecting() {
+ super.endConnecting();
+ getFeatureProvider().setOriginalPersistentTypeColor();
+ }
+
+ /**
+ * For each unvalid relationship's target, change the color of the respective
+ * java persistent type in gray to simulate disability of the persistent type.
+ */
+ private void disableUnvalidRelationTargets(){
+ Diagram d = getDiagram();
+ JpaProject project = ModelIntegrationUtil.getProjectByDiagram(d.getName());
+ PersistenceUnit unit = project.getRootContextNode().getPersistenceXml().
+ getRoot().getPersistenceUnits().iterator().next();
+ for (ClassRef classRef : unit.getClassRefs()) {
+ if (classRef.getJavaPersistentType() != null) {
+ final JavaPersistentType jpt = classRef.getJavaPersistentType();
+ if(!JpaArtifactFactory.instance().hasEntityAnnotation(jpt) || superclass.equals(jpt) || jpt.getSuperPersistentType() != null){
+ getFeatureProvider().setGrayColor(jpt);
+ }
+ }
+ }
+ }
+
+ /**
+ * Disable all {@link MappedSuperclass}es
+ * registered in the persistence unit.
+ * @param unit
+ */
+ private void disableAllEmbeddables() {
+ Diagram d = getDiagram();
+ JpaProject project = ModelIntegrationUtil.getProjectByDiagram(d.getName());
+ PersistenceUnit unit = project.getRootContextNode().getPersistenceXml().
+ getRoot().getPersistenceUnits().iterator().next();
+ for (ClassRef classRef : unit.getClassRefs()) {
+ if (classRef.getJavaPersistentType() != null) {
+ final JavaPersistentType jpt = classRef.getJavaPersistentType();
+ if(JpaArtifactFactory.instance().hasEmbeddableAnnotation(jpt)){
+ getFeatureProvider().setGrayColor(jpt);
+ }
+
+ }
+ }
+ }
+}
diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java index cac5bcff28..2b38643da2 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/DeleteRelationFeature.java @@ -23,6 +23,7 @@ import org.eclipse.graphiti.ui.features.DefaultDeleteFeature; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; import org.eclipse.jpt.jpadiagrameditor.ui.internal.i18n.JPAEditorMessages; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.AbstractRelation; @@ -30,7 +31,10 @@ import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.HasReferanceRelati import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IBidirectionalRelation; import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IRelation; import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IUnidirectionalRelation; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation; import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.IJPAEditorUtil; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JPAEditorUtil; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.util.JpaArtifactFactory; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.PlatformUI; @@ -76,11 +80,25 @@ public class DeleteRelationFeature extends DefaultDeleteFeature{ deleteAbstractRelation(businessObjectForPictogramElement); } else if (businessObjectForPictogramElement instanceof HasReferanceRelation){ deleteEmbeddedRelation(businessObjectForPictogramElement); + } else if (businessObjectForPictogramElement instanceof IsARelation) { + deleteInheritanceRelation(businessObjectForPictogramElement); } postDelete(context); } + private void deleteInheritanceRelation(Object businessObjectForPictogramElement) { + IsARelation rel = (IsARelation)businessObjectForPictogramElement; + JavaPersistentType superclass = rel.getSuperclass(); + JavaPersistentType subclass = rel.getSubclass(); + JpaArtifactFactory.instance().buildHierarchy(superclass, subclass, false); + + JPAEditorUtil.getCompilationUnit(subclass); +// subclass.getJavaResourceType().getJavaResourceCompilationUnit().synchronizeWithJavaSource(); + + getFeatureProvider().addJPTForUpdate(subclass.getName()); + } + private void deleteEmbeddedRelation(Object businessObjectForPictogramElement) { HasReferanceRelation rel = (HasReferanceRelation)businessObjectForPictogramElement; JavaPersistentAttribute attribute = rel.getEmbeddedAnnotatedAttribute(); @@ -142,6 +160,10 @@ public class DeleteRelationFeature extends DefaultDeleteFeature{ HasReferanceRelation rel = (HasReferanceRelation) businessObjectForPictogramElement; ICompilationUnit cu = getFeatureProvider().getCompilationUnit(rel.getEmbeddingEntity()); ut.organizeImports(cu, ws); + } else if (businessObjectForPictogramElement instanceof IsARelation){ + IsARelation rel = (IsARelation) businessObjectForPictogramElement; + ICompilationUnit cu = getFeatureProvider().getCompilationUnit(rel.getSubclass()); + ut.organizeImports(cu, ws); } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveRelationFeature.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveRelationFeature.java index 75acf9da19..5845aaa968 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveRelationFeature.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/feature/RemoveRelationFeature.java @@ -37,6 +37,7 @@ import org.eclipse.graphiti.services.Graphiti; import org.eclipse.jpt.jpadiagrameditor.ui.internal.provider.IJPAEditorFeatureProvider; import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.AbstractRelation; import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.HasReferanceRelation; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.relations.IsARelation; @SuppressWarnings("restriction") @@ -69,6 +70,9 @@ public class RemoveRelationFeature extends AbstractFeature implements IRemoveFea } else if (bo instanceof HasReferanceRelation) { HasReferanceRelation rel = (HasReferanceRelation) bo; getFeatureProvider().remove(rel.getId()); + } else if (bo instanceof IsARelation) { + IsARelation rel = (IsARelation) bo; + getFeatureProvider().remove(rel.getId()); } } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java index 08c8b4192c..769824a5b6 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/JPAEditorMessages.java @@ -44,6 +44,10 @@ public class JPAEditorMessages extends NLS { public static String CreateEmbeddableFeature_EmbeddableFeatureName; + public static String CreateIsARelationFeature_CreateIsARelationFeatureDescription; + + public static String CreateIsARelationFeature_CreateIsARelationFeatureName; + public static String CreateIsARelationFeature_description; public static String CreateIsARelationFeature_name; diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties index 17ffd80baf..19919ccc8b 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/i18n/messages.properties @@ -30,6 +30,8 @@ CreateDiagramJob_getJPADiagramMonitorTaskName=Get JPA Diagram CreateEmbeddableFeature_EmbeddableFeatureDescription=Create a new Embeddable object. CreateEmbeddableFeature_EmbeddableFeatureName=Embeddable +CreateIsARelationFeature_CreateIsARelationFeatureDescription=Click on an entity or mapped superclass and then click on an child entity. +CreateIsARelationFeature_CreateIsARelationFeatureName=Inherit Persistent Type CreateIsARelationFeature_description=Click on an entity or mapped superclass and then click somewhere in the diagram to create new inherited entity CreateIsARelationFeature_name=Inherited Entity diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java index 0156f7f991..e678c32c19 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorDiagramTypeProvider.java @@ -106,7 +106,6 @@ public class JPAEditorDiagramTypeProvider extends AbstractDiagramTypeProvider { return (JPAEditorFeatureProvider)super.getFeatureProvider(); } - @SuppressWarnings("restriction") public boolean hasToAdd() { JpaProject project = getTargetJPAProject(); PersistenceUnit unit = project.getRootContextNode().getPersistenceXml(). diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java index da59395e4e..544c155f5c 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorFeatureProvider.java @@ -330,7 +330,7 @@ public class JPAEditorFeatureProvider extends DefaultFeatureProvider implements if (bo instanceof JavaPersistentType) { return new DeleteJPAEntityFeature(this); } else if ((bo instanceof AbstractRelation) || - (bo instanceof HasReferanceRelation)) { + (bo instanceof HasReferanceRelation || (bo instanceof IsARelation))) { return new DeleteRelationFeature(this); } else if (bo instanceof JavaPersistentAttribute) { return new ClickRemoveAttributeButtonFeature(this); @@ -399,7 +399,7 @@ public class JPAEditorFeatureProvider extends DefaultFeatureProvider implements if (bo instanceof JavaPersistentType) { return new RemoveJPAEntityFeature(this, true); } else if ((bo instanceof AbstractRelation) || - (bo instanceof HasReferanceRelation)){ + (bo instanceof HasReferanceRelation) || (bo instanceof IsARelation)){ return new RemoveRelationFeature(this); } GraphicsAlgorithm ga = pe.getGraphicsAlgorithm(); diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java index 224a860b77..e6291053ee 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorImageProvider.java @@ -45,6 +45,7 @@ public class JPAEditorImageProvider extends AbstractImageProvider { public static final String ICON_EMBEDDED = PREFIX + "embedded"; //$NON-NLS-1$ public static final String ICON_ELEMENT_COLLECTION = PREFIX + "element-collection"; //$NON-NLS-1$ public static final String ICON_UNMAPPED = PREFIX + "unmapped"; //$NON-NLS-1$ + public static final String ICON_DERIVE_JPT = PREFIX + "derive_jpt"; //$NON-NLS-1$ public static final String ICON_ONE_TO_ONE_1_DIR = PREFIX + "one_to_one_1_dir_relation"; //$NON-NLS-1$ @@ -91,6 +92,7 @@ public class JPAEditorImageProvider extends AbstractImageProvider { addImageFilePath(ICON_EMBEDDED, ROOT_FOLDER_FOR_IMG + "ent/embedded.gif"); //$NON-NLS-1$ addImageFilePath(ICON_ELEMENT_COLLECTION, ROOT_FOLDER_FOR_IMG + "ent/element-collection.gif"); //$NON-NLS-1$ addImageFilePath(ICON_UNMAPPED, ROOT_FOLDER_FOR_IMG + "ent/null-attribute-mapping.gif"); //$NON-NLS-1$ + addImageFilePath(ICON_DERIVE_JPT, ROOT_FOLDER_FOR_IMG + "ent/derive_jpt.gif"); //$NON-NLS-1$ addImageFilePath(ICON_ONE_TO_ONE_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/one-to-one-1-dir.gif"); //$NON-NLS-1$ addImageFilePath(ICON_ONE_TO_MANY_1_DIR, ROOT_FOLDER_FOR_IMG + "ent/one-to-many-1-dir.gif"); //$NON-NLS-1$ diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java index f4d319c145..543b50c18a 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/provider/JPAEditorToolBehaviorProvider.java @@ -72,6 +72,7 @@ import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseAllEntitiesF import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseCompartmentShapeFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CollapseEntityFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateInheritedEntityFeature; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.CreateIsARelationFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.DeleteJPAEntityFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.DiscardAndRemoveAllEntitiesFeature; import org.eclipse.jpt.jpadiagrameditor.ui.internal.feature.EmbedCollectionOfObjectsFeature; @@ -298,6 +299,15 @@ public class JPAEditorToolBehaviorProvider extends DefaultToolBehaviorProvider { isARelToolEntry.addCreateConnectionFeature(ft); ent.addToolEntry(isARelToolEntry); + + + CreateIsARelationFeature ft1 = new CreateIsARelationFeature((IJPAEditorFeatureProvider) this.getFeatureProvider()); + ConnectionCreationToolEntry isARelToolEntry1 = new ConnectionCreationToolEntry(ft1.getCreateName(), + ft1.getCreateDescription(), ft1.getCreateImageId(), ft1.getCreateLargeImageId()); + isARelToolEntry1.addCreateConnectionFeature(ft1); + + ent.addToolEntry(isARelToolEntry1); + ret.add(1, ent); } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java index 07d3f0d6f8..a0a464d884 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPAEditorUtil.java @@ -1033,11 +1033,11 @@ public class JPAEditorUtil { String mappedSuperclassShortName = mappedSuperclassName .substring(mappedSuperclassName.lastIndexOf('.') + 1); String content = "package " + JPADiagramPropertyPage.getDefaultPackage(project) + ";\n\n" //$NON-NLS-1$ //$NON-NLS-2$ - + "import java.io.Serializable;\n" + + "import java.io.Serializable;\n" //$NON-NLS-1$ + "import javax.persistence.*;\n\n" //$NON-NLS-1$ + "@MappedSuperclass \n" //$NON-NLS-1$ + "public abstract class " + mappedSuperclassShortName + " implements Serializable {\n\n" //$NON-NLS-1$ //$NON-NLS-2$ - + "private static final long serialVersionUID = 1L;\n" + + "private static final long serialVersionUID = 1L;\n" //$NON-NLS-1$ + "}"; //$NON-NLS-1$ return createClassInProject(project, folder, mappedSuperclassShortName, content); } @@ -1188,13 +1188,13 @@ public class JPAEditorUtil { boolean fieldBasedAccess = JPADiagramPropertyPage.isAccessFieldBased(project, props); String classDeclarationStringContent = null; - String importSerializable = ""; + String importSerializable = ""; //$NON-NLS-1$ if (isMappedSuperclassChild) { String mappedSuperclassShortName = mappedSuperclassName.substring(mappedSuperclassName.lastIndexOf('.') + 1); classDeclarationStringContent = "public class " + entityShortName + " extends " + mappedSuperclassShortName + " {\n\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else { classDeclarationStringContent = "public class " + entityShortName + " implements Serializable {\n\n"; //$NON-NLS-1$ //$NON-NLS-2$ - importSerializable += "import java.io.Serializable;\n"; + importSerializable += "import java.io.Serializable;\n"; //$NON-NLS-1$ } String packageImport = ""; //$NON-NLS-1$ @@ -1217,9 +1217,9 @@ public class JPAEditorUtil { + ((tableName.length() > 0) ? ("@Table(name=\"" //$NON-NLS-1$ + tableName + "\")\n") : "") //$NON-NLS-1$ //$NON-NLS-2$ + classDeclarationStringContent - + "private static final long serialVersionUID = 1L;\n" - + "public " + entityShortName + "() {\n" - + "}\n" + + "private static final long serialVersionUID = 1L;\n" //$NON-NLS-1$ + + "public " + entityShortName + "() {\n" //$NON-NLS-1$ //$NON-NLS-2$ + + "}\n" //$NON-NLS-1$ + primaryKeyDeclaration +"}"; //$NON-NLS-1$ diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java index e9ad502dec..de3c95a852 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JPASolver.java @@ -1057,7 +1057,6 @@ public class JPASolver implements IResourceChangeListener, IJpaSolver { try { final String newHeader = (cu.hasUnsavedChanges() ? "* " : "") + entName; //$NON-NLS-1$ //$NON-NLS-2$ GraphicsUpdater.updateHeader(cs, newHeader); - JpaArtifactFactory.instance().rearrangeIsARelationsInTransaction(solver.featureProvider); } catch (JavaModelException e) { JPADiagramEditorPlugin.logError("Cannot check compilation unit for unsaved changes", e); //$NON-NLS-1$ } diff --git a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java index 5703776982..edfe5f76ed 100644 --- a/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java +++ b/jpa_diagram_editor/plugins/org.eclipse.jpt.jpadiagrameditor.ui/src/org/eclipse/jpt/jpadiagrameditor/ui/internal/util/JpaArtifactFactory.java @@ -86,6 +86,7 @@ import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation; import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation; import org.eclipse.jpt.jpadiagrameditor.ui.internal.JPADiagramEditorPlugin; import org.eclipse.jpt.jpadiagrameditor.ui.internal.command.AddAttributeCommand; +import org.eclipse.jpt.jpadiagrameditor.ui.internal.command.CreateEntityTypeHierarchy; import org.eclipse.jpt.jpadiagrameditor.ui.internal.command.DeleteAttributeCommand; import org.eclipse.jpt.jpadiagrameditor.ui.internal.command.RenameAttributeCommand; import org.eclipse.jpt.jpadiagrameditor.ui.internal.command.RenameEntityCommand; @@ -1604,9 +1605,6 @@ public class JpaArtifactFactory { Iterator<Connection> iter = Graphiti.getPeService().getAllConnections(cs).iterator(); while (iter.hasNext()) { Connection conn = iter.next(); - String v = Graphiti.getPeService().getPropertyValue(conn, IsARelation.IS_A_CONNECTION_PROP_KEY); - if (Boolean.TRUE.toString().equals(v)) - continue; IRemoveContext ctx = new RemoveContext(conn); ctxs.add(ctx); } @@ -1622,6 +1620,7 @@ public class JpaArtifactFactory { JavaPersistentType jpt) { addIRelationships(fp, jpt); addEmbeddedRelation(fp, jpt); + rearrangeIsARelations(fp); } private void addEmbeddedRelation(IJPAEditorFeatureProvider fp, @@ -1859,6 +1858,14 @@ public class JpaArtifactFactory { } return packageName; } + + public void buildHierarchy(JavaPersistentType superclass, JavaPersistentType subclass, boolean build) { - + Command createNewAttributeCommand = new CreateEntityTypeHierarchy(superclass, subclass, build); + try { + getJpaProjectManager().execute(createNewAttributeCommand, SynchronousUiCommandExecutor.instance()); + } catch (InterruptedException e) { + JPADiagramEditorPlugin.logError("Cannot create hierarchy of entity type " + subclass.getName(), e); //$NON-NLS-1$ + } + } } 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 7fc8418169..75e2fc2e24 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 @@ -91,8 +91,7 @@ public class EditorProxy { this.bot = bot;
}
- public SWTBotGefEditor openDiagramOnJPAContentNode(String name,
- boolean isJPA20) {
+ public SWTBotGefEditor openDiagramOnJPAContentNode(String name) {
SWTBotTree projectTree = workbenchBot.viewByTitle("Project Explorer")
.bot().tree();
SWTBotTreeItem item = projectTree.expandNode(name)
@@ -100,15 +99,13 @@ public class EditorProxy { assertTrue("The JPA Content node is disabled.", item.isEnabled());
ContextMenuHelper.clickContextMenu(projectTree, "Open Diagram");
- if (isJPA20) {
- workbenchBot
- .waitUntil(
- shellIsActive(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle),
- 10000);
- SWTBotShell jpaSupportWarningDialog = workbenchBot
- .shell(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle);
- getOkButton(jpaSupportWarningDialog).click();
- }
+ workbenchBot
+ .waitUntil(
+ shellIsActive(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle),
+ 10000);
+ SWTBotShell jpaSupportWarningDialog = workbenchBot
+ .shell(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle);
+ getOkButton(jpaSupportWarningDialog).click();
SWTBotGefEditor jpaDiagramEditor = bot.gefEditor(name);
assertFalse("Editor must not be dirty!", jpaDiagramEditor.isDirty());
@@ -120,20 +117,23 @@ public class EditorProxy { return jpaDiagramEditor;
}
- public SWTBotGefEditor openDiagramOnJPAProjectNode(String name) {
+ public SWTBotGefEditor openDiagramOnJPAProjectNode(String name,
+ boolean isJPA20) {
SWTBotTree projectTree = workbenchBot.viewByTitle("Project Explorer")
.bot().tree();
projectTree.expandNode(name).select();
ContextMenuHelper.clickContextMenu(projectTree, "JPA Tools",
"Open Diagram");
- workbenchBot
- .waitUntil(
- shellIsActive(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle),
- 10000);
- SWTBotShell jpaSupportWarningDialog = workbenchBot
- .shell(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle);
- getOkButton(jpaSupportWarningDialog).click();
+ if (isJPA20) {
+ workbenchBot
+ .waitUntil(
+ shellIsActive(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle),
+ 10000);
+ SWTBotShell jpaSupportWarningDialog = workbenchBot
+ .shell(JPAEditorMessages.OpenJpaDiagramActionDelegate_jpaSupportWarningTitle);
+ getOkButton(jpaSupportWarningDialog).click();
+ }
SWTBotGefEditor jpaDiagramEditor = bot.gefEditor(name);
assertFalse("Editor must not be dirty!", jpaDiagramEditor.isDirty());
@@ -210,11 +210,12 @@ public class EditorProxy { */
public SWTBotGefEditPart addAttributeToJPT(SWTBotGefEditPart jptType,
String attributeName) {
-
+
JavaPersistentType jpt = getJPTObjectForGefElement(jptType);
-
- System.out.println(">>>>>> Attribute is trying to be added in " + jpt.getName());
-
+
+ System.out.println(">>>>>> Attribute is trying to be added in "
+ + jpt.getName());
+
pressEntityContextButton(
jptType,
JPAEditorMessages.JPAEditorToolBehaviorProvider_createAttributeButtonlabel);
@@ -226,8 +227,9 @@ public class EditorProxy { SWTBotGefEditPart attribute = jpaDiagramEditor.getEditpart(
attributeName, editParts);
assertNotNull("Atrribute is not added.", attribute);
-
- System.out.println(">>>>>> Attribute is successfully added in " + jpt.getName());
+
+ System.out.println(">>>>>> Attribute is successfully added in "
+ + jpt.getName());
assertTrue("The newly added attribute must be selected.",
jpaDiagramEditor.selectedEditParts().size() == 1);
@@ -308,20 +310,20 @@ public class EditorProxy { .activateTool(JPAEditorMessages.CreateJPAEntityFeature_jpaEntityFeatureName);
jpaDiagramEditor.doubleClick(x, y);
- try{
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName), 30000);
- } catch (TimeoutException e){
+ try {
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
+ 30000);
+ } catch (TimeoutException e) {
jpaDiagramEditor.activateDefaultTool();
-
- Utils.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> yavno tova e");
-
+
jpaDiagramEditor
- .activateTool(JPAEditorMessages.CreateJPAEntityFeature_jpaEntityFeatureName);
+ .activateTool(JPAEditorMessages.CreateJPAEntityFeature_jpaEntityFeatureName);
jpaDiagramEditor.doubleClick(x, y);
-
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName), 30000);
+
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
+ 30000);
}
-
+
List<SWTBotGefEditPart> entities = jpaDiagramEditor.mainEditPart()
.children();
assertFalse("Editor must contains at least one entity!",
@@ -364,19 +366,19 @@ public class EditorProxy { jpaDiagramEditor
.activateTool(JPAEditorMessages.CreateMappedSuperclassFeature_createMappedSuperclassFeatureName);
jpaDiagramEditor.doubleClick(x, y);
-
- try{
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName), 30000);
- } catch (TimeoutException e){
+
+ try {
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
+ 30000);
+ } catch (TimeoutException e) {
jpaDiagramEditor.activateDefaultTool();
-
- Utils.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> yavno tova e");
-
+
jpaDiagramEditor
- .activateTool(JPAEditorMessages.CreateMappedSuperclassFeature_createMappedSuperclassFeatureName);
+ .activateTool(JPAEditorMessages.CreateMappedSuperclassFeature_createMappedSuperclassFeatureName);
jpaDiagramEditor.doubleClick(x, y);
-
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName), 30000);
+
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
+ 30000);
}
List<SWTBotGefEditPart> entities = jpaDiagramEditor.mainEditPart()
@@ -427,21 +429,21 @@ public class EditorProxy { jpaDiagramEditor
.activateTool(JPAEditorMessages.CreateEmbeddableFeature_EmbeddableFeatureName);
jpaDiagramEditor.doubleClick(x, y);
-
- try{
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName), 30000);
- } catch (TimeoutException e){
+
+ try {
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
+ 30000);
+ } catch (TimeoutException e) {
jpaDiagramEditor.activateDefaultTool();
-
- Utils.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> yavno tova e");
-
+
jpaDiagramEditor
- .activateTool(JPAEditorMessages.CreateEmbeddableFeature_EmbeddableFeatureName);
+ .activateTool(JPAEditorMessages.CreateEmbeddableFeature_EmbeddableFeatureName);
jpaDiagramEditor.doubleClick(x, y);
-
- bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName), 30000);
+
+ bot.waitUntil(new ElementIsShown(jpaDiagramEditor, entityName),
+ 30000);
}
-
+
List<SWTBotGefEditPart> entities = jpaDiagramEditor.mainEditPart()
.children();
assertFalse("Editor must contains at least one embeddable!",
@@ -565,8 +567,8 @@ public class EditorProxy { List<SWTBotGefEditPart> entitiesInDiagram = jpaDiagramEditor
.mainEditPart().children();
-// assertFalse("Diagram must contain at least one entity!",
-// entitiesInDiagram.isEmpty());
+ // assertFalse("Diagram must contain at least one entity!",
+ // entitiesInDiagram.isEmpty());
for (int i = 0; i < entitiesInDiagram.size(); i++) {
SWTBotGefEditPart editPart = entitiesInDiagram.get(i);
@@ -582,7 +584,7 @@ public class EditorProxy { waitASecond();
entitiesInDiagram = jpaDiagramEditor.mainEditPart().children();
assertTrue("Diagram must be empty!", entitiesInDiagram.isEmpty());
-// assertTrue("Editor must be dirty!", jpaDiagramEditor.isDirty());
+ // assertTrue("Editor must be dirty!", jpaDiagramEditor.isDirty());
}
public void deleteAttributeInJPT(SWTBotGefEditPart jpt, String attributeName) {
@@ -783,15 +785,12 @@ public class EditorProxy { 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) {
- System.out.println("======================= axam axam");
return (HasReferanceRelation) ob;
- } else if (ob instanceof IRelation) {
- System.out.println("++++++++++++ dobre");
}
return null;
@@ -1363,14 +1362,15 @@ public class EditorProxy { * @param typeMapping
* - the expected type mapping
*/
- public void assertTypeIsCorretlyMapped(String typeName, String typeMapping) {
+ public void assertTypeIsCorretlyMapped(SWTBotGefEditPart type,
+ String typeMapping) {
// workbenchBot.viewByTitle("JPA Details").close();
-// SWTBotGefEditPart type = jpaDiagramEditor.getEditPart(typeName);
+ // SWTBotGefEditPart type = jpaDiagramEditor.getEditPart(typeName);
-// JavaPersistentType jpt = getJPTObjectForGefElement(type);
-// assertEquals("Type is not mapped correctly.", jpt.getMappingKey(),
-// typeMapping);
+ // JavaPersistentType jpt = getJPTObjectForGefElement(type);
+ // assertEquals("Type is not mapped correctly.", jpt.getMappingKey(),
+ // typeMapping);
// type.click();
//
@@ -1394,16 +1394,18 @@ public class EditorProxy { assertTrue("JPA Details view must be opened!",
jpaDetailsView.isActive());
- SWTBotGefEditPart type = jpaDiagramEditor.getEditPart(typeName);
+ // SWTBotGefEditPart type = jpaDiagramEditor.getEditPart(typeName);
type.select();
type.click();
+ String typeName = getJPTObjectForGefElement(type).getSimpleName();
+
// assert that the default entity's attribute is mapped as primary key
SWTBot jpaDetailsBot = jpaDetailsView.bot();
SWTBotStyledText styledText = jpaDetailsBot.styledText();
- assertEquals("Type '" + typeName + "' is mapped as "
- + typeMapping + ".", styledText.getText());
+ assertEquals("Type '" + typeName + "' is mapped as " + typeMapping
+ + ".", styledText.getText());
}
public void deleteJPTViaButton(SWTBotGefEditPart jptType) {
@@ -1679,9 +1681,9 @@ public class EditorProxy { jpaDiagramEditor
.clickContextMenu(JPAEditorMessages.JPAEditorToolBehaviorProvider_showAllTheEntities);
-
+
bot.waitUntil(new ElementAppearsInDiagram(jpaDiagramEditor), 20000);
-
+
assertFalse("Diagram must contain at least one entity!",
jpaDiagramEditor.mainEditPart().children().isEmpty());
@@ -1720,9 +1722,9 @@ public class EditorProxy { jpaDiagramEditor
.clickContextMenu(JPAEditorMessages.JPAEditorToolBehaviorProvider_showAllTheEntities);
-
+
bot.waitUntil(new ElementAppearsInDiagram(jpaDiagramEditor), 20000);
-
+
assertFalse("Diagram must contain at least one entity!",
jpaDiagramEditor.mainEditPart().children().isEmpty());
@@ -2076,7 +2078,7 @@ public class EditorProxy { public void createInheritedEntity(SWTBotGefEditPart superclass,
String subclassName, String superclassMappingLinkLabel,
- boolean byMappedSuperclass) {
+ boolean byMappedSuperclass, boolean existing) {
String superclassName = getJPTObjectForGefElement(superclass)
.getSimpleName();
@@ -2091,6 +2093,37 @@ public class EditorProxy { SWTBotGefEditPart inheritedEntity = jpaDiagramEditor
.getEditPart(subclassName);
assertNotNull(inheritedEntity);
+ testCreateAndDeleteIsARelation(superclass, subclassName,
+ superclassMappingLinkLabel, byMappedSuperclass, superclassName,
+ inheritedEntity, existing);
+ }
+
+ public void testCreateAndDeleteIsARelation(SWTBotGefEditPart superclass,
+ String subclassName, String superclassMappingLinkLabel,
+ boolean byMappedSuperclass, String superclassName,
+ SWTBotGefEditPart inheritedEntity, boolean existing) {
+
+ SWTBotGefConnectionEditPart connection = testIsARelationProperties(
+ superclass, subclassName, superclassMappingLinkLabel,
+ byMappedSuperclass, superclassName, inheritedEntity, existing);
+
+ connection.select();
+ jpaDiagramEditor.clickContextMenu("Delete");
+ confirmDelete();
+ waitASecond();
+ assertTrue(superclass.sourceConnections().isEmpty());
+ assertTrue(inheritedEntity.targetConnections().isEmpty());
+
+ assertNull("The entity must not has a super persitent type.",
+ getJPTObjectForGefElement(inheritedEntity)
+ .getSuperPersistentType());
+ }
+
+ public SWTBotGefConnectionEditPart testIsARelationProperties(
+ SWTBotGefEditPart superclass, String subclassName,
+ String superclassMappingLinkLabel, boolean byMappedSuperclass,
+ String superclassName, SWTBotGefEditPart inheritedEntity,
+ boolean existing) {
if (byMappedSuperclass) {
assertTrue(isSectionVisible(inheritedEntity,
JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape));
@@ -2100,8 +2133,13 @@ public class EditorProxy { }
assertFalse(isSectionVisible(inheritedEntity,
JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes));
- assertFalse(isSectionVisible(inheritedEntity,
- JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes));
+ if (existing) {
+ assertTrue(isSectionVisible(inheritedEntity,
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes));
+ } else {
+ assertFalse(isSectionVisible(inheritedEntity,
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes));
+ }
jpaDiagramEditor.activateDefaultTool();
@@ -2119,9 +2157,18 @@ public class EditorProxy { rel.getSubclass());
assertEquals(getJPTObjectForGefElement(superclass), rel.getSuperclass());
- assertTypeIsCorretlyMapped(superclassName, superclassMappingLinkLabel);
- assertTypeIsCorretlyMapped(subclassName,
+ assertTypeIsCorretlyMapped(superclass, superclassMappingLinkLabel);
+ assertTypeIsCorretlyMapped(inheritedEntity,
JptUiDetailsMessages.EntityUiProvider_linkLabel);
+
+ JavaPersistentType superJPT = (JavaPersistentType) getJPTObjectForGefElement(
+ inheritedEntity).getSuperPersistentType();
+ assertNotNull("The entity must has a super persitent type.", superJPT);
+ assertEquals(
+ "The super persistent type must be the source of the connection.",
+ superJPT, getJPTObjectForGefElement(superclass));
+
+ return connection;
}
public void testNoConnectionIsCreated(String relationFeatureName,
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 5dea59ec19..a80baea140 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 @@ -52,8 +52,6 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase { protected static JPACreateFactory factory = JPACreateFactory.instance();
protected static JpaProject jpaProject;
- // protected static JpaProject jpaProject10;
-
protected static SWTGefBot bot = new SWTGefBot();
protected static SWTWorkbenchBot workbenchBot = new SWTWorkbenchBot();
protected static EditorProxy editorProxy = new EditorProxy(workbenchBot,
@@ -82,7 +80,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase { assertNotNull(jpaProject);
jpaDiagramEditor = editorProxy
- .openDiagramOnJPAContentNode(TEST_PROJECT, true);
+ .openDiagramOnJPAProjectNode(TEST_PROJECT, true);
editorProxy.setJpaDiagramEditor(jpaDiagramEditor);
Thread.sleep(2000);
@@ -1967,7 +1965,7 @@ public class EmbeddableInDiagramSWTBotTest extends SWTBotGefTestCase { assertNotNull(jpaProject10);
SWTBotGefEditor jpaDiagramEditor10 = editorProxy
- .openDiagramOnJPAContentNode(name, false);
+ .openDiagramOnJPAProjectNode(name, false);
editorProxy.setJpaDiagramEditor(jpaDiagramEditor10);
SWTBotGefEditPart embeddable1 = editorProxy.addEmbeddableToDiagram(50,
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 32be204979..cc98f33e05 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 @@ -72,8 +72,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { jpaProject = factory.createJPA20Project(TEST_PROJECT);
assertNotNull(jpaProject);
- jpaDiagramEditor = editorProxy
- .openDiagramOnJPAContentNode(TEST_PROJECT, true);
+ jpaDiagramEditor = editorProxy.openDiagramOnJPAProjectNode(
+ TEST_PROJECT, true);
editorProxy.setJpaDiagramEditor(jpaDiagramEditor);
Thread.sleep(2000);
@@ -88,7 +88,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testAddEntity() {
Utils.sayTestStarted("testAddEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
editorProxy.addEntityToDiagram(50, 50, "Entity1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
@@ -110,9 +111,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testRemoveEntityViaButton() {
Utils.sayTestStarted("testRemoveEntityViaButton");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.deleteJPTViaButton(entity);
@@ -130,9 +133,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testRemoveEntityViaContextMenu() {
Utils.sayTestStarted("testRemoveEntityViaContextMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.deleteJPTViaMenu(entity);
@@ -150,13 +155,18 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testAddAttribute() {
Utils.sayTestStarted("testAddAttribute");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
assertFalse(
"\"Other Attributes\" section must not be visible!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes, entity));
+ editorProxy
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ entity));
editorProxy.addAttributeToJPT(entity, "attribute1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
@@ -167,18 +177,23 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { Utils.sayTestFinished("testAddAttribute");
}
-
+
@Test
- public void testAddElementCollectionAttribute(){
+ public void testAddElementCollectionAttribute() {
Utils.sayTestStarted("testAddElementCollectionAttribute");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
assertFalse(
"\"Other Attributes\" section must not be visible!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes, entity));
+ editorProxy
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ entity));
editorProxy.addElementCollectionAttributeToJPT(entity, "attribute1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
@@ -197,9 +212,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testRemoveAttributeViaContextButton() {
Utils.sayTestStarted("testRemoveAttributeViaContextButton");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.removeAttributeViaButton(entity, "attribute1");
@@ -217,9 +234,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testRemoveAttributeViaMenu() {
Utils.sayTestStarted("testRemoveAttributeViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.removeAttributeViaMenu(entity, "attribute1");
@@ -237,9 +256,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testDirectEditingAttribute() {
Utils.sayTestStarted("testDirectEditingAttribute");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.directEditAttribute(entity, "attribute1");
@@ -259,9 +280,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testDirectEditingEntity() {
Utils.sayTestStarted("testDirectEditingEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
@@ -293,9 +316,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testDoubleClickOnEntity() {
Utils.sayTestStarted("testDoubleClickOnEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
jpaDiagramEditor.doubleClick(entity);
@@ -319,20 +344,28 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testChangeAttributeType() {
Utils.sayTestStarted("testChangeAttributeType");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
- assertFalse("\"Other Attributes\" section must not be visible!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes, entity));
+ assertFalse(
+ "\"Other Attributes\" section must not be visible!",
+ editorProxy
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ entity));
- SWTBotGefEditPart attribute = editorProxy.addAttributeToJPT(entity, "attribute1");
+ SWTBotGefEditPart attribute = editorProxy.addAttributeToJPT(entity,
+ "attribute1");
assertNotNull("The attribute must not be renamed!", attribute);
-
+
final IFeatureProvider fp = ((DiagramEditPart) jpaDiagramEditor
.mainEditPart().part()).getFeatureProvider();
- String currentAttributeType = editorProxy.getAttributeType("attribute1", fp);
+ String currentAttributeType = editorProxy.getAttributeType(
+ "attribute1", fp);
assertEquals("java.lang.String", currentAttributeType);
SWTBotShell changeTypeDialog = editorProxy
@@ -356,7 +389,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { assertEquals("The attribute type must not be changed!",
"java.lang.String", currentAttributeType);
- changeTypeDialog = editorProxy.getSelectNewAttributeTypeDialog(attribute);
+ changeTypeDialog = editorProxy
+ .getSelectNewAttributeTypeDialog(attribute);
attributeType = editorProxy.getNewTypeInputField(changeTypeDialog);
// change the attribute type to int
@@ -391,9 +425,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testRenameEntityViaMenu() {
Utils.sayTestStarted("testRenameEntityViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
entity.click();
jpaDiagramEditor
@@ -437,9 +473,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testMoveEntityViaMenu() throws JavaModelException {
Utils.sayTestStarted("testMoveEntityViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
JpaArtifactFactory factory = JpaArtifactFactory.instance();
String packageName = factory
@@ -479,9 +517,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testCollapseExapandEntityViaContextButton() {
Utils.sayTestStarted("testCollapseExapandEntityViaContextButton");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.collapseExpandJPTViaButton(entity);
@@ -498,9 +538,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testCollapseExapandEntityViaMenu() {
Utils.sayTestStarted("testCollapseExapandEntityViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.collapseExpandJPTViaMenu(entity);
@@ -517,10 +559,13 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testCollapseExapandAllEntitiesViaMenu() {
Utils.sayTestStarted("testCollapseExapandAllEntitiesViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(300, 50, "Entity2");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(300, 50,
+ "Entity2");
editorProxy.collapseExpandAllJPTsViaMenu(entity1, entity2);
@@ -539,9 +584,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testDiscardChanges() {
Utils.sayTestStarted("testDiscardChanges");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.discardChanges(entity, "attribute1");
@@ -562,12 +609,13 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testRemoveAndDiscardChangesViaMenu() {
Utils.sayTestStarted("testRemoveAndDiscardChangesViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
- editorProxy.removeAndDiscardChangesViaMenu(entity,
- "attribute1");
+ editorProxy.removeAndDiscardChangesViaMenu(entity, "attribute1");
entity.click();
editorProxy.deleteDiagramElements();
@@ -587,9 +635,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testRemoveAndSaveChangesViaMenu() {
Utils.sayTestStarted("testRemoveAndSaveChangesViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.removeAndSaveChangesViaMenu(entity, "attribute1");
@@ -609,9 +659,11 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSaveOnlyEntity() {
Utils.sayTestStarted("testSaveOnlyEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.saveOnlyJPT(entity, "attribute1");
editorProxy.deleteDiagramElements();
@@ -631,14 +683,15 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testShowAllEntities() throws Exception {
Utils.sayTestStarted("testShowAllEntities");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
factory.createEntity(jpaProject, "com.sap.test.Customer");
assertTrue(jpaDiagramEditor.mainEditPart().children().isEmpty());
jpaDiagramEditor
.clickContextMenu(JPAEditorMessages.JPAEditorToolBehaviorProvider_showAllTheEntities);
-
+
bot.waitUntil(new ElementAppearsInDiagram(jpaDiagramEditor), 20000);
List<SWTBotGefEditPart> entities = jpaDiagramEditor.mainEditPart()
@@ -663,7 +716,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testCollapseExpandCompartmentByDoubleClick() {
Utils.sayTestStarted("testCollapseExpandCompartmentByDoubleClick");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
editorProxy.addEntityToDiagram(50, 50, "Entity1");
@@ -709,13 +763,15 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testCollapseExpandCompartmentByContextMenu() {
Utils.sayTestStarted("testCollapseExpandCompartmentByContextMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// editorProxy.moveMouse(jpaDiagramEditor, 100, 100);
- SWTBotGefEditPart primaryKeySection = editorProxy.getSectionInJPT(entity,
- JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape);
+ SWTBotGefEditPart primaryKeySection = editorProxy.getSectionInJPT(
+ entity, JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape);
// SWTBotGefEditPart primaryKeySection =
// jpaDiagramEditor.getEditPart(JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape);
primaryKeySection.select();
@@ -767,10 +823,12 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testChangeEntityMappingTypeViaJPADetailsView() {
Utils.sayTestStarted("testChangeEntityMappingTypeViaJPADetailsView");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
workbenchBot.viewByTitle("JPA Details").close();
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
jpaDiagramEditor.save();
jpaDiagramEditor
@@ -869,10 +927,12 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testChangeAttributeMappingTypeViaJPADetailsView() {
Utils.sayTestStarted("testChangeAttributeMappingTypeViaJPADetailsView");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
workbenchBot.viewByTitle("JPA Details").close();
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
jpaDiagramEditor.save();
jpaDiagramEditor
@@ -893,17 +953,20 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { // assert that the attribute is under "Primary Key" section
assertTrue(
"Attribute must be in the \"Primary Key\" section of the entity!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
+ editorProxy.isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
entity));
assertFalse(
"Attribute must be in the \"Primary Key\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
entity));
assertFalse(
"Attribute must be in the \"Primary Key\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
entity));
// assert that the ID's sections are available
assertTrue(jpaDetailsBot.label("ID").isEnabled());
@@ -918,17 +981,20 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { // assert that the attribute is moved under "Other Attributes" section
assertFalse(
"Attribute must be in the \"Primary Key\" section of the entity!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
+ editorProxy.isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
entity));
assertFalse(
"Attribute must be in the \"Relation Attributes\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
entity));
assertTrue(
"Attribute must be in the \"Other Attributes\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
entity));
// assert that the Basic's sections are available
assertTrue(jpaDetailsBot.label("Basic").isEnabled());
@@ -944,17 +1010,20 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { // section
assertFalse(
"Attribute must be in the \"Primary key\" section of the entity!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
+ editorProxy.isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
entity));
assertTrue(
"Attribute must be in the \"Relation Attributes\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
entity));
assertFalse(
"Attribute must be in the \"Other Attributes\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
entity));
// assert that the Many to Many's sections are available
assertTrue(jpaDetailsBot.label("Many to Many").isEnabled());
@@ -969,17 +1038,20 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { // assert that the attribute is under "Primary Key" section
assertTrue(
"Attribute must be in the \"Primary Key\" section of the entity!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
+ editorProxy.isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_primaryKeysShape,
entity));
assertFalse(
"Attribute must be in the \"Relation Attributes\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_relationAttributesShapes,
entity));
assertFalse(
"Attribute must be in the \"Other Attributes\" section of the entity!",
editorProxy
- .isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
entity));
// assert that the ID's sections are available
assertTrue(jpaDetailsBot.label("ID").isEnabled());
@@ -996,8 +1068,8 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { /**
* Creates "One to One" unidirectional relationship (from entity1 to
* entity2). Assert that the relation attributes exists. Delete the
- * relationship and assert that the attributes do not exists anymore.
- * Check that if the owner attribute will be deleted, the relationship will
+ * relationship and assert that the attributes do not exists anymore. Check
+ * that if the owner attribute will be deleted, the relationship will
* disappear.
*
*/
@@ -1005,21 +1077,31 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testOneToOneUniDirRelationship() {
Utils.sayTestStarted("testOneToOneUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
-
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50, "Entity2");
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
+
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
+ "Entity2");
// create One-to-One unidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelation(JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
- entity1, entity2, IRelation.RelType.ONE_TO_ONE,
- JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+
// create One-to-One unidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelRemoveOwnerAttribute(
- JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
- entity1, entity2, IRelation.RelType.ONE_TO_ONE,
- JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelRemoveOwnerAttribute(
+ JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1037,17 +1119,21 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSelfOneToOneUniDirRelationship() {
Utils.sayTestStarted("testSelfOneToOneUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// create One-to-One unidirectional self relation from entity1 to
// entity1
- editorProxy.testSelfUniDirRelation(
- JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
- entity1, IRelation.RelType.ONE_TO_ONE,
- JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testSelfUniDirRelation(
+ JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
+ entity1,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+
editorProxy.deleteDiagramElements();
jpaDiagramEditor.save();
@@ -1058,38 +1144,49 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { /**
* Creates "One to One" bidirectional relationship (from entity1 to
* entity2). Assert that the relation attributes exists. Delete the
- * relationship and assert that the attributes do not exists anymore.
- * Check that if the inverse attribute will be deleted the
- * connection will be transformed into one-to-one unidirectional
- * relationship. Test that if the owner attribute will be deleted, the
- * relationship will disappear.
+ * relationship and assert that the attributes do not exists anymore. Check
+ * that if the inverse attribute will be deleted the connection will be
+ * transformed into one-to-one unidirectional relationship. Test that if the
+ * owner attribute will be deleted, the relationship will disappear.
*/
@Test
public void testOneToOneBiDirRelationship() {
Utils.sayTestStarted("testOneToOneBiDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50, "Entity2");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
+ "Entity2");
// create One-to-One bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRel(
- JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
- entity1, entity2, IRelation.RelType.ONE_TO_ONE,
- JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testBiDirRel(
+ JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+
// create One-to-One bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRelRemoveInverseAttribute(
- JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
- entity1, entity2, IRelation.RelType.ONE_TO_ONE,
- JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testBiDirRelRemoveInverseAttribute(
+ JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+
// create One-to-One bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRelRemoveOwnerAttr(
- JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
- entity1, entity2, IRelation.RelType.ONE_TO_ONE,
- JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+ editorProxy
+ .testBiDirRelRemoveOwnerAttr(
+ JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1107,15 +1204,19 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSelfOneToOneBiDirRelationship() {
Utils.sayTestStarted("testSelfOneToOneBiDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// create One-to-One bidirectional self relation from entity1 to entity1
- editorProxy.testSelfBiDirRel(
- JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
- entity1, IRelation.RelType.ONE_TO_ONE,
- JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+ editorProxy
+ .testSelfBiDirRel(
+ JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
+ entity1,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1127,31 +1228,40 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { /**
* Creates "One to Many" unidirectional relationship (from entity1 to
* entity2). Assert that the relation attributes exists. Delete the
- * relationship and assert that the attributes do not exists anymore.
- * Check that if the owner attribute will be deleted, the relationship will
+ * relationship and assert that the attributes do not exists anymore. Check
+ * that if the owner attribute will be deleted, the relationship will
* disappear.
*/
@Test
public void testOneToManyUniDirRelationship() {
Utils.sayTestStarted("testOneToManyUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50, "Entity2");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
+ "Entity2");
// create One-to-Many unidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelation(
- JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
- entity1, entity2, IRelation.RelType.ONE_TO_MANY,
- JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.ONE_TO_MANY,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
// create One-to-One bidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelRemoveOwnerAttribute(
- JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
- entity1, entity2, IRelation.RelType.ONE_TO_MANY,
- JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testUniDirRelRemoveOwnerAttribute(
+ JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.ONE_TO_MANY,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+
editorProxy.deleteDiagramElements();
jpaDiagramEditor.save();
@@ -1168,17 +1278,21 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSelfOneToManyUniDirRelationship() {
Utils.sayTestStarted("testSelfOneToManyUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// create One-to-Many unidirectional self relation from entity1 to
// entity1
- editorProxy.testSelfUniDirRelation(
- JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
- entity1, IRelation.RelType.ONE_TO_MANY,
- JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testSelfUniDirRelation(
+ JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
+ entity1,
+ IRelation.RelType.ONE_TO_MANY,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1190,30 +1304,39 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { /**
* Creates "Many to One" unidirectional relationship (from entity1 to
* entity2). Assert that the relation attributes exists. Delete the
- * relationship and assert that the attributes do not exists anymore.
- * Check that if the owner attribute will be deleted, the relationship will
+ * relationship and assert that the attributes do not exists anymore. Check
+ * that if the owner attribute will be deleted, the relationship will
* disappear.
*/
@Test
public void testManyToOneUniDirRelationship() {
Utils.sayTestStarted("testManyToOneUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50, "Entity2");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
+ "Entity2");
// create Many-to-One unidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelation(
- JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_ONE,
- JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
+
// create Many-to-One bidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelRemoveOwnerAttribute(
- JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_ONE,
- JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelRemoveOwnerAttribute(
+ JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1231,16 +1354,20 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSelfManyToOneUniDirRelationship() {
Utils.sayTestStarted("testSelfManyToOneUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// create Many-to-One unidirectional self relation from entity1 to
// entity1
- editorProxy.testSelfUniDirRelation(
- JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
- entity1, IRelation.RelType.MANY_TO_ONE,
- JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
+ editorProxy
+ .testSelfUniDirRelation(
+ JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
+ entity1,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1252,41 +1379,52 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { /**
* Creates a "Many to One" bidirectional relationship (from entity1 to
* entity2). Assert that the relation attributes exists. Delete the
- * relationship and assert that the attributes do not exists anymore.
- * Check that if the inverse attribute will be deleted the
- * connection will be transformed into many-to-one unidirectional
- * relationship. Test that if the owner attribute will be deleted, the
- * relationship will disappear.
+ * relationship and assert that the attributes do not exists anymore. Check
+ * that if the inverse attribute will be deleted the connection will be
+ * transformed into many-to-one unidirectional relationship. Test that if
+ * the owner attribute will be deleted, the relationship will disappear.
*/
@Test
public void testManyToOneBiDirRelationship() {
Utils.sayTestStarted("testManyToOneBiDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50, "Entity2");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
+ "Entity2");
// create Many-to-One bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRelWithTwoMappingTypes(
- JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_ONE,
- JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
- JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testBiDirRelWithTwoMappingTypes(
+ JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+
// create Many-to-One bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRelWithTwoMappingsWithoutInverseAttr(
- JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_ONE,
- JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
- JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testBiDirRelWithTwoMappingsWithoutInverseAttr(
+ JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+
// create Many-to-One bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRelWithTwoMappingsWithoutOwnerAttr(
- JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_ONE,
- JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
- JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testBiDirRelWithTwoMappingsWithoutOwnerAttr(
+ JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1304,17 +1442,21 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSelfManyToOneBiDirRelationship() {
Utils.sayTestStarted("testSelfManyToOneBiDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// create Many-to-Many bidirectional self relation from entity1 to
// entity1
- editorProxy.testSelfBiDirRelWithTwoMappings(
- JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
- entity1, IRelation.RelType.MANY_TO_ONE,
- JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
- JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testSelfBiDirRelWithTwoMappings(
+ JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
+ entity1,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
jpaDiagramEditor.save();
@@ -1325,30 +1467,39 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { /**
* Creates "Many to Many" unidirectional relationship (from entity1 to
* entity2). Assert that the relation attributes exists. Delete the
- * relationship and assert that the attributes do not exists anymore.
- * Check that if the owner attribute will be deleted, the relationship will
+ * relationship and assert that the attributes do not exists anymore. Check
+ * that if the owner attribute will be deleted, the relationship will
* disappear.
*/
@Test
public void testManyToManyUniDirRelationship() {
Utils.sayTestStarted("testManyToManyUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50, "Entity2");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
+ "Entity2");
// create Many-to-Many unidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelation(
- JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_MANY,
- JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+
// create Many-to-Many bidirectional relation from entity1 to entity2
- editorProxy.testUniDirRelRemoveOwnerAttribute(
- JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_MANY,
- JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelRemoveOwnerAttribute(
+ JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1366,16 +1517,20 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSelfManyToManyUniDirRelationship() {
Utils.sayTestStarted("testSelfManyToManyUniDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// create Many-to-Many unidirectional self relation from entity1 to
// entity1
- editorProxy.testSelfUniDirRelation(
- JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
- entity1, IRelation.RelType.MANY_TO_MANY,
- JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testSelfUniDirRelation(
+ JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
+ entity1,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1387,38 +1542,49 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { /**
* Creates a "Many to Many" bidirectional relationship (from entity1 to
* entity2). Assert that the relation attributes exists. Delete the
- * relationship and assert that the attributes do not exists anymore.
- * Check that if the inverse attribute will be deleted the
- * connection will be transformed into many-to-many unidirectional
- * relationship. Test that if the owner attribute will be deleted, the
- * relationship will disappear.
+ * relationship and assert that the attributes do not exists anymore. Check
+ * that if the inverse attribute will be deleted the connection will be
+ * transformed into many-to-many unidirectional relationship. Test that if
+ * the owner attribute will be deleted, the relationship will disappear.
*/
@Test
public void testManyToManyBiDirRelationship() {
Utils.sayTestStarted("testManyToManyBiDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
- SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50, "Entity2");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ SWTBotGefEditPart entity2 = editorProxy.addEntityToDiagram(200, 50,
+ "Entity2");
// create Many-to-Many bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRel(
- JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_MANY,
- JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testBiDirRel(
+ JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+
// create Many-to-Many bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRelRemoveInverseAttribute(
- JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_MANY,
- JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
-
+ editorProxy
+ .testBiDirRelRemoveInverseAttribute(
+ JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+
// create Many-to-Many bidirectional relation from entity1 to entity2
- editorProxy.testBiDirRelRemoveOwnerAttr(
- JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
- entity1, entity2, IRelation.RelType.MANY_TO_MANY,
- JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testBiDirRelRemoveOwnerAttr(
+ JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
+ entity1,
+ entity2,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1436,16 +1602,20 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testSelfManyToManyBiDirRelationship() {
Utils.sayTestStarted("testSelfManyToManyBiDirRelationship");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
// create Many-to-Many bidirectional self relation from entity1 to
// entity1
- editorProxy.testSelfBiDirRel(
- JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
- entity1, IRelation.RelType.MANY_TO_MANY,
- JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testSelfBiDirRel(
+ JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
+ entity1,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -1460,14 +1630,16 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { */
@Test
public void testInheritedEntityByEntity() {
- Utils.sayTestFinished("testInheritedEntityByEntity");
+ Utils.sayTestStarted("testInheritedEntityByEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50, "Entity1");
+ SWTBotGefEditPart entity1 = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
editorProxy.createInheritedEntity(entity1, "Entity2",
- JptUiDetailsMessages.EntityUiProvider_linkLabel, false);
+ JptUiDetailsMessages.EntityUiProvider_linkLabel, false, false);
editorProxy.deleteDiagramElements();
@@ -1477,6 +1649,46 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { }
/**
+ * Create two entities in the diagram. From the "Inheritance" section of the palette
+ * select "Inherit Persistent Type". Clock on the first entity and then click on the
+ * second one. Assert that an is-a relation is created.
+ */
+ @Test
+ public void testIsARelationBetweenExistingEntities() {
+ Utils.sayTestStarted("testIsARelationBetweenExistingEntities");
+
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
+
+ SWTBotGefEditPart superclass = editorProxy.addEntityToDiagram(50, 50,
+ "Entity1");
+ String superclassName = editorProxy.getJPTObjectForGefElement(
+ superclass).getSimpleName();
+
+ SWTBotGefEditPart subclass = editorProxy.addEntityToDiagram(50, 300,
+ "Entity2");
+ String subclassName = editorProxy.getJPTObjectForGefElement(subclass)
+ .getSimpleName();
+
+ jpaDiagramEditor
+ .activateTool(JPAEditorMessages.CreateIsARelationFeature_CreateIsARelationFeatureName);
+ jpaDiagramEditor.click(superclass);
+ jpaDiagramEditor.click(subclass);
+
+ editorProxy.waitASecond();
+
+ editorProxy.testCreateAndDeleteIsARelation(superclass, subclassName,
+ JptUiDetailsMessages.EntityUiProvider_linkLabel, false,
+ superclassName, subclass, true);
+
+ editorProxy.deleteDiagramElements();
+
+ jpaDiagramEditor.save();
+
+ Utils.sayTestFinished("testIsARelationBetweenExistingEntities");
+ }
+
+ /**
* Test that the JPA Diagram editor is opened when the context menu
* "JPA Tools -> Open Diagram" of the project is called.
*/
@@ -1484,12 +1696,13 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testOpenDiagramOnProjectLevel() {
Utils.sayTestStarted("testOpenDiagramOnProjectLevel");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
workbenchBot.closeAllEditors();
// open JPA diagram editor on project level: JPA Tools -> Open Diagram
SWTBotGefEditor diagramEditor = editorProxy
- .openDiagramOnJPAProjectNode(TEST_PROJECT);
+ .openDiagramOnJPAProjectNode(TEST_PROJECT, true);
diagramEditor.close();
Utils.sayTestFinished("testOpenDiagramOnProjectLevel");
@@ -1503,12 +1716,13 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void testOpenDiagramOnJPAContentNodeLevel() {
Utils.sayTestStarted("testOpenDiagramOnJPAContentNodeLevel");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
workbenchBot.closeAllEditors();
// open JPA diagram editor on JPA content level: Open Diagram
SWTBotGefEditor diagramEditor = editorProxy
- .openDiagramOnJPAContentNode(TEST_PROJECT, true);
+ .openDiagramOnJPAContentNode(TEST_PROJECT);
diagramEditor.close();
Utils.sayTestFinished("testOpenDiagramOnJPAContentNodeLevel");
@@ -1518,11 +1732,13 @@ public class EntitiesInDiagramSWTBotTest extends SWTBotGefTestCase { public void tearDown() throws Exception {
editorProxy.deleteDiagramElements();
Utils.printFormatted(">>>>>>>>>>>> elements are deleted from the diagram.");
-
- ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode().getPersistenceXml().getRoot().getPersistenceUnits().iterator();
+
+ ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode()
+ .getPersistenceXml().getRoot().getPersistenceUnits().iterator();
PersistenceUnit pu = lit.next();
- Iterator<PersistentType> persistentTypesIterator = (Iterator<PersistentType>) pu.getPersistentTypes().iterator();
- while(persistentTypesIterator.hasNext()){
+ 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/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 f57cb92701..189f62a385 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,5 +1,7 @@ package org.eclipse.jpt.jpadiagrameditor.swtbot.tests.ui.editor;
+import static org.junit.Assert.assertTrue;
+
import java.util.Iterator;
import java.util.ListIterator;
@@ -11,6 +13,7 @@ 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;
@@ -34,8 +37,8 @@ import org.junit.runner.RunWith; @RunWith(SWTBotJunit4ClassRunner.class)
@SuppressWarnings("restriction")
-public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{
-
+public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase {
+
protected static String TEST_PROJECT;
protected static JPACreateFactory factory = JPACreateFactory.instance();
protected static JpaProject jpaProject;
@@ -66,14 +69,13 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ jpaProject = factory.createJPA20Project(TEST_PROJECT);
assertNotNull(jpaProject);
- jpaDiagramEditor = editorProxy
- .openDiagramOnJPAContentNode(TEST_PROJECT, true);
+ jpaDiagramEditor = editorProxy.openDiagramOnJPAProjectNode(
+ TEST_PROJECT, true);
editorProxy.setJpaDiagramEditor(jpaDiagramEditor);
Thread.sleep(2000);
}
-
/**
* Add entity to diagram and check that it contains a "Primary Key" section
* with one attribute "id" and no "Relation Attributes" and
@@ -83,7 +85,8 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testAddMappedSuperclass() {
Utils.sayTestStarted("testAddMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
@@ -96,18 +99,20 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ Utils.sayTestFinished("testAddMappedSuperclass");
}
-
+
/**
- * Remove a mapped superclass from the diagram using the entity's context button
- * "Delete"
+ * Remove a mapped superclass from the diagram using the entity's context
+ * button "Delete"
*/
@Test
public void testRemoveEntityViaButton() {
Utils.sayTestStarted("testRemoveEntityViaButton");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.deleteJPTViaButton(mappedSuperclass);
@@ -118,16 +123,18 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Remove a mapped superclass from the diagram using the entity's context menu
- * "Delete"
+ * Remove a mapped superclass from the diagram using the entity's context
+ * menu "Delete"
*/
@Test
public void testRemoveEntityViaContextMenu() {
Utils.sayTestStarted("testRemoveEntityViaContextMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.deleteJPTViaMenu(mappedSuperclass);
@@ -138,20 +145,25 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Adds a new attribute to the mapped superclass using the entity's context button
- * "Create Attribute"
+ * Adds a new attribute to the mapped superclass using the entity's context
+ * button "Create Attribute"
*/
@Test
public void testAddAttribute() {
Utils.sayTestStarted("testAddAttribute");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
assertFalse(
"\"Other Attributes\" section must not be visible!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes, mappedSuperclass));
+ editorProxy
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ mappedSuperclass));
editorProxy.addAttributeToJPT(mappedSuperclass, "attribute1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
@@ -162,18 +174,23 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ Utils.sayTestFinished("testAddAttribute");
}
-
+
@Test
- public void testAddElementCollectionAttributeToMappedSuperclass(){
+ public void testAddElementCollectionAttributeToMappedSuperclass() {
Utils.sayTestStarted("testAddElementCollectionAttributeToMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart entity = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart entity = editorProxy.addMappedSuperclassToDiagram(50,
+ 50, "MpdSuprcls1");
assertFalse(
"\"Other Attributes\" section must not be visible!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes, entity));
+ editorProxy
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ entity));
editorProxy.addElementCollectionAttributeToJPT(entity, "attribute1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
@@ -192,9 +209,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testRemoveAttributeViaContextButton() {
Utils.sayTestStarted("testRemoveAttributeViaContextButton");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.removeAttributeViaButton(mappedSuperclass, "attribute1");
@@ -212,9 +231,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testRemoveAttributeViaMenu() {
Utils.sayTestStarted("testRemoveAttributeViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.removeAttributeViaMenu(mappedSuperclass, "attribute1");
@@ -232,9 +253,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testDirectEditingAttribute() {
Utils.sayTestStarted("testDirectEditingAttribute");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.directEditAttribute(mappedSuperclass, "attribute1");
@@ -254,9 +277,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testDirectEditingEntity() {
Utils.sayTestStarted("testDirectEditingEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
@@ -265,7 +290,8 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ jpaDiagramEditor.directEditType("NewEntityName");
editorProxy.moveMouse(0, 0);
- SWTBotGefEditPart oldMappedSuperclass = jpaDiagramEditor.getEditPart("MpdSuprcls1");
+ SWTBotGefEditPart oldMappedSuperclass = jpaDiagramEditor
+ .getEditPart("MpdSuprcls1");
SWTBotGefEditPart newMappedSuperclass = jpaDiagramEditor
.getEditPart("NewEntityName");
assertNotNull("The entity must be renamed!", newMappedSuperclass);
@@ -280,17 +306,19 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Test that the source of the mapped superclass is opened, when is double clicked on
- * it
+ * Test that the source of the mapped superclass is opened, when is double
+ * clicked on it
*/
@Ignore
@Test
public void testDoubleClickOnEntity() {
Utils.sayTestStarted("testDoubleClickOnEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
assertTrue("Editor must be dirty", jpaDiagramEditor.isDirty());
editorProxy.moveMouse(100, 70);
jpaDiagramEditor.doubleClick(mappedSuperclass);
@@ -314,20 +342,28 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testChangeAttributeType() {
Utils.sayTestStarted("testChangeAttributeType");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- assertFalse("\"Other Attributes\" section must not be visible!",
- editorProxy.isSectionVisible(JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes, mappedSuperclass));
+ assertFalse(
+ "\"Other Attributes\" section must not be visible!",
+ editorProxy
+ .isSectionVisible(
+ JPAEditorMessages.AddJPAEntityFeature_basicAttributesShapes,
+ mappedSuperclass));
- SWTBotGefEditPart attribute = editorProxy.addAttributeToJPT(mappedSuperclass, "attribute1");
+ SWTBotGefEditPart attribute = editorProxy.addAttributeToJPT(
+ mappedSuperclass, "attribute1");
assertNotNull("The attribute must not be renamed!", attribute);
-
+
final IFeatureProvider fp = ((DiagramEditPart) jpaDiagramEditor
.mainEditPart().part()).getFeatureProvider();
- String currentAttributeType = editorProxy.getAttributeType("attribute1", fp);
+ String currentAttributeType = editorProxy.getAttributeType(
+ "attribute1", fp);
assertEquals("java.lang.String", currentAttributeType);
SWTBotShell changeTypeDialog = editorProxy
@@ -351,7 +387,8 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ assertEquals("The attribute type must not be changed!",
"java.lang.String", currentAttributeType);
- changeTypeDialog = editorProxy.getSelectNewAttributeTypeDialog(attribute);
+ changeTypeDialog = editorProxy
+ .getSelectNewAttributeTypeDialog(attribute);
attributeType = editorProxy.getNewTypeInputField(changeTypeDialog);
// change the attribute type to int
@@ -386,9 +423,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testRenameEntityViaMenu() {
Utils.sayTestStarted("testRenameEntityViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
mappedSuperclass.click();
jpaDiagramEditor
@@ -432,9 +471,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testMoveEntityViaMenu() throws JavaModelException {
Utils.sayTestStarted("testMoveEntityViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
JpaArtifactFactory factory = JpaArtifactFactory.instance();
String packageName = factory
@@ -474,12 +515,14 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testCollapseExapandEntityViaContextButton() {
Utils.sayTestStarted("testCollapseExapandEntityViaContextButton");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.addAttributeToJPT(mappedSuperclass, "attribute1");
-
+
editorProxy.collapseExpandJPTViaButton(mappedSuperclass);
editorProxy.deleteDiagramElements();
@@ -495,12 +538,14 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testCollapseExapandEntityViaMenu() {
Utils.sayTestStarted("testCollapseExapandEntityViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.addAttributeToJPT(mappedSuperclass, "attribute1");
-
+
editorProxy.collapseExpandJPTViaMenu(mappedSuperclass);
editorProxy.deleteDiagramElements();
@@ -518,9 +563,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testDiscardChanges() {
Utils.sayTestStarted("testDiscardChanges");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(200, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(200, 50, "MpdSuprcls1");
editorProxy.discardChanges(mappedSuperclass, "attribute1");
@@ -531,8 +578,9 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Add a new attribute without saving the mapped superclass and call the mapped superclass'es
- * context menu "Remove All Entities from Diagram -> ... and Discard
+ * Add a new attribute without saving the mapped superclass and call the
+ * mapped superclass'es context menu "Remove All Entities from Diagram ->
+ * ... and Discard
* Changes" context menu. Assert that the diagram is empty. Call "Show All
* Entities" context menu and assert that the newly added attribute is
* removed and the mapped superclass does not contain unsaved changes.
@@ -541,11 +589,14 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testRemoveAndDiscardChangesViaMenu() {
Utils.sayTestStarted("testRemoveAndDiscardChangesViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- editorProxy.removeAndDiscardChangesViaMenu(mappedSuperclass, "attribute1");
+ editorProxy.removeAndDiscardChangesViaMenu(mappedSuperclass,
+ "attribute1");
mappedSuperclass.click();
editorProxy.deleteDiagramElements();
@@ -555,8 +606,9 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Add a new attribute without saving the mapped superclass and call the mapped superclass'es
- * context menu "Remove All Entities from Diagram -> ... and Save
+ * Add a new attribute without saving the mapped superclass and call the
+ * mapped superclass'es context menu "Remove All Entities from Diagram ->
+ * ... and Save
* Changes" context menu. Assert that the diagram is empty. Call "Show All
* Entities" context menu and assert that the newly added attribute is added
* and the mapped superclass does not contain unsaved changes.
@@ -565,9 +617,11 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testRemoveAndSaveChangesViaMenu() {
Utils.sayTestStarted("testRemoveAndSaveChangesViaMenu");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.removeAndSaveChangesViaMenu(mappedSuperclass, "attribute1");
@@ -579,17 +633,20 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Add a new attribute to the mapped superclass. From the mapped superclass'es context menu select
- * "Save". Assert that the mapped superclass does not contain any unsaved changes, but
- * the diagram editor is still dirty.
+ * Add a new attribute to the mapped superclass. From the mapped
+ * superclass'es context menu select "Save". Assert that the mapped
+ * superclass does not contain any unsaved changes, but the diagram editor
+ * is still dirty.
*/
@Test
public void testSaveOnlyEntity() {
Utils.sayTestStarted("testSaveOnlyEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy.saveOnlyJPT(mappedSuperclass, "attribute1");
editorProxy.deleteDiagramElements();
@@ -606,13 +663,15 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testInheritedEntityByMappedSuperclass() {
Utils.sayTestStarted("testInheritedEntityByMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart mappedSuperclass = editorProxy
.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- editorProxy.createInheritedEntity(mappedSuperclass, "Entity1",
- JptUiDetailsMessages.MappedSuperclassUiProvider_linkLabel, true);
+ editorProxy.createInheritedEntity(mappedSuperclass, "Entity1",
+ JptUiDetailsMessages.MappedSuperclassUiProvider_linkLabel,
+ true, false);
editorProxy.deleteDiagramElements();
@@ -622,6 +681,107 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
+ * Create one entity and one mapped superclass in the diagram. From the
+ * "Inheritance" section of the palette select "Inherit Persistent Type".
+ * Click on the entity and then click on the mapped superclass. Assert that
+ * an is-a relation is created.
+ */
+ @Test
+ public void testIsARelationBetweenExistingEntityAndMappedSuperclass() {
+ Utils.sayTestStarted("testIsARelationBetweenExistingEntityAndMappedSuperclass");
+
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
+
+ SWTBotGefEditPart superclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ String superclassName = editorProxy.getJPTObjectForGefElement(
+ superclass).getSimpleName();
+
+ SWTBotGefEditPart subclass = editorProxy.addEntityToDiagram(50, 300,
+ "Entity1");
+ String subclassName = editorProxy.getJPTObjectForGefElement(subclass)
+ .getSimpleName();
+
+ jpaDiagramEditor
+ .activateTool(JPAEditorMessages.CreateIsARelationFeature_CreateIsARelationFeatureName);
+ jpaDiagramEditor.click(superclass);
+ jpaDiagramEditor.click(subclass);
+
+ editorProxy.waitASecond();
+
+ editorProxy.testCreateAndDeleteIsARelation(superclass, subclassName,
+ JptUiDetailsMessages.MappedSuperclassUiProvider_linkLabel,
+ true, superclassName, subclass, false);
+
+ editorProxy.deleteDiagramElements();
+
+ jpaDiagramEditor.save();
+
+ Utils.sayTestFinished("testIsARelationBetweenExistingEntityAndMappedSuperclass");
+ }
+
+ /**
+ * Create one entity and one mapped superclass in the diagram. From the
+ * "Inheritance" section of the palette select "Inherit Persistent Type".
+ * Click on the entity and then click on the mapped superclass. Assert that
+ * an is-a relation is created. Add new entity in the diagram. Try to create
+ * new is-a relation between the the second entity and the first one.
+ * Assert that no connection is created. Try to create new is-a relation between
+ * the first entity and the second one. Assert that a new connecton is created
+ * in the diagram.
+ */
+ @Test
+ public void testNoIsARelationIsCreated() {
+ Utils.sayTestStarted("testNoIsARelationIsCreated");
+
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
+
+ SWTBotGefEditPart superclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ String superclassName = editorProxy.getJPTObjectForGefElement(
+ superclass).getSimpleName();
+
+ SWTBotGefEditPart subclass = editorProxy.addEntityToDiagram(50, 300,
+ "Entity1");
+ String subclassName = editorProxy.getJPTObjectForGefElement(subclass)
+ .getSimpleName();
+
+ jpaDiagramEditor
+ .activateTool(JPAEditorMessages.CreateIsARelationFeature_CreateIsARelationFeatureName);
+ jpaDiagramEditor.click(superclass);
+ jpaDiagramEditor.click(subclass);
+
+ editorProxy.waitASecond();
+
+ editorProxy.testIsARelationProperties(superclass, subclassName,
+ JptUiDetailsMessages.MappedSuperclassUiProvider_linkLabel,
+ true, superclassName, subclass, false);
+
+ SWTBotGefEditPart secondSuperclass = editorProxy.addEntityToDiagram(
+ 300, 50, "Entity2");
+
+ jpaDiagramEditor
+ .activateTool(JPAEditorMessages.CreateIsARelationFeature_CreateIsARelationFeatureName);
+ jpaDiagramEditor.click(secondSuperclass);
+ jpaDiagramEditor.click(subclass);
+
+ editorProxy.waitASecond();
+
+ assertTrue("There is no connection created.", secondSuperclass
+ .targetConnections().isEmpty());
+ assertTrue("There is no connection created.", secondSuperclass
+ .sourceConnections().isEmpty());
+
+ editorProxy.deleteDiagramElements();
+
+ jpaDiagramEditor.save();
+
+ Utils.sayTestFinished("testNoIsARelationIsCreated");
+ }
+
+ /**
* Tests that the creation of a one-to-one unidirectional relationship from
* mapped superclass to entity is possible.
*/
@@ -629,16 +789,24 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testOneToOneUniDirRelFromMappedSuperclass() {
Utils.sayTestStarted("testOneToOneUniDirRelFromMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200, "Entity1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ "Entity1");
// create One-to-One unidirectional relation from the mapped superclass
// to entity
- editorProxy.testUniDirRelation(JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName, mappedSuperclass,
- entity, IRelation.RelType.ONE_TO_ONE, JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
+ mappedSuperclass,
+ entity,
+ IRelation.RelType.ONE_TO_ONE,
+ JptUiDetailsMessages.OneToOneMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -646,7 +814,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ Utils.sayTestFinished("testOneToOneUniDirRelFromMappedSuperclass");
}
-
+
/**
* Tests that the creation of a one-to-many unidirectional relationship from
* mapped superclass to entity is possible.
@@ -655,16 +823,24 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testOneToManyUniDirRelFromMappedSuperclass() {
Utils.sayTestStarted("testOneToManyUniDirRelFromMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200, "Entity1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ "Entity1");
// create One-to-many unidirectional relation from the mapped superclass
// to entity1
- editorProxy.testUniDirRelation(JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName, mappedSuperclass,
- entity, IRelation.RelType.ONE_TO_MANY, JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateOneToManyUniDirRelationFeature_oneToManyUniDirFeatureName,
+ mappedSuperclass,
+ entity,
+ IRelation.RelType.ONE_TO_MANY,
+ JptUiDetailsMessages.OneToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -672,7 +848,7 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ Utils.sayTestFinished("testOneToManyUniDirRelFromMappedSuperclass");
}
-
+
/**
* Tests that the creation of a many-to-one unidirectional relationship from
* mapped superclass to entity is possible.
@@ -681,16 +857,24 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testManyToOneUniDirRelFromMappedSuperclass() {
Utils.sayTestStarted("testManyToOneUniDirRelFromMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200, "Entity1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ "Entity1");
// create Many-to-One unidirectional relation from the mapped superclass
// to entity1
- editorProxy.testUniDirRelation(JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName, mappedSuperclass,
- entity, IRelation.RelType.MANY_TO_ONE, JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
+ mappedSuperclass,
+ entity,
+ IRelation.RelType.MANY_TO_ONE,
+ JptUiDetailsMessages.ManyToOneMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -698,25 +882,34 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ Utils.sayTestFinished("testManyToOneUniDirRelFromMappedSuperclass");
}
-
+
/**
- * Tests that the creation of a many-to-many unidirectional relationship from
- * mapped superclass to entity is possible.
+ * Tests that the creation of a many-to-many unidirectional relationship
+ * from mapped superclass to entity is possible.
*/
@Test
public void testManyToManyUniDirRelFromMappedSuperclass() {
Utils.sayTestStarted("testManyToManyUniDirRelFromMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
- SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200, "Entity1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
+ SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
+ "Entity1");
- // create Many-to-Many unidirectional relation from the mapped superclass
+ // create Many-to-Many unidirectional relation from the mapped
+ // superclass
// to entity1
- editorProxy.testUniDirRelation(JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName, mappedSuperclass,
- entity, IRelation.RelType.MANY_TO_MANY, JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
+ editorProxy
+ .testUniDirRelation(
+ JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
+ mappedSuperclass,
+ entity,
+ IRelation.RelType.MANY_TO_MANY,
+ JptUiDetailsMessages.ManyToManyMappingUiProvider_linkLabel);
editorProxy.deleteDiagramElements();
@@ -724,31 +917,32 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ Utils.sayTestFinished("testManyToManyUniDirRelFromMappedSuperclass");
}
-
+
/**
- * Test no one-to-one unidirectional or bidirectional relationship from entity to
- * mapped superclass is created.
+ * Test no one-to-one unidirectional or bidirectional relationship from
+ * entity to mapped superclass is created.
*/
@Test
public void testOneToOneRelationFromEntityToMappedSuperclass() {
Utils.sayTestStarted("testOneToOneRelationFromEntityToMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
"Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy
.testNoConnectionIsCreated(
JPAEditorMessages.CreateOneToOneUniDirRelationFeature_oneToOneUniDirFeatureName,
0, entity, mappedSuperclass);
-
+
editorProxy
- .testNoConnectionIsCreated(
- JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
- 1, entity, mappedSuperclass);
+ .testNoConnectionIsCreated(
+ JPAEditorMessages.CreateOneToOneBiDirRelationFeature_oneToOneBiDirFeatureName,
+ 1, entity, mappedSuperclass);
editorProxy.deleteDiagramElements();
jpaDiagramEditor.save();
@@ -764,12 +958,13 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testOneToOneBiDirRelationFromMappedSuperclassToEntity() {
Utils.sayTestStarted("testOneToOneBiDirRelationFromMappedSuperclassToEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
"Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy
.testNoConnectionIsCreated(
@@ -783,19 +978,20 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Test no one-to-many unidirectional relationship from entity to
- * mapped superclass is created.
+ * Test no one-to-many unidirectional relationship from entity to mapped
+ * superclass is created.
*/
@Test
public void testOneToManyUniDirRelationFromEntityToMappedSuperclass() {
Utils.sayTestStarted("testOneToManyUniDirRelationFromEntityToMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
"Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy
.testNoConnectionIsCreated(
@@ -809,29 +1005,30 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Test no many-to-one unidirectional or bidirectional relationship from entity to
- * mapped superclass is created.
+ * Test no many-to-one unidirectional or bidirectional relationship from
+ * entity to mapped superclass is created.
*/
@Test
public void testManyToOneRelationFromEntityToMappedSuperclass() {
Utils.sayTestStarted("testManyToOneRelationFromEntityToMappedSuperclass");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
"Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy
.testNoConnectionIsCreated(
JPAEditorMessages.CreateManyToOneUniDirRelationFeature_manyToOneUniDirFeatureName,
0, entity, mappedSuperclass);
-
+
editorProxy
- .testNoConnectionIsCreated(
- JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
- 1, entity, mappedSuperclass);
+ .testNoConnectionIsCreated(
+ JPAEditorMessages.CreateManyToOneBiDirRelationFeature_manyToOneBiDirFeatureName,
+ 1, entity, mappedSuperclass);
editorProxy.deleteDiagramElements();
jpaDiagramEditor.save();
@@ -847,12 +1044,13 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testManyToOneBiDirRelationFromMappedSuperclassToEntity() {
Utils.sayTestStarted("testManyToOneBiDirRelationFromMappedSuperclassToEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
"Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy
.testNoConnectionIsCreated(
@@ -866,29 +1064,30 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ }
/**
- * Test no many-to-many unidirectional or bidirectional relationship from entity to
- * mapped superclass is created.
+ * Test no many-to-many unidirectional or bidirectional relationship from
+ * entity to mapped superclass is created.
*/
@Test
public void testManyToManyUniDirRelationFromEntityToEmbeddable() {
Utils.sayTestStarted("testManyToManyUniDirRelationFromEntityToEmbeddable");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
"Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy
.testNoConnectionIsCreated(
JPAEditorMessages.CreateManyToManyUniDirRelationFeature_manyToManyUniDirFeatureName,
0, entity, mappedSuperclass);
-
+
editorProxy
- .testNoConnectionIsCreated(
- JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
- 1, entity, mappedSuperclass);
+ .testNoConnectionIsCreated(
+ JPAEditorMessages.CreateManyToManyBiDirRelationFeature_manyToManyBiDirFeatureName,
+ 1, entity, mappedSuperclass);
editorProxy.deleteDiagramElements();
jpaDiagramEditor.save();
@@ -904,12 +1103,13 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ public void testManyToManyBiDirRelationFromMappedSuperclassToEntity() {
Utils.sayTestStarted("testManyToManyBiDirRelationFromMappedSuperclassToEntity");
- assertTrue("The diagram must be empty.", jpaDiagramEditor.mainEditPart().children().isEmpty());
+ assertTrue("The diagram must be empty.", jpaDiagramEditor
+ .mainEditPart().children().isEmpty());
SWTBotGefEditPart entity = editorProxy.addEntityToDiagram(50, 200,
"Entity1");
- SWTBotGefEditPart mappedSuperclass = editorProxy.addMappedSuperclassToDiagram(50,
- 50, "MpdSuprcls1");
+ SWTBotGefEditPart mappedSuperclass = editorProxy
+ .addMappedSuperclassToDiagram(50, 50, "MpdSuprcls1");
editorProxy
.testNoConnectionIsCreated(
@@ -921,16 +1121,18 @@ public class MappedSuperclassesInDiagramSWTBotTest extends SWTBotGefTestCase{ Utils.sayTestFinished("testManyToManyBiDirRelationFromMappedSuperclassToEntity");
}
-
+
@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();
+
+ ListIterator<PersistenceUnit> lit = jpaProject.getRootContextNode()
+ .getPersistenceXml().getRoot().getPersistenceUnits().iterator();
PersistenceUnit pu = lit.next();
- Iterator<PersistentType> persistentTypesIterator = (Iterator<PersistentType>) pu.getPersistentTypes().iterator();
- while(persistentTypesIterator.hasNext()){
+ Iterator<PersistentType> persistentTypesIterator = (Iterator<PersistentType>) pu
+ .getPersistentTypes().iterator();
+ while (persistentTypesIterator.hasNext()) {
Utils.printFormatted(">>>>>>>>>>>>>> persistent type resource must be deleted.");
PersistentType type = persistentTypesIterator.next();
|