Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-08-10 14:03:51 -0400
committerrescobar2010-08-10 14:03:51 -0400
commitc954f5019e576553b7f289bf530861bc7bb778dc (patch)
treec656dc3d11f21dfa4ae6fe0289818dcabea4633e /plugins/org.eclipse.osee.framework.access.test
parent4b983ab75aafc18f3f6918d671ac10a28248124b (diff)
downloadorg.eclipse.osee-c954f5019e576553b7f289bf530861bc7bb778dc.tar.gz
org.eclipse.osee-c954f5019e576553b7f289bf530861bc7bb778dc.tar.xz
org.eclipse.osee-c954f5019e576553b7f289bf530861bc7bb778dc.zip
"Team Workflow" - YGHW1 - "Block changes to requirements unless done under an appropriate action."
Diffstat (limited to 'plugins/org.eclipse.osee.framework.access.test')
-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/cm/CMAccessProviderTest.java10
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessTestSuite.java5
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessControlProviderTest.java (renamed from plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/ConfigurationManagementProviderTest.java)20
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessProviderTest.java99
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessTestSuite.java25
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagement.java4
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagementProvider.java12
8 files changed, 151 insertions, 28 deletions
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 02e5dca2589..ab8639ebf16 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
@@ -10,13 +10,13 @@
*******************************************************************************/
package org.eclipse.osee.framework.access.test.internal;
-import org.eclipse.osee.framework.access.test.internal.cm.CMAccessTestSuite;
+import org.eclipse.osee.framework.access.test.internal.cm.CmAccessTestSuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ //
-CMAccessTestSuite.class, //
+CmAccessTestSuite.class, //
OnEditOperationTest.class, //
})
public class InternalAccessTestSuite {
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessProviderTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessProviderTest.java
index 8ce25a184e6..899e9431fd5 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessProviderTest.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessProviderTest.java
@@ -14,7 +14,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.eclipse.osee.framework.access.IAccessProvider;
-import org.eclipse.osee.framework.access.internal.cm.CMAccessProvider;
+import org.eclipse.osee.framework.access.internal.cm.CmAccessProvider;
import org.eclipse.osee.framework.access.test.mocks.MockCMWithAccessModel;
import org.eclipse.osee.framework.access.test.mocks.MockConfigurationManagementProvider;
import org.eclipse.osee.framework.core.data.AccessContextId;
@@ -30,11 +30,11 @@ import org.junit.BeforeClass;
import org.junit.Test;
/**
- * Test Case for {@link CMAccessProvider}
+ * Test Case for {@link CmAccessProvider}
*
* @author Roberto E. Escobar
*/
-public class CMAccessProviderTest {
+public class CmAccessProviderTest {
private static IBasicArtifact<?> expectedUser;
private static Object expectedObject;
private static AccessContextId contextId1;
@@ -52,7 +52,7 @@ public class CMAccessProviderTest {
objects.add(expectedObject);
MockConfigurationManagementProvider cmProvider =
new MockConfigurationManagementProvider(expectedUser, expectedObject, null);
- IAccessProvider accessProvider = new CMAccessProvider(cmProvider);
+ IAccessProvider accessProvider = new CmAccessProvider(cmProvider);
AccessData accessData = new AccessData();
accessProvider.computeAccess(expectedUser, objects, accessData);
@@ -68,7 +68,7 @@ public class CMAccessProviderTest {
objects.add(expectedObject);
MockConfigurationManagementProvider cmProvider =
new MockConfigurationManagementProvider(expectedUser, expectedObject, cm);
- IAccessProvider accessProvider = new CMAccessProvider(cmProvider);
+ IAccessProvider accessProvider = new CmAccessProvider(cmProvider);
AccessData accessData = new AccessData();
accessProvider.computeAccess(expectedUser, objects, accessData);
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessTestSuite.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessTestSuite.java
index ba349a18f19..817a92ddb67 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessTestSuite.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CMAccessTestSuite.java
@@ -15,12 +15,11 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({ //
-CMAccessProviderTest.class, //
- ConfigurationManagementProviderTest.class, //
+CmAccessProviderTest.class, //
})
/**
* @author Roberto E. Escobar
*/
-public class CMAccessTestSuite {
+public class CmAccessTestSuite {
// Test Suite Class
}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/ConfigurationManagementProviderTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessControlProviderTest.java
index 572228a9133..6e6ca09f750 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/ConfigurationManagementProviderTest.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessControlProviderTest.java
@@ -12,24 +12,24 @@ package org.eclipse.osee.framework.access.test.internal.cm;
import java.util.Collection;
import java.util.HashSet;
-import org.eclipse.osee.framework.access.internal.cm.ConfigurationManagementProviderImpl;
+import org.eclipse.osee.framework.access.internal.cm.CmAccessControlProviderImpl;
import org.eclipse.osee.framework.access.test.mocks.MockConfigurationManagement;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.exception.OseeStateException;
import org.eclipse.osee.framework.core.model.IBasicArtifact;
import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
-import org.eclipse.osee.framework.core.services.ConfigurationManagement;
-import org.eclipse.osee.framework.core.services.ConfigurationManagementProvider;
+import org.eclipse.osee.framework.core.services.CmAccessControl;
+import org.eclipse.osee.framework.core.services.CmAccessControlProvider;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
- * Test Case for {@link ConfigurationManagementProvider}{@link ConfigurationManagementProviderImpl}
+ * Test Case for {@link CmAccessControlProvider}{@link CmAccessControlProviderImpl}
*
* @author Roberto E. Escobar
*/
-public class ConfigurationManagementProviderTest {
+public class CmAccessControlProviderTest {
private IBasicArtifact<?> user;
private Object objectToCheck;
@@ -66,14 +66,14 @@ public class ConfigurationManagementProviderTest {
}
private static void assertCMProvider(IBasicArtifact<?> user, Object objectToCheck, MockConfigurationManagement expectedCM, MockConfigurationManagement... extraCms) throws OseeCoreException {
- Collection<ConfigurationManagement> cmServices = new HashSet<ConfigurationManagement>();
- for (ConfigurationManagement extraCm : extraCms) {
+ Collection<CmAccessControl> cmServices = new HashSet<CmAccessControl>();
+ for (CmAccessControl extraCm : extraCms) {
cmServices.add(extraCm);
}
- ConfigurationManagementProvider provider = new ConfigurationManagementProviderImpl(cmServices);
- ConfigurationManagement actualCM = provider.getCmService(user, objectToCheck);
+ CmAccessControlProvider provider = new CmAccessControlProviderImpl(cmServices);
+ CmAccessControl actualCM = provider.getService(user, objectToCheck);
Assert.assertEquals(expectedCM, actualCM);
- for (ConfigurationManagement cmService : cmServices) {
+ for (CmAccessControl cmService : cmServices) {
MockConfigurationManagement cm = (MockConfigurationManagement) cmService;
Assert.assertTrue(cm.wasIsApplicableCalled());
}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessProviderTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessProviderTest.java
new file mode 100644
index 00000000000..899e9431fd5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessProviderTest.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cm;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import org.eclipse.osee.framework.access.IAccessProvider;
+import org.eclipse.osee.framework.access.internal.cm.CmAccessProvider;
+import org.eclipse.osee.framework.access.test.mocks.MockCMWithAccessModel;
+import org.eclipse.osee.framework.access.test.mocks.MockConfigurationManagementProvider;
+import org.eclipse.osee.framework.core.data.AccessContextId;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.IBasicArtifact;
+import org.eclipse.osee.framework.core.model.access.AccessData;
+import org.eclipse.osee.framework.core.model.access.AccessModel;
+import org.eclipse.osee.framework.core.model.test.mocks.MockDataFactory;
+import org.eclipse.osee.framework.jdk.core.util.Compare;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test Case for {@link CmAccessProvider}
+ *
+ * @author Roberto E. Escobar
+ */
+public class CmAccessProviderTest {
+ private static IBasicArtifact<?> expectedUser;
+ private static Object expectedObject;
+ private static AccessContextId contextId1;
+
+ @BeforeClass
+ public static void setup() {
+ expectedUser = MockDataFactory.createArtifact(13);
+ expectedObject = new Object();
+ contextId1 = MockDataFactory.createAccessContextId(GUID.create(), "context1");
+ }
+
+ @Test
+ public void testCmProviderReturnsNull() throws OseeCoreException {
+ Collection<Object> objects = new ArrayList<Object>();
+ objects.add(expectedObject);
+ MockConfigurationManagementProvider cmProvider =
+ new MockConfigurationManagementProvider(expectedUser, expectedObject, null);
+ IAccessProvider accessProvider = new CmAccessProvider(cmProvider);
+
+ AccessData accessData = new AccessData();
+ accessProvider.computeAccess(expectedUser, objects, accessData);
+ Assert.assertTrue(cmProvider.wasGetCMCalled());
+ }
+
+ @Test
+ public void testCmProvider() throws OseeCoreException {
+ MockAccessModel accessModel = new MockAccessModel();
+ MockCMWithAccessModel cm =
+ new MockCMWithAccessModel(accessModel, expectedUser, expectedObject, false, Collections.singleton(contextId1));
+ Collection<Object> objects = new ArrayList<Object>();
+ objects.add(expectedObject);
+ MockConfigurationManagementProvider cmProvider =
+ new MockConfigurationManagementProvider(expectedUser, expectedObject, cm);
+ IAccessProvider accessProvider = new CmAccessProvider(cmProvider);
+
+ AccessData accessData = new AccessData();
+ accessProvider.computeAccess(expectedUser, objects, accessData);
+ Assert.assertTrue(cmProvider.wasGetCMCalled());
+
+ Assert.assertTrue(accessModel.wasComputeAccessCalled);
+ Assert.assertEquals(contextId1, accessModel.contextId);
+ Assert.assertTrue(!Compare.isDifferent(objects, accessModel.objectsToCheck));
+ Assert.assertEquals(accessData, accessModel.accessData);
+ }
+
+ private final class MockAccessModel implements AccessModel {
+
+ protected boolean wasComputeAccessCalled;
+ protected AccessContextId contextId;
+ protected Collection<Object> objectsToCheck;
+ protected AccessData accessData;
+
+ @Override
+ public void computeAccess(AccessContextId contextId, Collection<Object> objectsToCheck, AccessData accessData) {
+ wasComputeAccessCalled = true;
+ this.contextId = contextId;
+ this.objectsToCheck = objectsToCheck;
+ this.accessData = accessData;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessTestSuite.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessTestSuite.java
new file mode 100644
index 00000000000..817a92ddb67
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/cm/CmAccessTestSuite.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.cm;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({ //
+CmAccessProviderTest.class, //
+})
+/**
+ * @author Roberto E. Escobar
+ */
+public class CmAccessTestSuite {
+ // Test Suite Class
+}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagement.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagement.java
index ad1b7342b3e..d3d2542a3e5 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagement.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagement.java
@@ -13,13 +13,13 @@ package org.eclipse.osee.framework.access.test.mocks;
import java.util.Collection;
import org.eclipse.osee.framework.core.data.AccessContextId;
import org.eclipse.osee.framework.core.model.IBasicArtifact;
-import org.eclipse.osee.framework.core.services.ConfigurationManagement;
+import org.eclipse.osee.framework.core.services.CmAccessControl;
import org.junit.Assert;
/**
* @author Roberto E. Escobar
*/
-public class MockConfigurationManagement implements ConfigurationManagement {
+public class MockConfigurationManagement implements CmAccessControl {
private final IBasicArtifact<?> expectedUser;
private final Object expectedObject;
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagementProvider.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagementProvider.java
index 6643b3f3dc7..2e98b8940eb 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagementProvider.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/mocks/MockConfigurationManagementProvider.java
@@ -11,20 +11,20 @@
package org.eclipse.osee.framework.access.test.mocks;
import org.eclipse.osee.framework.core.model.IBasicArtifact;
-import org.eclipse.osee.framework.core.services.ConfigurationManagement;
-import org.eclipse.osee.framework.core.services.ConfigurationManagementProvider;
+import org.eclipse.osee.framework.core.services.CmAccessControl;
+import org.eclipse.osee.framework.core.services.CmAccessControlProvider;
import org.junit.Assert;
/**
* @author Roberto E. Escobar
*/
-public class MockConfigurationManagementProvider implements ConfigurationManagementProvider {
+public class MockConfigurationManagementProvider implements CmAccessControlProvider {
private final IBasicArtifact<?> expectedUser;
private final Object expectedObject;
- private final ConfigurationManagement cmToReturn;
+ private final CmAccessControl cmToReturn;
private boolean wasGetCMCalled;
- public MockConfigurationManagementProvider(IBasicArtifact<?> expectedUser, Object expectedObject, ConfigurationManagement cmToReturn) {
+ public MockConfigurationManagementProvider(IBasicArtifact<?> expectedUser, Object expectedObject, CmAccessControl cmToReturn) {
super();
this.expectedUser = expectedUser;
this.expectedObject = expectedObject;
@@ -32,7 +32,7 @@ public class MockConfigurationManagementProvider implements ConfigurationManagem
}
@Override
- public ConfigurationManagement getCmService(IBasicArtifact<?> user, Object object) {
+ public CmAccessControl getService(IBasicArtifact<?> user, Object object) {
wasGetCMCalled = true;
Assert.assertEquals(expectedUser, user);
Assert.assertEquals(expectedObject, object);

Back to the top