Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/core/org.eclipse.papyrus.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModelWithSharedResource.java')
-rw-r--r--tests/junit/plugins/core/org.eclipse.papyrus.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModelWithSharedResource.java102
1 files changed, 102 insertions, 0 deletions
diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModelWithSharedResource.java b/tests/junit/plugins/core/org.eclipse.papyrus.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModelWithSharedResource.java
new file mode 100644
index 00000000000..55d5c267d8b
--- /dev/null
+++ b/tests/junit/plugins/core/org.eclipse.papyrus.core.tests/test/org/eclipse/papyrus/infra/core/resource/FakeModelWithSharedResource.java
@@ -0,0 +1,102 @@
+/**
+ *
+ */
+package org.eclipse.papyrus.infra.core.resource;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
+import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource.ModelKind;
+
+
+/**
+ * @author dumoulin
+ *
+ */
+public class FakeModelWithSharedResource<T extends EObject> extends AbstractModelWithSharedResource<T> {
+
+ private String identifier;
+ private String fileExtension;
+ private Class<T> expectedType;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param kind
+ * @param identifier
+ * @param fileExtension
+ * @param expectedType
+ */
+ public FakeModelWithSharedResource(ModelKind kind, String identifier, String fileExtension, Class<T> expectedType) {
+ super(kind);
+ this.identifier = identifier;
+ this.expectedType = expectedType;
+ this.fileExtension = fileExtension;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param kind
+ * @param identifier
+ * @param expectedType
+ */
+ public FakeModelWithSharedResource(ModelKind kind, String identifier, Class<T> expectedType) {
+ this(kind, identifier, "di", expectedType);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param identifier
+ * @param expectedType
+ */
+ public FakeModelWithSharedResource(String identifier, Class<T> expectedType) {
+ this(ModelKind.slave, identifier, expectedType);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ protected boolean isModelRoot(EObject object) {
+ return expectedType.isInstance(object);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
+ *
+ * @return
+ */
+ @Override
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ *
+ * @return
+ */
+ @Override
+ protected String getModelFileExtension() {
+ return fileExtension;
+ }
+
+ /**
+ * Get the associated resource.
+ * @return
+ */
+ public Resource getResouce() {
+ return resource;
+ }
+}

Back to the top