Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-06-28 19:40:40 -0400
committerrescobar2010-06-28 19:40:40 -0400
commit14cba12e7808d902bb414fc9e3e427f2e7b11e4b (patch)
tree3d37663f5ed660b9f3d5b4fc7fa799b4862e07c3 /plugins/org.eclipse.osee.framework.access.test
parent5e8cbac9eb44e5a967ead12f26b10af180300256 (diff)
downloadorg.eclipse.osee-14cba12e7808d902bb414fc9e3e427f2e7b11e4b.tar.gz
org.eclipse.osee-14cba12e7808d902bb414fc9e3e427f2e7b11e4b.tar.xz
org.eclipse.osee-14cba12e7808d902bb414fc9e3e427f2e7b11e4b.zip
Diffstat (limited to 'plugins/org.eclipse.osee.framework.access.test')
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/META-INF/MANIFEST.MF5
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/AllAccessTestSuite.java (renamed from plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/AccessTestSuite.java)2
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/TestAccess.java109
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/InternalAccessTestSuite.java4
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/MockAccessCheckProvider.java18
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperation.java26
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperationTest.java56
7 files changed, 106 insertions, 114 deletions
diff --git a/plugins/org.eclipse.osee.framework.access.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.access.test/META-INF/MANIFEST.MF
index 7650428019..7d124114dc 100644
--- a/plugins/org.eclipse.osee.framework.access.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.framework.access.test/META-INF/MANIFEST.MF
@@ -2,8 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Access Test
Bundle-SymbolicName: org.eclipse.osee.framework.access.test;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 0.9.5.qualifier
Bundle-Vendor: Eclipse.org
-Fragment-Host: org.eclipse.osee.framework.access
+Fragment-Host: org.eclipse.osee.framework.access;bundle-version="0.9.5"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit4;bundle-version="4.5.0"
+Export-Package: org.eclipse.osee.framework.access.test
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/AccessTestSuite.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/AllAccessTestSuite.java
index 4c34c577c3..fcd9a49919 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/AccessTestSuite.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/AllAccessTestSuite.java
@@ -13,6 +13,6 @@ import org.junit.runners.Suite;
@Suite.SuiteClasses( { //
InternalAccessTestSuite.class, //
})
-public class AccessTestSuite {
+public class AllAccessTestSuite {
}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/TestAccess.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/TestAccess.java
deleted file mode 100644
index de629bedae..0000000000
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/TestAccess.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Created on Jun 2, 2010
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.access.test;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.osee.framework.access.OseeAccessHandler;
-import org.eclipse.osee.framework.access.OseeAccessService;
-import org.eclipse.osee.framework.access.internal.OseeAccessPoint;
-import org.eclipse.osee.framework.access.internal.OseeAccessServiceImpl;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.operation.AbstractOperation;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestAccess {
-
- @Test
- public void testAccess() throws OseeCoreException {
- OseeAccessService access = new OseeAccessServiceImpl();
- Assert.assertTrue(access.getAccessTypes().isEmpty());
-
- AccessHandler handler = new AccessHandler();
-
- access.addHandler(TestAccessPoint.TYPE, handler);
-
- Assert.assertEquals(1, access.getHandlerCount(TestAccessPoint.TYPE));
- Assert.assertFalse(access.getAccessTypes().isEmpty());
-
- access.removeHandler(TestAccessPoint.TYPE, handler);
- Assert.assertTrue(access.getAccessTypes().isEmpty());
- Assert.assertEquals(0, access.getHandlerCount(TestAccessPoint.TYPE));
-
- OseeAccessPoint<?> accessPoint = new TestAccessPoint();
- IStatus status = access.dispatch(new NullProgressMonitor(), "", accessPoint);
- // Assert.assertTrue(handler.isWasChecked());
-
- }
-
- private final static class TestAccessPoint extends OseeAccessPoint<AccessHandler> {
-
- private static final Type<AccessHandler> TYPE = new Type<AccessHandler>();
-
- @Override
- public Type<AccessHandler> getAssociatedType() {
- return TYPE;
- }
-
- //
- // @Override
- // protected void dispatch(AccessHandler handler) {
- // handler.setData("Pass In Information Here");
- // // Initialize data
- //
- // // run the rule
- //
- // }
-
- @Override
- protected IStatus dispatch(AccessHandler handler) {
- handler.create("A", "B", "C");
- return null;
- }
- }
-
- private final class AccessHandler extends AbstractOperation implements OseeAccessHandler {
-
- private final String a;
- private final String b;
-
- public AccessHandler() {
- this("", "");
- }
-
- public AccessHandler(String a, String b) {
- super("", "");
- this.a = a;
- this.b = b;
- }
-
- public IOperation create(String string, String string2, String string3) {
- return new AccessHandler();
- }
-
- @Override
- protected void doWork(IProgressMonitor monitor) throws Exception {
-
- }
-
- // Any Random data needed
- // public void setData(Object object) {
- // wasChecked = true;
- // }
-
- // public void setWasChecked(boolean wasChecked) {
- // this.wasChecked = wasChecked;
- // }
- //
- // public boolean isWasChecked() {
- // return wasChecked;
- // }
-
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/InternalAccessTestSuite.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/InternalAccessTestSuite.java
index 3011c07f4f..011a52e151 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/InternalAccessTestSuite.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/InternalAccessTestSuite.java
@@ -9,8 +9,8 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
-@Suite.SuiteClasses( { //
-//CoreServerInternalTestSuite.class, //
+@Suite.SuiteClasses({ //
+OnEditOperationTest.class, //
})
public class InternalAccessTestSuite {
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/MockAccessCheckProvider.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/MockAccessCheckProvider.java
new file mode 100644
index 0000000000..4852087945
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/MockAccessCheckProvider.java
@@ -0,0 +1,18 @@
+/*
+ * Created on Jun 24, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.access.test.internal;
+
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+import org.eclipse.osee.framework.lifecycle.IAccessCheckProvider;
+
+public class MockAccessCheckProvider implements IAccessCheckProvider {
+
+ @Override
+ public boolean canEdit(IBasicArtifact<?> user, IBasicArtifact<?> artTcheck) {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperation.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperation.java
new file mode 100644
index 0000000000..a37e7e0b19
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperation.java
@@ -0,0 +1,26 @@
+/*
+ * Created on Jun 17, 2010
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.framework.access.test.internal;
+
+import java.util.Collection;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+import org.eclipse.osee.framework.lifecycle.AbstractLifecycleOperation;
+import org.eclipse.osee.framework.lifecycle.ILifecycleService;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionCheckPoint;
+
+public class OnEditOperation extends AbstractLifecycleOperation {
+
+ public OnEditOperation(ILifecycleService service, IBasicArtifact<?> userArtifact, Collection<IBasicArtifact<?>> artsToCheck) {
+ super(service, new SkynetTransactionCheckPoint(userArtifact, artsToCheck), "On Edit Op", "TestBundle");
+ }
+
+ @Override
+ protected void doCoreWork(IProgressMonitor monitor) throws Exception {
+ System.out.println("I am going to do some edit ...");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperationTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperationTest.java
new file mode 100644
index 0000000000..72d57325e9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/OnEditOperationTest.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * 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:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.access.test.internal;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.DefaultBasicArtifact;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.LogProgressMonitor;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.lifecycle.AbstractLifecycleOperation;
+import org.eclipse.osee.framework.lifecycle.ILifecycleService;
+import org.eclipse.osee.framework.lifecycle.LifecycleServiceImpl;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransactionCheckPoint;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link AbstractLifecycleOperation}
+ *
+ * @author Roberto E. Escobar
+ * @author Jeff C. Phillips
+ */
+public class OnEditOperationTest {
+
+ @Test
+ public void testOperation() throws OseeCoreException {
+ ILifecycleService service = new LifecycleServiceImpl();
+
+// service.addHandler(ChangeMgmtChkPoint.TYPE, new ChangeMgmtHandler(new MockAccessCheckProvider()));
+
+ Assert.assertEquals(1, service.getHandlerCount(SkynetTransactionCheckPoint.TYPE));
+ Assert.assertFalse(service.getHandlerTypes().isEmpty());
+
+ IBasicArtifact<?> user = new DefaultBasicArtifact(0, "1", "user");
+ List<IBasicArtifact<?>> artsToChk = new ArrayList<IBasicArtifact<?>>();
+ artsToChk.add(new DefaultBasicArtifact(1, "2", "check me out"));
+ IOperation op = new OnEditOperation(service, user, artsToChk);
+ Operations.executeWork(op, new LogProgressMonitor(), -1.0);
+
+ IStatus status = op.getStatus();
+ Assert.assertTrue(status.isOK());
+
+ }
+}

Back to the top