Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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/AccessCollectorTest.java108
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessDataTest.java118
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessFilterChainTest.java103
-rw-r--r--plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/PermissionTest.java33
4 files changed, 0 insertions, 362 deletions
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessCollectorTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessCollectorTest.java
deleted file mode 100644
index ebbfcc4555..0000000000
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessCollectorTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Created on Jul 20, 2010
- *
- * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
- */
-package org.eclipse.osee.framework.access.test.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import junit.framework.Assert;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.model.DefaultBasicArtifact;
-import org.eclipse.osee.framework.core.model.IBasicArtifact;
-import org.eclipse.osee.framework.core.model.access.exp.AccessCollector;
-import org.eclipse.osee.framework.core.model.access.exp.ArtifactAccessFilter;
-import org.eclipse.osee.framework.core.model.access.exp.AttributeTypeAccessFilter;
-import org.eclipse.osee.framework.core.model.access.exp.BranchAccessFilter;
-import org.eclipse.osee.framework.core.model.access.exp.IAccessFilter;
-import org.junit.Test;
-
-/**
- * @author Jeff C. Phillips
- */
-public class AccessCollectorTest {
-
- @Test
- public void testAttrUseCase() {
- IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "123");
- IAttributeType wordAttrType = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
- IAttributeType phoneType = CoreAttributeTypes.PHONE;
- List<IAccessFilter> filters = new ArrayList<IAccessFilter>();
-
- BranchAccessFilter branchAccessFilter = new BranchAccessFilter(basicArtifact, PermissionEnum.READ);
- ArtifactAccessFilter artifactAccessFilter = new ArtifactAccessFilter(basicArtifact, PermissionEnum.WRITE);
- AttributeTypeAccessFilter wordTypeFilter =
- new AttributeTypeAccessFilter(PermissionEnum.WRITE, basicArtifact, wordAttrType);
- AttributeTypeAccessFilter phoneTypeFilter =
- new AttributeTypeAccessFilter(PermissionEnum.READ, basicArtifact, phoneType);
-
- filters.add(artifactAccessFilter);
- filters.add(branchAccessFilter);
- filters.add(phoneTypeFilter);
- filters.add(wordTypeFilter);
-
- AccessCollector<IAttributeType> collector = new AccessCollector<IAttributeType>(filters);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.WRITE).size() == 1);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.READ).size() == 2);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.DENY).isEmpty());
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.FULLACCESS).isEmpty());
- }
-
- @Test
- public void testAttrUseCaseMissingBranchFilters() {
- IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "123");
- IAttributeType wordAttrType = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
- IAttributeType phoneType = CoreAttributeTypes.PHONE;
- List<IAccessFilter> filters = new ArrayList<IAccessFilter>();
-
- AttributeTypeAccessFilter wordTypeFilter =
- new AttributeTypeAccessFilter(PermissionEnum.WRITE, basicArtifact, wordAttrType);
- AttributeTypeAccessFilter phoneTypeFilter =
- new AttributeTypeAccessFilter(PermissionEnum.READ, basicArtifact, phoneType);
-
- filters.add(phoneTypeFilter);
- filters.add(wordTypeFilter);
-
- AccessCollector<IAttributeType> collector = new AccessCollector<IAttributeType>(filters);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.WRITE).size() == 1);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.READ).size() == 2);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.DENY).isEmpty());
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.FULLACCESS).isEmpty());
- }
-
- @Test
- public void testAttrUseCaseMissingAttrFilters() {
- IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "123");
- IAttributeType wordAttrType = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
- IAttributeType phoneType = CoreAttributeTypes.PHONE;
- List<IAccessFilter> filters = new ArrayList<IAccessFilter>();
-
- BranchAccessFilter branchAccessFilter = new BranchAccessFilter(basicArtifact, PermissionEnum.READ);
- ArtifactAccessFilter artifactAccessFilter = new ArtifactAccessFilter(basicArtifact, PermissionEnum.WRITE);
-
- filters.add(artifactAccessFilter);
- filters.add(branchAccessFilter);
-
- AccessCollector<IAttributeType> collector = new AccessCollector<IAttributeType>(filters);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.WRITE).size() == 2);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.READ).size() == 2);
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.DENY).isEmpty());
- Assert.assertTrue(collector.getAttributeTypesToMatch(basicArtifact, Arrays.asList(wordAttrType, phoneType),
- PermissionEnum.FULLACCESS).isEmpty());
- }
-}
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
deleted file mode 100644
index 7039e64984..0000000000
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessDataTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * 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 org.eclipse.osee.framework.core.model.access.AccessData;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * Test Case for {@link AccessData}
- *
- * @author Jeff C. Phillips
- */
-public class AccessDataTest {
-
- @Ignore
- @Test
- public void testObjectBase() {
- }
-
- // @Test
- // public void testObjectBase() {
- // AccessData accessData = new AccessData();
- // 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.matchesAll(PermissionEnum.READ));
- // Assert.assertFalse(accessData.matchesAll(PermissionEnum.WRITE));
- // }
- //
- // @Test
- // public void testObjectBaseDeny() {
- // AccessData accessData = new AccessData();
- // 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.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());
- // }
- //
- // @Test
- // public void testMerge() {
- // AccessData mainAccessData = new AccessData();
- // AccessData subAccessData = new AccessData();
- //
- // IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "Name");
- // mainAccessData.add(basicArtifact, CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.READ);
- // subAccessData.add(basicArtifact, CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.WRITE);
- // mainAccessData.merge(subAccessData);
- //
- // Assert.assertTrue(!mainAccessData.getArtifactTypeMatches(basicArtifact,
- // CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.READ).isEmpty());
- //
- // IBasicArtifact<?> basicArtifact2 = new DefaultBasicArtifact(2, "2", "NameTwo");
- // mainAccessData.add(basicArtifact2, CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.WRITE);
- // subAccessData.add(basicArtifact2, CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.READ);
- //
- // mainAccessData.merge(subAccessData);
- //
- // Assert.assertTrue(!mainAccessData.getArtifactTypeMatches(basicArtifact2,
- // CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.READ).isEmpty());
- //
- // mainAccessData.add(basicArtifact2, CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.WRITE);
- // subAccessData.add(basicArtifact2, CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.DENY);
- //
- // mainAccessData.merge(subAccessData);
- //
- // Assert.assertFalse(!mainAccessData.getArtifactTypeMatches(basicArtifact2,
- // CoreArtifactTypes.AbstractSoftwareRequirement, PermissionEnum.READ).isEmpty());
- // }
-
-}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessFilterChainTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessFilterChainTest.java
deleted file mode 100644
index a132582c1a..0000000000
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/AccessFilterChainTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * 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 junit.framework.Assert;
-import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-import org.eclipse.osee.framework.core.model.DefaultBasicArtifact;
-import org.eclipse.osee.framework.core.model.IBasicArtifact;
-import org.eclipse.osee.framework.core.model.access.exp.AccessFilterChain;
-import org.eclipse.osee.framework.core.model.access.exp.ArtifactAccessFilter;
-import org.eclipse.osee.framework.core.model.access.exp.AttributeTypeAccessFilter;
-import org.eclipse.osee.framework.core.model.access.exp.BranchAccessFilter;
-import org.junit.Test;
-
-/**
- * Test Case for {@link AccessFilterChain}
- *
- * @author Jeff C. Phillips
- */
-public class AccessFilterChainTest {
-
- @Test
- public void testUseCase() {
- //Can we edit this attribute on an artifact
- AccessFilterChain chain = new AccessFilterChain();
- IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "123");
- IAttributeType attributeType = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
-
- BranchAccessFilter branchAccessFilter = new BranchAccessFilter(basicArtifact, PermissionEnum.READ);
- ArtifactAccessFilter artifactAccessFilter = new ArtifactAccessFilter(basicArtifact, PermissionEnum.WRITE);
- AttributeTypeAccessFilter attributeTypeAccessFilter =
- new AttributeTypeAccessFilter(PermissionEnum.DENY, basicArtifact, attributeType);
-
- chain.add(artifactAccessFilter);
- chain.add(branchAccessFilter);
- chain.add(attributeTypeAccessFilter);
-
- PermissionEnum agrPermission = null;
- Assert.assertFalse(chain.doFilter(basicArtifact, attributeTypeAccessFilter, PermissionEnum.WRITE, agrPermission));
- Assert.assertTrue(chain.doFilter(basicArtifact, basicArtifact, PermissionEnum.WRITE, agrPermission));
- }
-
- @Test
- public void testWrongArtifactUseCase() {
- AccessFilterChain chain = new AccessFilterChain();
- IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "123");
- IBasicArtifact<?> basicArtifact2 = new DefaultBasicArtifact(2, "2", "456");
- IAttributeType attributeType = CoreAttributeTypes.WORD_TEMPLATE_CONTENT;
-
- BranchAccessFilter branchAccessFilter = new BranchAccessFilter(basicArtifact, PermissionEnum.READ);
- ArtifactAccessFilter artifactAccessFilter = new ArtifactAccessFilter(basicArtifact, PermissionEnum.WRITE);
- AttributeTypeAccessFilter attributeTypeAccessFilter =
- new AttributeTypeAccessFilter(PermissionEnum.DENY, basicArtifact, attributeType);
-
- chain.add(artifactAccessFilter);
- chain.add(branchAccessFilter);
- chain.add(attributeTypeAccessFilter);
-
- PermissionEnum agrPermission = null;
- Assert.assertFalse(chain.doFilter(basicArtifact2, attributeTypeAccessFilter, PermissionEnum.WRITE, agrPermission));
- }
-
- @Test
- public void testChain() {
- AccessFilterChain chain = new AccessFilterChain();
- IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "123");
-
- BranchAccessFilter branchAccessFilter = new BranchAccessFilter(basicArtifact, PermissionEnum.READ);
- ArtifactAccessFilter artifactAccessFilter = new ArtifactAccessFilter(basicArtifact, PermissionEnum.WRITE);
-
- chain.add(artifactAccessFilter);
- chain.add(branchAccessFilter);
-
- PermissionEnum agrPermission = null;
- Assert.assertTrue(chain.doFilter(basicArtifact, basicArtifact, PermissionEnum.READ, agrPermission));
- Assert.assertTrue(chain.doFilter(basicArtifact, basicArtifact, PermissionEnum.WRITE, agrPermission));
- }
-
- @Test
- public void testChainDeny() {
- AccessFilterChain chain = new AccessFilterChain();
- IBasicArtifact<?> basicArtifact = new DefaultBasicArtifact(1, "1", "123");
- BranchAccessFilter branchAccessFilter = new BranchAccessFilter(basicArtifact, PermissionEnum.DENY);
- ArtifactAccessFilter artifactAccessFilter = new ArtifactAccessFilter(basicArtifact, PermissionEnum.WRITE);
-
- chain.add(artifactAccessFilter);
- chain.add(branchAccessFilter);
-
- PermissionEnum agrPermission = null;
- Assert.assertFalse(chain.doFilter(basicArtifact, basicArtifact, PermissionEnum.READ, agrPermission));
- Assert.assertFalse(chain.doFilter(basicArtifact, basicArtifact, PermissionEnum.WRITE, agrPermission));
- }
-}
diff --git a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/PermissionTest.java b/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/PermissionTest.java
deleted file mode 100644
index 71137a2414..0000000000
--- a/plugins/org.eclipse.osee.framework.access.test/src/org/eclipse/osee/framework/access/test/internal/PermissionTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.osee.framework.core.enums.PermissionEnum;
-
-public class PermissionTest {
-
- public void main(String[] args) {
- PermissionEnum[] a = {PermissionEnum.DENY, PermissionEnum.FULLACCESS, null};
- PermissionEnum[] b = {PermissionEnum.LOCK, PermissionEnum.FULLACCESS, null};
- for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++) {
- PermissionEnum branchPermission = a[i];
- PermissionEnum userPermission = b[j];
- if (branchPermission == PermissionEnum.DENY || userPermission == null) {
- System.out.print("T");
- } else {
- System.out.print("F");
- }
- }
- System.out.println();
- }
- }
-}

Back to the top