summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2011-05-31 17:18:37 (EDT)
committer Ryan D. Brooks2011-05-31 17:18:37 (EDT)
commita6413d0a0ed0042221342a9f23996dd92c077622 (patch)
treed6d64a40fc0a1c5f3882529e82f20a760649a238
parentb0979a7908542ecc876eba4919821ca1fde4a204 (diff)
downloadorg.eclipse.osee-a6413d0a0ed0042221342a9f23996dd92c077622.zip
org.eclipse.osee-a6413d0a0ed0042221342a9f23996dd92c077622.tar.gz
org.eclipse.osee-a6413d0a0ed0042221342a9f23996dd92c077622.tar.bz2
bug[bgz_346769]: AccessDetail tests failing after adding scope
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchRestrictionHandlerTest.java2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandlerTest.java4
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandlerTest.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/AccessDataTest.java5
-rw-r--r--plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/access/AccessDetail.java13
5 files changed, 14 insertions, 16 deletions
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchRestrictionHandlerTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchRestrictionHandlerTest.java
index 548fa34..06f6b1d 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchRestrictionHandlerTest.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactMatchRestrictionHandlerTest.java
@@ -69,7 +69,7 @@ public class ArtifactMatchRestrictionHandlerTest extends BaseRestrictionHandlerT
DefaultBasicArtifact expectedAccessObject = new DefaultBasicArtifact(1, GUID.create(), "Another Artifact");
MockArtifactProxy artData = new MockArtifactProxy(expectedAccessObject);
- Scope expectedScope = new Scope().add("fail");
+ Scope expectedScope = new Scope();
DslAsserts.assertAccessDetail(getRestrictionHandler(), restriction, artData, expectedAccessObject,
PermissionEnum.WRITE, expectedScope);
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandlerTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandlerTest.java
index 806916e..328082e 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandlerTest.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/ArtifactTypeRestrictionHandlerTest.java
@@ -66,7 +66,7 @@ public class ArtifactTypeRestrictionHandlerTest extends BaseRestrictionHandlerTe
ArtifactType expectedAccessObject = new ArtifactType(artifactType.getGuid(), artifactType.getName(), false);
MockArtifactProxy artData = new MockArtifactProxy(GUID.create(), expectedAccessObject);
- Scope expectedScope = new Scope().add("fail");
+ Scope expectedScope = new Scope();
DslAsserts.assertAccessDetail(getRestrictionHandler(), restriction, artData, expectedAccessObject,
PermissionEnum.WRITE, expectedScope);
}
@@ -84,7 +84,7 @@ public class ArtifactTypeRestrictionHandlerTest extends BaseRestrictionHandlerTe
new ArtifactType(CoreArtifactTypes.Requirement.getGuid(), CoreArtifactTypes.Requirement.getName(), false);
MockArtifactProxy artData = new MockArtifactProxy(GUID.create(), expectedAccessObject);
- Scope expectedScope = new Scope().add("fail");
+ Scope expectedScope = new Scope();
DslAsserts.assertNullAccessDetail(getRestrictionHandler(), restriction, artData, expectedScope);
// Make expectedAccessObject inherit from ArtifactType
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandlerTest.java b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandlerTest.java
index 1ae5b17..b68cb86 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandlerTest.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.integration.test/src/org/eclipse/osee/framework/core/dsl/integration/internal/AttributeTypeRestrictionHandlerTest.java
@@ -76,7 +76,7 @@ public class AttributeTypeRestrictionHandlerTest extends BaseRestrictionHandlerT
final MutableBoolean wasIsAttributeTypeValidCalled = new MutableBoolean(false);
ArtifactProxy artifactProxy = createArtifactProxy(null, attributeType, wasIsAttributeTypeValidCalled, true);
- Scope expectedScope = new Scope().add("fail");
+ Scope expectedScope = new Scope();
DslAsserts.assertAccessDetail(getRestrictionHandler(), restriction, artifactProxy, attributeType,
PermissionEnum.WRITE, expectedScope);
Assert.assertTrue(wasIsAttributeTypeValidCalled.getValue());
@@ -128,7 +128,7 @@ public class AttributeTypeRestrictionHandlerTest extends BaseRestrictionHandlerT
final MutableBoolean wasIsAttributeTypeValidCalled = new MutableBoolean(false);
ArtifactProxy artifactProxy =
createArtifactProxy(artArtifactType, attributeType, wasIsAttributeTypeValidCalled, true);
- Scope expectedScope = new Scope().add("fail");
+ Scope expectedScope = new Scope();
DslAsserts.assertAccessDetail(getRestrictionHandler(), restriction, artifactProxy, attributeType,
PermissionEnum.WRITE, expectedScope);
Assert.assertTrue(wasIsAttributeTypeValidCalled.getValue());
@@ -160,7 +160,7 @@ public class AttributeTypeRestrictionHandlerTest extends BaseRestrictionHandlerT
final MutableBoolean wasIsAttributeTypeValidCalled = new MutableBoolean(false);
ArtifactProxy artifactProxy =
createArtifactProxy(artArtifactType, attributeType, wasIsAttributeTypeValidCalled, true);
- Scope expectedScope = new Scope().add("fail");
+ Scope expectedScope = new Scope();
DslAsserts.assertAccessDetail(getRestrictionHandler(), restriction, artifactProxy, attributeType,
PermissionEnum.WRITE, expectedScope);
Assert.assertTrue(wasIsAttributeTypeValidCalled.getValue());
diff --git a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/AccessDataTest.java b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/AccessDataTest.java
index 1893de8..c24e565 100644
--- a/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/AccessDataTest.java
+++ b/plugins/org.eclipse.osee.framework.core.model.test/src/org/eclipse/osee/framework/core/model/access/AccessDataTest.java
@@ -27,11 +27,8 @@ 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.model.RelationTypeSide;
-import org.eclipse.osee.framework.core.model.access.AccessData;
-import org.eclipse.osee.framework.core.model.access.AccessDetail;
import org.eclipse.osee.framework.core.model.mocks.MockDataFactory;
import org.eclipse.osee.framework.core.model.mocks.ModelAsserts;
-import org.eclipse.osee.framework.core.model.access.Scope;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.jdk.core.util.Compare;
import org.eclipse.osee.framework.jdk.core.util.GUID;
@@ -149,7 +146,7 @@ public class AccessDataTest {
Assert.assertEquals(detail2.getAccessObject(), actualDetail.getAccessObject());
Assert.assertEquals(PermissionEnum.DENY, actualDetail.getPermission());
- Assert.assertEquals("item 1 - deny, item 2 - write", actualDetail.getReason());
+ Assert.assertEquals("item 1 - deny", actualDetail.getReason());
Assert.assertEquals("/same_scope", actualDetail.getScope().getPath());
}
diff --git a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/access/AccessDetail.java b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/access/AccessDetail.java
index 9e641c2..ea6aaa5 100644
--- a/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/access/AccessDetail.java
+++ b/plugins/org.eclipse.osee.framework.core.model/src/org/eclipse/osee/framework/core/model/access/AccessDetail.java
@@ -110,15 +110,16 @@ public class AccessDetail<T> { //implements Comparable<AccessDetail<?>> {
private static AccessDetail<?> getMostRestrictive(AccessDetail<?> original, AccessDetail<?> data) {
PermissionEnum origPermission = original.getPermission();
PermissionEnum newPermission = data.getPermission();
- PermissionEnum netPermission = PermissionEnum.getMostRestrictive(origPermission, newPermission);
- AccessDetail<?> toReturn;
- if (netPermission.equals(origPermission)) {
- toReturn = original;
+ AccessDetail<?> toReturn = original;
+ if (!origPermission.equals(newPermission)) {
+ PermissionEnum netPermission = PermissionEnum.getMostRestrictive(origPermission, newPermission);
+ if (netPermission.equals(newPermission)) {
+ toReturn = data;
+ }
+ } else {
String netReason = merge(toReturn.getReason(), data.getReason());
toReturn.setReason(netReason);
- } else {
- toReturn = data;
}
return toReturn;
}