Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjphillips2010-07-08 12:10:56 -0400
committerjphillips2010-07-08 12:10:56 -0400
commitb0f4f0bd73b727605eeed96f91b37588a64d41b7 (patch)
tree27509dcb537bb21bee9616dbbf08456e50d1e9a3 /plugins/org.eclipse.osee.framework.access.test
parentd8059d6ca82c4adfa63ab3c4eec1919cf0be784c (diff)
downloadorg.eclipse.osee-b0f4f0bd73b727605eeed96f91b37588a64d41b7.tar.gz
org.eclipse.osee-b0f4f0bd73b727605eeed96f91b37588a64d41b7.tar.xz
org.eclipse.osee-b0f4f0bd73b727605eeed96f91b37588a64d41b7.zip
Added functionality to AccessData as well as test
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/AccessDataTest.java43
1 files changed, 38 insertions, 5 deletions
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessDataTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessDataTest.java
index ce458c67279..02d745b1677 100644
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessDataTest.java
+++ b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessDataTest.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.access.test.internal;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.model.AccessData;
import org.eclipse.osee.framework.core.model.DefaultBasicArtifact;
@@ -27,27 +29,58 @@ public class AccessDataTest {
@Test
public void testObjectBase() {
AccessData accessData = new AccessData();
- Assert.assertFalse(accessData.matches(PermissionEnum.READ));
+ Assert.assertFalse(accessData.matchesAll(PermissionEnum.READ));
IBasicArtifact<?> basicArtifact2 = new DefaultBasicArtifact(2, "2", "Name2");
accessData.add(basicArtifact2, PermissionEnum.WRITE);
IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "Name");
accessData.add(basicArtifact, PermissionEnum.READ);
- Assert.assertTrue(accessData.matches(PermissionEnum.READ));
- Assert.assertFalse(accessData.matches(PermissionEnum.WRITE));
+ Assert.assertTrue(accessData.matchesAll(PermissionEnum.READ));
+ Assert.assertFalse(accessData.matchesAll(PermissionEnum.WRITE));
}
@Test
public void testObjectBaseDeny() {
AccessData accessData = new AccessData();
- Assert.assertFalse(accessData.matches(PermissionEnum.READ));
+ Assert.assertFalse(accessData.matchesAll(PermissionEnum.READ));
IBasicArtifact<?> basicArtifact2 = new DefaultBasicArtifact(2, "2", "Name2");
accessData.add(basicArtifact2, PermissionEnum.DENY);
IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "Name");
accessData.add(basicArtifact, PermissionEnum.READ);
- Assert.assertFalse(accessData.matches(PermissionEnum.READ));
+ Assert.assertFalse(accessData.matchesAll(PermissionEnum.READ));
+ }
+
+ @Test
+ public void testAttributeTypeFilter() {
+ AccessData accessData = new AccessData();
+ Assert.assertFalse(accessData.matchesAll(PermissionEnum.READ));
+
+ IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "Name");
+ IBasicArtifact<?> basicArtifact2 = new DefaultBasicArtifact(2, "2", "Name Two");
+ accessData.add(basicArtifact, CoreAttributeTypes.WORD_TEMPLATE_CONTENT, PermissionEnum.READ);
+ accessData.add(basicArtifact2, CoreAttributeTypes.WORD_TEMPLATE_CONTENT, PermissionEnum.WRITE);
+
+ Assert.assertTrue(!accessData.getAttributeTypeMatches(basicArtifact, CoreAttributeTypes.WORD_TEMPLATE_CONTENT,
+ PermissionEnum.READ).isEmpty());
+ Assert.assertTrue(accessData.getAttributeTypeMatches(basicArtifact, CoreAttributeTypes.WORD_TEMPLATE_CONTENT,
+ PermissionEnum.WRITE).isEmpty());
+ Assert.assertTrue(accessData.matchesAll(PermissionEnum.READ));
+ Assert.assertFalse(accessData.matchesAll(PermissionEnum.WRITE));
+ }
+
+ @Test
+ public void testArtifactTypeFilter() {
+ AccessData accessData = new AccessData();
+ Assert.assertFalse(accessData.matchesAll(PermissionEnum.READ));
+
+ IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "Name");
+ accessData.add(basicArtifact, CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.READ);
+ Assert.assertTrue(!accessData.getArtifactTypeMatches(basicArtifact,
+ CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.READ).isEmpty());
+ Assert.assertTrue(accessData.getArtifactTypeMatches(basicArtifact, CoreArtifactTypes.AbstractSoftwareRequirement,
+ PermissionEnum.WRITE).isEmpty());
}
}

Back to the top