Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.ats.test')
-rw-r--r--plugins/org.eclipse.osee.ats.test/.classpath14
-rw-r--r--plugins/org.eclipse.osee.ats.test/.project56
-rw-r--r--plugins/org.eclipse.osee.ats.test/build.properties8
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsDbInitTest.java68
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Config_Suite.java56
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Demo_Suite.java92
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Production_Suite.java46
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_TestDb_Suite.java50
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsActionableItemToTeamDefinitionTest.java86
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsBranchConfigurationTest.java898
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsImageTest.java38
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToMassEditorTest.java172
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToTaskEditorTest.java312
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToWorldViewTest.java1348
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNotifyUsersTest.java266
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsPurgeTest.java198
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsQueryPerformanceTests.java150
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsTeamDefintionToWorkflowTest.java90
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsValidateAtsDatabaseTest.java100
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsWorkItemDefinitionTest.java108
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/SMAPrintTest.java156
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/CustomizeDemoTableTestUtil.java98
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/DemoTestUtil.java300
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/NavigateTestUtil.java256
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/SMATestUtil.java72
-rw-r--r--plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/TestNotificationManager.java70
26 files changed, 2554 insertions, 2554 deletions
diff --git a/plugins/org.eclipse.osee.ats.test/.classpath b/plugins/org.eclipse.osee.ats.test/.classpath
index 8a8f1668cdc..ad32c83a788 100644
--- a/plugins/org.eclipse.osee.ats.test/.classpath
+++ b/plugins/org.eclipse.osee.ats.test/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.ats.test/.project b/plugins/org.eclipse.osee.ats.test/.project
index 20bc0834aae..ab2ea44f594 100644
--- a/plugins/org.eclipse.osee.ats.test/.project
+++ b/plugins/org.eclipse.osee.ats.test/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.osee.ats.test</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.ats.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.ats.test/build.properties b/plugins/org.eclipse.osee.ats.test/build.properties
index 41eb6ade2b4..34d2e4d2dad 100644
--- a/plugins/org.eclipse.osee.ats.test/build.properties
+++ b/plugins/org.eclipse.osee.ats.test/build.properties
@@ -1,4 +1,4 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsDbInitTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsDbInitTest.java
index 80efe66feff..e3ff9f81631 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsDbInitTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsDbInitTest.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * 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.ats.test;
-
-import static org.junit.Assert.assertFalse;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.database.init.DatabaseInitializationOperation;
-import org.junit.Before;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsDbInitTest {
-
- @Before
- protected void setUp() throws Exception {
- // This test should only be run on test db
- assertFalse(AtsUtil.isProductionDb());
- }
-
- @org.junit.Test
- public void testDemoDbInit() throws Exception {
- DatabaseInitializationOperation.executeWithoutPrompting("ATS - Developer");
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test;
+
+import static org.junit.Assert.assertFalse;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.database.init.DatabaseInitializationOperation;
+import org.junit.Before;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsDbInitTest {
+
+ @Before
+ protected void setUp() throws Exception {
+ // This test should only be run on test db
+ assertFalse(AtsUtil.isProductionDb());
+ }
+
+ @org.junit.Test
+ public void testDemoDbInit() throws Exception {
+ DatabaseInitializationOperation.executeWithoutPrompting("ATS - Developer");
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Config_Suite.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Config_Suite.java
index b6d773d29e7..2e01d810eb8 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Config_Suite.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Config_Suite.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * 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.ats.test;
-
-import org.eclipse.osee.ats.test.cases.AtsActionableItemToTeamDefinitionTest;
-import org.eclipse.osee.ats.test.cases.AtsTeamDefintionToWorkflowTest;
-import org.eclipse.osee.ats.test.cases.AtsWorkItemDefinitionTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {AtsWorkItemDefinitionTest.class, AtsActionableItemToTeamDefinitionTest.class,
- AtsTeamDefintionToWorkflowTest.class})
-/**
- * This test suite contains test that can be run against any production db
- *
- * @author Donald G. Dunne
- */
-public class AtsTest_Config_Suite {
-}
+/*******************************************************************************
+ * 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.ats.test;
+
+import org.eclipse.osee.ats.test.cases.AtsActionableItemToTeamDefinitionTest;
+import org.eclipse.osee.ats.test.cases.AtsTeamDefintionToWorkflowTest;
+import org.eclipse.osee.ats.test.cases.AtsWorkItemDefinitionTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {AtsWorkItemDefinitionTest.class, AtsActionableItemToTeamDefinitionTest.class,
+ AtsTeamDefintionToWorkflowTest.class})
+/**
+ * This test suite contains test that can be run against any production db
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsTest_Config_Suite {
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Demo_Suite.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Demo_Suite.java
index dc015b65616..44b65c47b8c 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Demo_Suite.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Demo_Suite.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * 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.ats.test;
-
-import static org.junit.Assert.assertTrue;
-import org.eclipse.osee.ats.test.cases.AtsBranchConfigurationTest;
-import org.eclipse.osee.ats.test.cases.AtsDeleteManagerTest;
-import org.eclipse.osee.ats.test.cases.AtsImageTest;
-import org.eclipse.osee.ats.test.cases.AtsNavigateItemsToMassEditorTest;
-import org.eclipse.osee.ats.test.cases.AtsNavigateItemsToTaskEditorTest;
-import org.eclipse.osee.ats.test.cases.AtsNavigateItemsToWorldViewTest;
-import org.eclipse.osee.ats.test.cases.AtsNotifyUsersTest;
-import org.eclipse.osee.ats.test.cases.AtsPurgeTest;
-import org.eclipse.osee.ats.test.cases.AtsValidateAtsDatabaseTest;
-import org.eclipse.osee.ats.test.cases.SMAPrintTest;
-import org.eclipse.osee.ats.test.cases.SMAPromptChangeStatusTest;
-import org.eclipse.osee.framework.core.client.ClientSessionManager;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {SMAPrintTest.class, AtsImageTest.class, SMAPromptChangeStatusTest.class,
- AtsDeleteManagerTest.class, AtsPurgeTest.class, AtsNotifyUsersTest.class, AtsBranchConfigurationTest.class,
- AtsValidateAtsDatabaseTest.class, AtsNavigateItemsToMassEditorTest.class, AtsNavigateItemsToTaskEditorTest.class,
- AtsNavigateItemsToWorldViewTest.class})
-/**
- * @author Donald G. Dunne
- */
-public class AtsTest_Demo_Suite {
- @BeforeClass
- public static void setUp() throws Exception {
- assertTrue("Demo Application Server must be running.",
- ClientSessionManager.getAuthenticationProtocols().contains("demo"));
- assertTrue("Client must authenticate using demo protocol",
- ClientSessionManager.getSession().getAuthenticationProtocol().equals("demo"));
- }
-}
+/*******************************************************************************
+ * 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.ats.test;
+
+import static org.junit.Assert.assertTrue;
+import org.eclipse.osee.ats.test.cases.AtsBranchConfigurationTest;
+import org.eclipse.osee.ats.test.cases.AtsDeleteManagerTest;
+import org.eclipse.osee.ats.test.cases.AtsImageTest;
+import org.eclipse.osee.ats.test.cases.AtsNavigateItemsToMassEditorTest;
+import org.eclipse.osee.ats.test.cases.AtsNavigateItemsToTaskEditorTest;
+import org.eclipse.osee.ats.test.cases.AtsNavigateItemsToWorldViewTest;
+import org.eclipse.osee.ats.test.cases.AtsNotifyUsersTest;
+import org.eclipse.osee.ats.test.cases.AtsPurgeTest;
+import org.eclipse.osee.ats.test.cases.AtsValidateAtsDatabaseTest;
+import org.eclipse.osee.ats.test.cases.SMAPrintTest;
+import org.eclipse.osee.ats.test.cases.SMAPromptChangeStatusTest;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {SMAPrintTest.class, AtsImageTest.class, SMAPromptChangeStatusTest.class,
+ AtsDeleteManagerTest.class, AtsPurgeTest.class, AtsNotifyUsersTest.class, AtsBranchConfigurationTest.class,
+ AtsValidateAtsDatabaseTest.class, AtsNavigateItemsToMassEditorTest.class, AtsNavigateItemsToTaskEditorTest.class,
+ AtsNavigateItemsToWorldViewTest.class})
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsTest_Demo_Suite {
+ @BeforeClass
+ public static void setUp() throws Exception {
+ assertTrue("Demo Application Server must be running.",
+ ClientSessionManager.getAuthenticationProtocols().contains("demo"));
+ assertTrue("Client must authenticate using demo protocol",
+ ClientSessionManager.getSession().getAuthenticationProtocol().equals("demo"));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Production_Suite.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Production_Suite.java
index 786c66647b9..1233368e563 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Production_Suite.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_Production_Suite.java
@@ -1,23 +1,23 @@
-/*******************************************************************************
- * 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.ats.test;
-
-import org.eclipse.osee.ats.test.cases.AtsImageTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {AtsImageTest.class})
-/**
- * @author Donald G. Dunne
- */
-public class AtsTest_Production_Suite {
-}
+/*******************************************************************************
+ * 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.ats.test;
+
+import org.eclipse.osee.ats.test.cases.AtsImageTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {AtsImageTest.class})
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsTest_Production_Suite {
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_TestDb_Suite.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_TestDb_Suite.java
index a3d9bbed51c..d5a744cc342 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_TestDb_Suite.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/AtsTest_TestDb_Suite.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * 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.ats.test;
-
-import org.eclipse.osee.ats.test.cases.AtsBranchConfigurationTest;
-import org.eclipse.osee.ats.test.cases.AtsImageTest;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses( {AtsImageTest.class, AtsBranchConfigurationTest.class})
-/**
- * @author Donald G. Dunne
- */
-public class AtsTest_TestDb_Suite {
-
-}
+/*******************************************************************************
+ * 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.ats.test;
+
+import org.eclipse.osee.ats.test.cases.AtsBranchConfigurationTest;
+import org.eclipse.osee.ats.test.cases.AtsImageTest;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {AtsImageTest.class, AtsBranchConfigurationTest.class})
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsTest_TestDb_Suite {
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsActionableItemToTeamDefinitionTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsActionableItemToTeamDefinitionTest.java
index d4a0f833526..b41ca873b24 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsActionableItemToTeamDefinitionTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsActionableItemToTeamDefinitionTest.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.assertFalse;
-import java.util.Arrays;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsActionableItemToTeamDefinitionTest {
-
- @org.junit.Test
- public void testAtsActionableItemToTeamDefinition() throws Exception {
- boolean error = false;
- StringBuffer sb = new StringBuffer();
- for (Artifact artifact : ArtifactQuery.getArtifactListFromType(AtsArtifactTypes.ActionableItem,
- AtsUtil.getAtsBranch())) {
- ActionableItemArtifact aia = (ActionableItemArtifact) artifact;
- if (aia.isActionable()) {
- if (TeamDefinitionArtifact.getImpactedTeamDefs(Arrays.asList(aia)).isEmpty()) {
- sb.append("Actionable Item \"" + aia + "\" has no Team Def associated and is Actionable.");
- error = true;
- }
- }
- }
- assertFalse(sb.toString(), error);
- }
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.assertFalse;
+import java.util.Arrays;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsActionableItemToTeamDefinitionTest {
+
+ @org.junit.Test
+ public void testAtsActionableItemToTeamDefinition() throws Exception {
+ boolean error = false;
+ StringBuffer sb = new StringBuffer();
+ for (Artifact artifact : ArtifactQuery.getArtifactListFromType(AtsArtifactTypes.ActionableItem,
+ AtsUtil.getAtsBranch())) {
+ ActionableItemArtifact aia = (ActionableItemArtifact) artifact;
+ if (aia.isActionable()) {
+ if (TeamDefinitionArtifact.getImpactedTeamDefs(Arrays.asList(aia)).isEmpty()) {
+ sb.append("Actionable Item \"" + aia + "\" has no Team Def associated and is Actionable.");
+ error = true;
+ }
+ }
+ }
+ assertFalse(sb.toString(), error);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsBranchConfigurationTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsBranchConfigurationTest.java
index 0ab489db9dc..646ef9aeb02 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsBranchConfigurationTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsBranchConfigurationTest.java
@@ -1,449 +1,449 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.logging.Level;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.osee.ats.artifact.ATSAttributes;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.artifact.TeamWorkflowManager;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.config.AtsBulkLoad;
-import org.eclipse.osee.ats.config.AtsConfigManager;
-import org.eclipse.osee.ats.editor.SMAEditor;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.ActionManager;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
-import org.eclipse.osee.ats.util.AtsRelationTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.core.data.IOseeBranch;
-import org.eclipse.osee.framework.core.data.NamedIdentity;
-import org.eclipse.osee.framework.core.enums.BranchArchivedState;
-import org.eclipse.osee.framework.core.enums.BranchType;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
-import org.eclipse.osee.framework.core.enums.ModificationType;
-import org.eclipse.osee.framework.core.exception.BranchDoesNotExist;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.core.operation.IOperation;
-import org.eclipse.osee.framework.core.operation.Operations;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
-import org.eclipse.osee.framework.skynet.core.revision.ChangeData.KindType;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
-import org.eclipse.osee.support.test.util.TestUtil;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-
-/**
- * Run from the ATS Navigator after the DB is configured for either ATS - Dev or Demo
- *
- * @author Donald G. Dunne
- */
-public class AtsBranchConfigurationTest {
-
- public static class AtsTestBranches extends NamedIdentity implements IOseeBranch {
- public static final AtsTestBranches BranchViaTeamDef = new AtsTestBranches("AyH_e6damwQgvDhKfAAA",
- "BranchViaTeamDef");
- public static final AtsTestBranches BranchViaVersions = new AtsTestBranches("AyH_e6damwQgvDhKfBBB",
- "BranchViaVersions");
-
- private AtsTestBranches(String guid, String name) {
- super(guid, name);
- }
-
- public String getNamespace() {
- return String.format("org.branchTest.%s", this.getName().toLowerCase());
- }
-
- public Collection<String> appendToName(String... postFixes) {
- Collection<String> data = new ArrayList<String>();
- for (String postFix : postFixes) {
- data.add(String.format("%s - %s", this.getName(), postFix));
- }
- return data;
- }
- }
-
- @Before
- public void testSetup() throws Exception {
- if (AtsUtil.isProductionDb()) {
- throw new IllegalStateException("BranchConfigThroughTeamDefTest should not be run on production DB");
- }
- AtsBulkLoad.loadConfig(true);
- TestUtil.setIsInTest(true);
- }
-
- @org.junit.Test
- public void testBranchViaVersions() throws Exception {
- OseeLog.log(AtsPlugin.class, Level.INFO, "Running testBranchViaVersions...");
-
- // Cleanup from previous run
- cleanupBranchTest(AtsTestBranches.BranchViaVersions);
-
- OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring ATS for team org.branchTest.viaTeamDefs");
-
- // create team definition and actionable item
- String name = AtsTestBranches.BranchViaVersions.getName();
- String namespace = AtsTestBranches.BranchViaVersions.getNamespace();
- Collection<String> versions = AtsTestBranches.BranchViaVersions.appendToName("Ver1", "Ver2");
- Collection<String> actionableItems = AtsTestBranches.BranchViaVersions.appendToName("A1", "A2");
- configureAts(namespace, name, versions, actionableItems, namespace);
-
- // create main branch
- OseeLog.log(AtsPlugin.class, Level.INFO, "Creating root branch");
- // Create SAW_Bld_2 branch off SAW_Bld_1
- Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(AtsTestBranches.BranchViaVersions);
-
- TestUtil.sleep(2000);
-
- // configure version to use branch and allow create/commit
- OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring version to use branch and allow create/commit");
- TeamDefinitionArtifact teamDef =
- (TeamDefinitionArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition,
- AtsTestBranches.BranchViaVersions.getName(), AtsUtil.getAtsBranch());
- VersionArtifact verArtToTarget = null;
- for (VersionArtifact vArt : teamDef.getVersionsArtifacts()) {
- if (vArt.getName().contains("Ver1")) {
- verArtToTarget = vArt;
- }
- }
- verArtToTarget.setSoleAttributeFromString(ATSAttributes.BASELINE_BRANCH_GUID_ATTRIBUTE.getStoreName(),
- viaTeamDefBranch.getGuid());
- // setup team def to allow create/commit of branch
- verArtToTarget.setSoleAttributeValue(ATSAttributes.ALLOW_COMMIT_BRANCH.getStoreName(), true);
- verArtToTarget.setSoleAttributeValue(ATSAttributes.ALLOW_CREATE_BRANCH.getStoreName(), true);
- verArtToTarget.persist();
-
- TestUtil.sleep(2000);
-
- // setup workflow page to have create/commit branch widgets
- setupWorkflowPageToHaveCreateCommitBranchWidgets(namespace);
-
- // create action and target for version
- OseeLog.log(AtsPlugin.class, Level.INFO, "Create new Action and target for version " + verArtToTarget);
-
- Collection<ActionableItemArtifact> selectedActionableItems =
- ActionableItemArtifact.getActionableItems(AtsTestBranches.BranchViaVersions.appendToName("A1"));
- Assert.assertFalse(selectedActionableItems.isEmpty());
-
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- ActionArtifact actionArt =
- ActionManager.createAction(null, AtsTestBranches.BranchViaVersions.getName() + " Req Changes",
- "description", ChangeType.Problem, PriorityType.Priority_1, false, null, selectedActionableItems,
- transaction);
- actionArt.getTeamWorkFlowArtifacts().iterator().next().addRelation(
- AtsRelationTypes.TeamWorkflowTargetedForVersion_Version, verArtToTarget);
- actionArt.getTeamWorkFlowArtifacts().iterator().next().persist(transaction);
- transaction.execute();
-
- final TeamWorkFlowArtifact teamWf = actionArt.getTeamWorkFlowArtifacts().iterator().next();
- TeamWorkflowManager dtwm = new TeamWorkflowManager(teamWf);
-
- // Transition to desired state
- OseeLog.log(AtsPlugin.class, Level.INFO, "Transitioning to Implement state");
-
- transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- dtwm.transitionTo(DefaultTeamState.Implement, null, false, transaction);
- teamWf.persist(transaction);
- transaction.execute();
-
- SMAEditor.editArtifact(teamWf);
-
- // create branch
- createBranch(namespace, teamWf);
-
- // make changes
- OseeLog.log(AtsPlugin.class, Level.INFO, "Make new requirement artifact");
- Artifact rootArtifact = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(teamWf.getWorkingBranch());
- Artifact blk3MainArt =
- ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, teamWf.getWorkingBranch(),
- AtsTestBranches.BranchViaVersions.getName() + " Requirement");
- rootArtifact.addChild(blk3MainArt);
- blk3MainArt.persist();
-
- // commit branch
- commitBranch(teamWf);
-
- TestUtil.sleep(2000);
-
- // test change report
- OseeLog.log(AtsPlugin.class, Level.INFO, "Test change report results");
- ChangeData changeData = teamWf.getBranchMgr().getChangeDataFromEarliestTransactionId();
- Assert.assertFalse("No changes detected", changeData.isEmpty());
-
- Collection<Artifact> newArts = changeData.getArtifacts(KindType.Artifact, ModificationType.NEW);
- Assert.assertTrue("Should be 1 new artifact in change report, found " + newArts.size(), newArts.size() == 1);
-
- }
-
- @org.junit.Test
- public void testBranchViaTeamDefinition() throws Exception {
-
- OseeLog.log(AtsPlugin.class, Level.INFO, "Running testBranchViaTeamDefinition...");
-
- // Cleanup from previous run
- cleanupBranchTest(AtsTestBranches.BranchViaTeamDef);
-
- OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring ATS for team org.branchTest.viaTeamDefs");
- // create team definition and actionable item
-
- String name = AtsTestBranches.BranchViaTeamDef.getName();
- String namespace = AtsTestBranches.BranchViaTeamDef.getNamespace();
- Collection<String> versions = null;
- Collection<String> actionableItems = AtsTestBranches.BranchViaTeamDef.appendToName("A1", "A2");
- configureAts(namespace, name, versions, actionableItems, namespace);
-
- // create main branch
- OseeLog.log(AtsPlugin.class, Level.INFO, "Creating root branch");
- // Create SAW_Bld_2 branch off SAW_Bld_1
- Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(AtsTestBranches.BranchViaTeamDef);
-
- TestUtil.sleep(2000);
-
- // configure team def to use branch
- OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring team def to use branch and allow create/commit");
- TeamDefinitionArtifact teamDef =
- (TeamDefinitionArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition,
- AtsTestBranches.BranchViaTeamDef.getName(), AtsUtil.getAtsBranch());
- teamDef.setSoleAttributeFromString(ATSAttributes.BASELINE_BRANCH_GUID_ATTRIBUTE.getStoreName(),
- viaTeamDefBranch.getGuid());
- // setup team def to allow create/commit of branch
- teamDef.setSoleAttributeValue(ATSAttributes.ALLOW_COMMIT_BRANCH.getStoreName(), true);
- teamDef.setSoleAttributeValue(ATSAttributes.ALLOW_CREATE_BRANCH.getStoreName(), true);
- teamDef.setSoleAttributeValue(ATSAttributes.TEAM_USES_VERSIONS_ATTRIBUTE.getStoreName(), false);
- teamDef.persist();
-
- TestUtil.sleep(2000);
-
- // setup workflow page to have create/commit branch widgets
- setupWorkflowPageToHaveCreateCommitBranchWidgets(namespace);
-
- // create action,
- OseeLog.log(AtsPlugin.class, Level.INFO, "Create new Action");
- Collection<ActionableItemArtifact> selectedActionableItems =
- ActionableItemArtifact.getActionableItems(AtsTestBranches.BranchViaTeamDef.appendToName("A1"));
- Assert.assertFalse(selectedActionableItems.isEmpty());
-
- SkynetTransaction transaction =
- new SkynetTransaction(AtsUtil.getAtsBranch(), "Test branch via team definition: create action");
- String actionTitle = AtsTestBranches.BranchViaTeamDef.getName() + " Req Changes";
- ActionArtifact actionArt =
- ActionManager.createAction(null, actionTitle, "description", ChangeType.Problem, PriorityType.Priority_1,
- false, null, selectedActionableItems, transaction);
- transaction.execute();
-
- final TeamWorkFlowArtifact teamWf = actionArt.getTeamWorkFlowArtifacts().iterator().next();
- TeamWorkflowManager dtwm = new TeamWorkflowManager(teamWf);
-
- // Transition to desired state
- OseeLog.log(AtsPlugin.class, Level.INFO, "Transitioning to Implement state");
- transaction =
- new SkynetTransaction(AtsUtil.getAtsBranch(),
- "Test branch via team definition: Transition to desired state");
- dtwm.transitionTo(DefaultTeamState.Implement, null, false, transaction);
- teamWf.persist(transaction);
- transaction.execute();
-
- // create branch
- createBranch(namespace, teamWf);
-
- // make changes
- OseeLog.log(AtsPlugin.class, Level.INFO, "Make new requirement artifact");
- Artifact rootArtifact = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(teamWf.getWorkingBranch());
- Artifact blk3MainArt =
- ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, teamWf.getWorkingBranch(),
- AtsTestBranches.BranchViaTeamDef.getName() + " Requirement");
- rootArtifact.addChild(blk3MainArt);
- blk3MainArt.persist();
-
- // commit branch
- commitBranch(teamWf);
-
- // test change report
- OseeLog.log(AtsPlugin.class, Level.INFO, "Test change report results");
- ChangeData changeData = teamWf.getBranchMgr().getChangeDataFromEarliestTransactionId();
- Assert.assertTrue("No changes detected", !changeData.isEmpty());
-
- Collection<Artifact> newArts = changeData.getArtifacts(KindType.Artifact, ModificationType.NEW);
- Assert.assertTrue("Should be 1 new artifact in change report, found " + newArts.size(), newArts.size() == 1);
- }
-
- public static void cleanupBranchTest(AtsTestBranches testType) throws Exception {
- String namespace = "org.branchTest." + testType.getName().toLowerCase();
- OseeLog.log(AtsPlugin.class, Level.INFO, "Cleanup from previous run of ATS for team " + namespace);
- ActionArtifact aArt =
- (ActionArtifact) ArtifactQuery.checkArtifactFromTypeAndName(AtsArtifactTypes.Action,
- testType.getName() + " Req Changes", AtsUtil.getAtsBranch());
- if (aArt != null) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- for (TeamWorkFlowArtifact teamArt : aArt.getTeamWorkFlowArtifacts()) {
- SMAEditor.close(Collections.singleton(teamArt), false);
- teamArt.deleteAndPersist(transaction, true);
- }
- aArt.deleteAndPersist(transaction, true);
- transaction.execute();
- }
-
- // Delete VersionArtifacts
- Collection<Artifact> arts =
- ArtifactQuery.getArtifactListFromType(AtsArtifactTypes.Version, AtsUtil.getAtsBranch());
- if (arts.size() > 0) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- for (Artifact verArt : arts) {
- if (verArt.getName().contains(testType.getName())) {
- verArt.deleteAndPersist(transaction, true);
- }
- }
- transaction.execute();
- }
-
- // Delete Team Definitions
- Artifact art =
- ArtifactQuery.checkArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition, testType.getName(),
- AtsUtil.getAtsBranch());
- if (art != null) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- art.deleteAndPersist(transaction, true);
- transaction.execute();
- }
-
- // Delete AIs
- art =
- ArtifactQuery.checkArtifactFromTypeAndName(AtsArtifactTypes.ActionableItem, testType.getName(),
- AtsUtil.getAtsBranch());
- if (art != null) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- for (Artifact childArt : art.getChildren()) {
- childArt.deleteAndPersist(transaction, true);
- }
- art.deleteAndPersist(transaction, true);
- transaction.execute();
- }
-
- arts = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.WorkPageDefinition, AtsUtil.getAtsBranch());
- if (arts.size() > 0) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- for (Artifact workArt : arts) {
- if (workArt.getName().startsWith(namespace)) {
- workArt.deleteAndPersist(transaction, true);
- }
- }
- transaction.execute();
- }
- arts = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.WorkFlowDefinition, AtsUtil.getAtsBranch());
- if (arts.size() > 0) {
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
- for (Artifact workArt : arts) {
- if (workArt.getName().startsWith(namespace)) {
- workArt.deleteAndPersist(transaction, true);
- }
- }
- transaction.execute();
- }
-
- try {
- BranchManager.refreshBranches();
- // delete working branches
- for (Branch workingBranch : BranchManager.getBranches(BranchArchivedState.ALL, BranchType.WORKING)) {
- if (workingBranch.getName().contains(testType.getName())) {
- BranchManager.purgeBranch(workingBranch);
- TestUtil.sleep(2000);
- }
- }
- // delete baseline branch
- Branch branch = BranchManager.getBranchByGuid(testType.getGuid());
- if (branch != null) {
- BranchManager.purgeBranch(branch);
- TestUtil.sleep(2000);
- }
-
- } catch (BranchDoesNotExist ex) {
- // do nothing
- }
- }
-
- public static void commitBranch(TeamWorkFlowArtifact teamWf) throws Exception {
- OseeLog.log(AtsPlugin.class, Level.INFO, "Commit Branch");
- Job job =
- teamWf.getBranchMgr().commitWorkingBranch(false, true,
- teamWf.getBranchMgr().getWorkingBranch().getParentBranch(), true);
- try {
- job.join();
- } catch (InterruptedException ex) {
- //
- }
- }
-
- public static void createBranch(String namespace, TeamWorkFlowArtifact teamWf) throws Exception {
- OseeLog.log(AtsPlugin.class, Level.INFO, "Creating working branch");
- String implementPageId = namespace + ".Implement";
- Result result = teamWf.getBranchMgr().createWorkingBranch(implementPageId, false);
- if (result.isFalse()) {
- result.popup();
- return;
- }
- TestUtil.sleep(4000);
- }
-
- private void setupWorkflowPageToHaveCreateCommitBranchWidgets(String namespace) throws Exception {
- OseeLog.log(AtsPlugin.class, Level.INFO, "Setup new workflow page to have create/commit branch widgets");
- String implementPageId = namespace + ".Implement";
- Artifact implementPageDef = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(implementPageId);
- implementPageDef.addRelation(CoreRelationTypes.WorkItem__Child,
- WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName()));
- implementPageDef.addRelation(CoreRelationTypes.WorkItem__Child,
- WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName()));
- implementPageDef.persist();
- WorkItemDefinitionFactory.updateDefinitions(Collections.singleton(implementPageDef));
- }
-
- @After
- public void tearDown() throws Exception {
- cleanupBranchTest(AtsTestBranches.BranchViaVersions);
- cleanupBranchTest(AtsTestBranches.BranchViaTeamDef);
- TestUtil.setIsInTest(false);
- }
-
- public static void configureAts(String namespace, String teamDefName, Collection<String> versionNames, Collection<String> actionableItems, String workflowId) throws Exception {
- AtsConfigManager.Display noDisplay = new MockAtsConfigDisplay();
- IOperation operation =
- new AtsConfigManager(noDisplay, namespace, teamDefName, versionNames, actionableItems, workflowId);
- Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1.0);
- TestUtil.sleep(2000);
- }
-
- private static final class MockAtsConfigDisplay implements AtsConfigManager.Display {
- @Override
- public void openAtsConfigurationEditors(TeamDefinitionArtifact teamDef, Collection<ActionableItemArtifact> aias, WorkFlowDefinition workFlowDefinition) {
- // Nothing to do - we have no display during testing
- }
- }
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.logging.Level;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osee.ats.artifact.ATSAttributes;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.artifact.TeamWorkflowManager;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.config.AtsBulkLoad;
+import org.eclipse.osee.ats.config.AtsConfigManager;
+import org.eclipse.osee.ats.editor.SMAEditor;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.ActionManager;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
+import org.eclipse.osee.ats.util.AtsRelationTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.data.NamedIdentity;
+import org.eclipse.osee.framework.core.enums.BranchArchivedState;
+import org.eclipse.osee.framework.core.enums.BranchType;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.exception.BranchDoesNotExist;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.core.operation.IOperation;
+import org.eclipse.osee.framework.core.operation.Operations;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeData;
+import org.eclipse.osee.framework.skynet.core.revision.ChangeData.KindType;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkFlowDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
+import org.eclipse.osee.support.test.util.TestUtil;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+
+/**
+ * Run from the ATS Navigator after the DB is configured for either ATS - Dev or Demo
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsBranchConfigurationTest {
+
+ public static class AtsTestBranches extends NamedIdentity implements IOseeBranch {
+ public static final AtsTestBranches BranchViaTeamDef = new AtsTestBranches("AyH_e6damwQgvDhKfAAA",
+ "BranchViaTeamDef");
+ public static final AtsTestBranches BranchViaVersions = new AtsTestBranches("AyH_e6damwQgvDhKfBBB",
+ "BranchViaVersions");
+
+ private AtsTestBranches(String guid, String name) {
+ super(guid, name);
+ }
+
+ public String getNamespace() {
+ return String.format("org.branchTest.%s", this.getName().toLowerCase());
+ }
+
+ public Collection<String> appendToName(String... postFixes) {
+ Collection<String> data = new ArrayList<String>();
+ for (String postFix : postFixes) {
+ data.add(String.format("%s - %s", this.getName(), postFix));
+ }
+ return data;
+ }
+ }
+
+ @Before
+ public void testSetup() throws Exception {
+ if (AtsUtil.isProductionDb()) {
+ throw new IllegalStateException("BranchConfigThroughTeamDefTest should not be run on production DB");
+ }
+ AtsBulkLoad.loadConfig(true);
+ TestUtil.setIsInTest(true);
+ }
+
+ @org.junit.Test
+ public void testBranchViaVersions() throws Exception {
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Running testBranchViaVersions...");
+
+ // Cleanup from previous run
+ cleanupBranchTest(AtsTestBranches.BranchViaVersions);
+
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring ATS for team org.branchTest.viaTeamDefs");
+
+ // create team definition and actionable item
+ String name = AtsTestBranches.BranchViaVersions.getName();
+ String namespace = AtsTestBranches.BranchViaVersions.getNamespace();
+ Collection<String> versions = AtsTestBranches.BranchViaVersions.appendToName("Ver1", "Ver2");
+ Collection<String> actionableItems = AtsTestBranches.BranchViaVersions.appendToName("A1", "A2");
+ configureAts(namespace, name, versions, actionableItems, namespace);
+
+ // create main branch
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Creating root branch");
+ // Create SAW_Bld_2 branch off SAW_Bld_1
+ Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(AtsTestBranches.BranchViaVersions);
+
+ TestUtil.sleep(2000);
+
+ // configure version to use branch and allow create/commit
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring version to use branch and allow create/commit");
+ TeamDefinitionArtifact teamDef =
+ (TeamDefinitionArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition,
+ AtsTestBranches.BranchViaVersions.getName(), AtsUtil.getAtsBranch());
+ VersionArtifact verArtToTarget = null;
+ for (VersionArtifact vArt : teamDef.getVersionsArtifacts()) {
+ if (vArt.getName().contains("Ver1")) {
+ verArtToTarget = vArt;
+ }
+ }
+ verArtToTarget.setSoleAttributeFromString(ATSAttributes.BASELINE_BRANCH_GUID_ATTRIBUTE.getStoreName(),
+ viaTeamDefBranch.getGuid());
+ // setup team def to allow create/commit of branch
+ verArtToTarget.setSoleAttributeValue(ATSAttributes.ALLOW_COMMIT_BRANCH.getStoreName(), true);
+ verArtToTarget.setSoleAttributeValue(ATSAttributes.ALLOW_CREATE_BRANCH.getStoreName(), true);
+ verArtToTarget.persist();
+
+ TestUtil.sleep(2000);
+
+ // setup workflow page to have create/commit branch widgets
+ setupWorkflowPageToHaveCreateCommitBranchWidgets(namespace);
+
+ // create action and target for version
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Create new Action and target for version " + verArtToTarget);
+
+ Collection<ActionableItemArtifact> selectedActionableItems =
+ ActionableItemArtifact.getActionableItems(AtsTestBranches.BranchViaVersions.appendToName("A1"));
+ Assert.assertFalse(selectedActionableItems.isEmpty());
+
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ ActionArtifact actionArt =
+ ActionManager.createAction(null, AtsTestBranches.BranchViaVersions.getName() + " Req Changes",
+ "description", ChangeType.Problem, PriorityType.Priority_1, false, null, selectedActionableItems,
+ transaction);
+ actionArt.getTeamWorkFlowArtifacts().iterator().next().addRelation(
+ AtsRelationTypes.TeamWorkflowTargetedForVersion_Version, verArtToTarget);
+ actionArt.getTeamWorkFlowArtifacts().iterator().next().persist(transaction);
+ transaction.execute();
+
+ final TeamWorkFlowArtifact teamWf = actionArt.getTeamWorkFlowArtifacts().iterator().next();
+ TeamWorkflowManager dtwm = new TeamWorkflowManager(teamWf);
+
+ // Transition to desired state
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Transitioning to Implement state");
+
+ transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ dtwm.transitionTo(DefaultTeamState.Implement, null, false, transaction);
+ teamWf.persist(transaction);
+ transaction.execute();
+
+ SMAEditor.editArtifact(teamWf);
+
+ // create branch
+ createBranch(namespace, teamWf);
+
+ // make changes
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Make new requirement artifact");
+ Artifact rootArtifact = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(teamWf.getWorkingBranch());
+ Artifact blk3MainArt =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, teamWf.getWorkingBranch(),
+ AtsTestBranches.BranchViaVersions.getName() + " Requirement");
+ rootArtifact.addChild(blk3MainArt);
+ blk3MainArt.persist();
+
+ // commit branch
+ commitBranch(teamWf);
+
+ TestUtil.sleep(2000);
+
+ // test change report
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Test change report results");
+ ChangeData changeData = teamWf.getBranchMgr().getChangeDataFromEarliestTransactionId();
+ Assert.assertFalse("No changes detected", changeData.isEmpty());
+
+ Collection<Artifact> newArts = changeData.getArtifacts(KindType.Artifact, ModificationType.NEW);
+ Assert.assertTrue("Should be 1 new artifact in change report, found " + newArts.size(), newArts.size() == 1);
+
+ }
+
+ @org.junit.Test
+ public void testBranchViaTeamDefinition() throws Exception {
+
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Running testBranchViaTeamDefinition...");
+
+ // Cleanup from previous run
+ cleanupBranchTest(AtsTestBranches.BranchViaTeamDef);
+
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring ATS for team org.branchTest.viaTeamDefs");
+ // create team definition and actionable item
+
+ String name = AtsTestBranches.BranchViaTeamDef.getName();
+ String namespace = AtsTestBranches.BranchViaTeamDef.getNamespace();
+ Collection<String> versions = null;
+ Collection<String> actionableItems = AtsTestBranches.BranchViaTeamDef.appendToName("A1", "A2");
+ configureAts(namespace, name, versions, actionableItems, namespace);
+
+ // create main branch
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Creating root branch");
+ // Create SAW_Bld_2 branch off SAW_Bld_1
+ Branch viaTeamDefBranch = BranchManager.createTopLevelBranch(AtsTestBranches.BranchViaTeamDef);
+
+ TestUtil.sleep(2000);
+
+ // configure team def to use branch
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Configuring team def to use branch and allow create/commit");
+ TeamDefinitionArtifact teamDef =
+ (TeamDefinitionArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition,
+ AtsTestBranches.BranchViaTeamDef.getName(), AtsUtil.getAtsBranch());
+ teamDef.setSoleAttributeFromString(ATSAttributes.BASELINE_BRANCH_GUID_ATTRIBUTE.getStoreName(),
+ viaTeamDefBranch.getGuid());
+ // setup team def to allow create/commit of branch
+ teamDef.setSoleAttributeValue(ATSAttributes.ALLOW_COMMIT_BRANCH.getStoreName(), true);
+ teamDef.setSoleAttributeValue(ATSAttributes.ALLOW_CREATE_BRANCH.getStoreName(), true);
+ teamDef.setSoleAttributeValue(ATSAttributes.TEAM_USES_VERSIONS_ATTRIBUTE.getStoreName(), false);
+ teamDef.persist();
+
+ TestUtil.sleep(2000);
+
+ // setup workflow page to have create/commit branch widgets
+ setupWorkflowPageToHaveCreateCommitBranchWidgets(namespace);
+
+ // create action,
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Create new Action");
+ Collection<ActionableItemArtifact> selectedActionableItems =
+ ActionableItemArtifact.getActionableItems(AtsTestBranches.BranchViaTeamDef.appendToName("A1"));
+ Assert.assertFalse(selectedActionableItems.isEmpty());
+
+ SkynetTransaction transaction =
+ new SkynetTransaction(AtsUtil.getAtsBranch(), "Test branch via team definition: create action");
+ String actionTitle = AtsTestBranches.BranchViaTeamDef.getName() + " Req Changes";
+ ActionArtifact actionArt =
+ ActionManager.createAction(null, actionTitle, "description", ChangeType.Problem, PriorityType.Priority_1,
+ false, null, selectedActionableItems, transaction);
+ transaction.execute();
+
+ final TeamWorkFlowArtifact teamWf = actionArt.getTeamWorkFlowArtifacts().iterator().next();
+ TeamWorkflowManager dtwm = new TeamWorkflowManager(teamWf);
+
+ // Transition to desired state
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Transitioning to Implement state");
+ transaction =
+ new SkynetTransaction(AtsUtil.getAtsBranch(),
+ "Test branch via team definition: Transition to desired state");
+ dtwm.transitionTo(DefaultTeamState.Implement, null, false, transaction);
+ teamWf.persist(transaction);
+ transaction.execute();
+
+ // create branch
+ createBranch(namespace, teamWf);
+
+ // make changes
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Make new requirement artifact");
+ Artifact rootArtifact = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(teamWf.getWorkingBranch());
+ Artifact blk3MainArt =
+ ArtifactTypeManager.addArtifact(CoreArtifactTypes.SoftwareRequirement, teamWf.getWorkingBranch(),
+ AtsTestBranches.BranchViaTeamDef.getName() + " Requirement");
+ rootArtifact.addChild(blk3MainArt);
+ blk3MainArt.persist();
+
+ // commit branch
+ commitBranch(teamWf);
+
+ // test change report
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Test change report results");
+ ChangeData changeData = teamWf.getBranchMgr().getChangeDataFromEarliestTransactionId();
+ Assert.assertTrue("No changes detected", !changeData.isEmpty());
+
+ Collection<Artifact> newArts = changeData.getArtifacts(KindType.Artifact, ModificationType.NEW);
+ Assert.assertTrue("Should be 1 new artifact in change report, found " + newArts.size(), newArts.size() == 1);
+ }
+
+ public static void cleanupBranchTest(AtsTestBranches testType) throws Exception {
+ String namespace = "org.branchTest." + testType.getName().toLowerCase();
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Cleanup from previous run of ATS for team " + namespace);
+ ActionArtifact aArt =
+ (ActionArtifact) ArtifactQuery.checkArtifactFromTypeAndName(AtsArtifactTypes.Action,
+ testType.getName() + " Req Changes", AtsUtil.getAtsBranch());
+ if (aArt != null) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ for (TeamWorkFlowArtifact teamArt : aArt.getTeamWorkFlowArtifacts()) {
+ SMAEditor.close(Collections.singleton(teamArt), false);
+ teamArt.deleteAndPersist(transaction, true);
+ }
+ aArt.deleteAndPersist(transaction, true);
+ transaction.execute();
+ }
+
+ // Delete VersionArtifacts
+ Collection<Artifact> arts =
+ ArtifactQuery.getArtifactListFromType(AtsArtifactTypes.Version, AtsUtil.getAtsBranch());
+ if (arts.size() > 0) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ for (Artifact verArt : arts) {
+ if (verArt.getName().contains(testType.getName())) {
+ verArt.deleteAndPersist(transaction, true);
+ }
+ }
+ transaction.execute();
+ }
+
+ // Delete Team Definitions
+ Artifact art =
+ ArtifactQuery.checkArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition, testType.getName(),
+ AtsUtil.getAtsBranch());
+ if (art != null) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ art.deleteAndPersist(transaction, true);
+ transaction.execute();
+ }
+
+ // Delete AIs
+ art =
+ ArtifactQuery.checkArtifactFromTypeAndName(AtsArtifactTypes.ActionableItem, testType.getName(),
+ AtsUtil.getAtsBranch());
+ if (art != null) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ for (Artifact childArt : art.getChildren()) {
+ childArt.deleteAndPersist(transaction, true);
+ }
+ art.deleteAndPersist(transaction, true);
+ transaction.execute();
+ }
+
+ arts = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.WorkPageDefinition, AtsUtil.getAtsBranch());
+ if (arts.size() > 0) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ for (Artifact workArt : arts) {
+ if (workArt.getName().startsWith(namespace)) {
+ workArt.deleteAndPersist(transaction, true);
+ }
+ }
+ transaction.execute();
+ }
+ arts = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.WorkFlowDefinition, AtsUtil.getAtsBranch());
+ if (arts.size() > 0) {
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Branch Configuration Test");
+ for (Artifact workArt : arts) {
+ if (workArt.getName().startsWith(namespace)) {
+ workArt.deleteAndPersist(transaction, true);
+ }
+ }
+ transaction.execute();
+ }
+
+ try {
+ BranchManager.refreshBranches();
+ // delete working branches
+ for (Branch workingBranch : BranchManager.getBranches(BranchArchivedState.ALL, BranchType.WORKING)) {
+ if (workingBranch.getName().contains(testType.getName())) {
+ BranchManager.purgeBranch(workingBranch);
+ TestUtil.sleep(2000);
+ }
+ }
+ // delete baseline branch
+ Branch branch = BranchManager.getBranchByGuid(testType.getGuid());
+ if (branch != null) {
+ BranchManager.purgeBranch(branch);
+ TestUtil.sleep(2000);
+ }
+
+ } catch (BranchDoesNotExist ex) {
+ // do nothing
+ }
+ }
+
+ public static void commitBranch(TeamWorkFlowArtifact teamWf) throws Exception {
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Commit Branch");
+ Job job =
+ teamWf.getBranchMgr().commitWorkingBranch(false, true,
+ teamWf.getBranchMgr().getWorkingBranch().getParentBranch(), true);
+ try {
+ job.join();
+ } catch (InterruptedException ex) {
+ //
+ }
+ }
+
+ public static void createBranch(String namespace, TeamWorkFlowArtifact teamWf) throws Exception {
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Creating working branch");
+ String implementPageId = namespace + ".Implement";
+ Result result = teamWf.getBranchMgr().createWorkingBranch(implementPageId, false);
+ if (result.isFalse()) {
+ result.popup();
+ return;
+ }
+ TestUtil.sleep(4000);
+ }
+
+ private void setupWorkflowPageToHaveCreateCommitBranchWidgets(String namespace) throws Exception {
+ OseeLog.log(AtsPlugin.class, Level.INFO, "Setup new workflow page to have create/commit branch widgets");
+ String implementPageId = namespace + ".Implement";
+ Artifact implementPageDef = WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(implementPageId);
+ implementPageDef.addRelation(CoreRelationTypes.WorkItem__Child,
+ WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(ATSAttributes.WORKING_BRANCH_WIDGET.getStoreName()));
+ implementPageDef.addRelation(CoreRelationTypes.WorkItem__Child,
+ WorkItemDefinitionFactory.getWorkItemDefinitionArtifact(ATSAttributes.COMMIT_MANAGER_WIDGET.getStoreName()));
+ implementPageDef.persist();
+ WorkItemDefinitionFactory.updateDefinitions(Collections.singleton(implementPageDef));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ cleanupBranchTest(AtsTestBranches.BranchViaVersions);
+ cleanupBranchTest(AtsTestBranches.BranchViaTeamDef);
+ TestUtil.setIsInTest(false);
+ }
+
+ public static void configureAts(String namespace, String teamDefName, Collection<String> versionNames, Collection<String> actionableItems, String workflowId) throws Exception {
+ AtsConfigManager.Display noDisplay = new MockAtsConfigDisplay();
+ IOperation operation =
+ new AtsConfigManager(noDisplay, namespace, teamDefName, versionNames, actionableItems, workflowId);
+ Operations.executeWorkAndCheckStatus(operation, new NullProgressMonitor(), -1.0);
+ TestUtil.sleep(2000);
+ }
+
+ private static final class MockAtsConfigDisplay implements AtsConfigManager.Display {
+ @Override
+ public void openAtsConfigurationEditors(TeamDefinitionArtifact teamDef, Collection<ActionableItemArtifact> aias, WorkFlowDefinition workFlowDefinition) {
+ // Nothing to do - we have no display during testing
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsImageTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsImageTest.java
index ef6574d8570..07977a5f397 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsImageTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsImageTest.java
@@ -8,22 +8,22 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.test.cases;
-
-import org.eclipse.osee.ats.AtsImage;
-import org.eclipse.osee.framework.ui.skynet.test.cases.ImageManagerTest;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsImageTest extends ImageManagerTest {
-
- /**
- * @param imageClassName
- * @param oseeImages
- */
- public AtsImageTest() {
- super("AtsImage", AtsImage.values());
- }
-
-}
+package org.eclipse.osee.ats.test.cases;
+
+import org.eclipse.osee.ats.AtsImage;
+import org.eclipse.osee.framework.ui.skynet.test.cases.ImageManagerTest;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsImageTest extends ImageManagerTest {
+
+ /**
+ * @param imageClassName
+ * @param oseeImages
+ */
+ public AtsImageTest() {
+ super("AtsImage", AtsImage.values());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToMassEditorTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToMassEditorTest.java
index c7da2f5ede2..72eb68d3466 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToMassEditorTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToMassEditorTest.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.assertTrue;
-import java.util.Arrays;
-import java.util.Collection;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.navigate.AtsXNavigateItemLauncher;
-import org.eclipse.osee.ats.navigate.MassEditTeamVersionItem;
-import org.eclipse.osee.ats.task.TaskEditor;
-import org.eclipse.osee.ats.test.util.DemoTestUtil;
-import org.eclipse.osee.ats.test.util.NavigateTestUtil;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.artifact.massEditor.MassArtifactEditor;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.junit.Before;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNavigateItemsToMassEditorTest {
-
- public AtsNavigateItemsToMassEditorTest() {
- }
-
- @Before
- public void setup() throws Exception {
- DemoTestUtil.setUpTest();
- }
-
- @org.junit.Test
- public void testTeamVersions() throws Exception {
- closeTaskEditors();
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Team Versions");
- ((MassEditTeamVersionItem) item).setSelectedTeamDef(TeamDefinitionArtifact.getTeamDefinitions(
- Arrays.asList("SAW SW")).iterator().next());
- handleGeneralDoubleClickAndTestResults(item, VersionArtifact.class, 3);
- }
-
- public void handleGeneralDoubleClickAndTestResults(XNavigateItem item, Class<?> clazz, int numOfType) throws OseeCoreException {
- AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
- MassArtifactEditor massEditor = getMassArtifactEditor();
- assertTrue(massEditor != null);
- Collection<Artifact> arts = massEditor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, clazz, numOfType);
- }
-
- private MassArtifactEditor getMassArtifactEditor() {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IEditorReference editors[] = page.getEditorReferences();
- for (int j = 0; j < editors.length; j++) {
- IEditorReference editor = editors[j];
- if (editor.getPart(false) instanceof MassArtifactEditor) {
- return (MassArtifactEditor) editor.getPart(false);
- }
- }
- return null;
- }
-
- private void closeTaskEditors() {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IEditorReference editors[] = page.getEditorReferences();
- for (int j = 0; j < editors.length; j++) {
- IEditorReference editor = editors[j];
- if (editor.getPart(false) instanceof TaskEditor) {
- page.closeEditor((TaskEditor) editor.getPart(false), false);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
+import java.util.Collection;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.navigate.AtsXNavigateItemLauncher;
+import org.eclipse.osee.ats.navigate.MassEditTeamVersionItem;
+import org.eclipse.osee.ats.task.TaskEditor;
+import org.eclipse.osee.ats.test.util.DemoTestUtil;
+import org.eclipse.osee.ats.test.util.NavigateTestUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.artifact.massEditor.MassArtifactEditor;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.junit.Before;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNavigateItemsToMassEditorTest {
+
+ public AtsNavigateItemsToMassEditorTest() {
+ }
+
+ @Before
+ public void setup() throws Exception {
+ DemoTestUtil.setUpTest();
+ }
+
+ @org.junit.Test
+ public void testTeamVersions() throws Exception {
+ closeTaskEditors();
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Team Versions");
+ ((MassEditTeamVersionItem) item).setSelectedTeamDef(TeamDefinitionArtifact.getTeamDefinitions(
+ Arrays.asList("SAW SW")).iterator().next());
+ handleGeneralDoubleClickAndTestResults(item, VersionArtifact.class, 3);
+ }
+
+ public void handleGeneralDoubleClickAndTestResults(XNavigateItem item, Class<?> clazz, int numOfType) throws OseeCoreException {
+ AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
+ MassArtifactEditor massEditor = getMassArtifactEditor();
+ assertTrue(massEditor != null);
+ Collection<Artifact> arts = massEditor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, clazz, numOfType);
+ }
+
+ private MassArtifactEditor getMassArtifactEditor() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorReference editors[] = page.getEditorReferences();
+ for (int j = 0; j < editors.length; j++) {
+ IEditorReference editor = editors[j];
+ if (editor.getPart(false) instanceof MassArtifactEditor) {
+ return (MassArtifactEditor) editor.getPart(false);
+ }
+ }
+ return null;
+ }
+
+ private void closeTaskEditors() {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorReference editors[] = page.getEditorReferences();
+ for (int j = 0; j < editors.length; j++) {
+ IEditorReference editor = editors[j];
+ if (editor.getPart(false) instanceof TaskEditor) {
+ page.closeEditor((TaskEditor) editor.getPart(false), false);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToTaskEditorTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToTaskEditorTest.java
index 7e7397312e4..7c009b14649 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToTaskEditorTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToTaskEditorTest.java
@@ -1,156 +1,156 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.assertTrue;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.navigate.AtsXNavigateItemLauncher;
-import org.eclipse.osee.ats.navigate.SearchNavigateItem;
-import org.eclipse.osee.ats.task.TaskEditor;
-import org.eclipse.osee.ats.task.TaskXViewer;
-import org.eclipse.osee.ats.test.util.CustomizeDemoTableTestUtil;
-import org.eclipse.osee.ats.test.util.DemoTestUtil;
-import org.eclipse.osee.ats.test.util.NavigateTestUtil;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.world.search.TaskSearchWorldSearchItem;
-import org.eclipse.osee.framework.core.enums.Active;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.support.test.util.DemoSawBuilds;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNavigateItemsToTaskEditorTest {
-
- @org.junit.Test
- public void testDemoDatabase() throws Exception {
- DemoTestUtil.setUpTest();
- }
-
- @org.junit.Test
- public void testMyTasksEditor() throws Exception {
- TaskEditor.closeAll();
- // Place holder for future navigate items opening TaskEditor
- // XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("My Tasks (Editor)");
- // handleGeneralDoubleClickAndTestResults(item, TaskArtifact.class, DemoDbTasks.getNumTasks());
- }
-
- @org.junit.Test
- public void testTaskSearch() throws Exception {
- Collection<TeamDefinitionArtifact> selectedUsers =
- TeamDefinitionArtifact.getTeamTopLevelDefinitions(Active.Active);
- TaskEditor.closeAll();
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Task Search");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof TaskSearchWorldSearchItem);
- handleGeneralDoubleClickAndTestResults(item, TaskSearchWorldSearchItem.class, 0,
- TableLoadOption.DontCopySearchItem);
- runGeneralTaskSearchOnCompletedCancelledTest(item, true, 14);
- runGeneralTaskSearchOnCompletedCancelledTest(item, false, 0);
- runGeneralTaskSearchOnTeamTest(item, selectedUsers, 0);
- selectedUsers.clear();
- List<String> teamDefs = new ArrayList<String>();
- teamDefs.add("SAW Code");
- Set<TeamDefinitionArtifact> tda = TeamDefinitionArtifact.getTeamDefinitions(teamDefs);
- runGeneralTaskSearchOnTeamTest(item, tda, 14);
- runGeneralTaskSearchOnAssigneeTest(item, "Joe Smith", 14);
- runGeneralTaskSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_1.getName(), 0);
- runGeneralTaskSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_2.getName(), 14);
- selectedUsers.clear();
- runGeneralTaskSearchOnTeamTest(item, selectedUsers, 14);
- runGeneralTaskSearchOnAssigneeTest(item, "Kay Jones", 8);
-
- }
-
- public void runGeneralTaskSearchTest(XNavigateItem item, int expectedNum) throws Exception {
- TaskEditor editor = getSingleEditorOrFail();
- editor.getTaskActionPage().reSearch();
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), expectedNum, arts.size());
- }
-
- public void runGeneralTaskSearchOnAssigneeTest(XNavigateItem item, String assignee, int expectedNum) throws Exception {
- TaskEditor editor = getSingleEditorOrFail();
- ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setSelectedUser(UserManager.getUserByName(assignee));
- runGeneralTaskSearchTest(item, expectedNum);
- }
-
- public void runGeneralTaskSearchOnTeamTest(XNavigateItem item, Collection<TeamDefinitionArtifact> selectedUsers, int expectedNum) throws Exception {
- // need to set team selected users
- TaskEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getTaskActionPage().getDynamicWidgetLayoutListener();
- ((TaskSearchWorldSearchItem) dwl).setSelectedTeamDefinitions(selectedUsers);
- runGeneralTaskSearchTest(item, expectedNum);
- }
-
- public void runGeneralTaskSearchOnVersionTest(XNavigateItem item, String versionString, int expectedNum) throws Exception {
- TaskEditor editor = getSingleEditorOrFail();
- ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setVersion(versionString);
- runGeneralTaskSearchTest(item, expectedNum);
- }
-
- public void runGeneralTaskSearchOnCompletedCancelledTest(XNavigateItem item, boolean selected, int expectedNum) throws Exception {
- Artifact groupArt =
- ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.UniversalGroup, "Test Group",
- AtsUtil.getAtsBranch());
- Set<Artifact> selectedUsers = new HashSet<Artifact>();
- TaskEditor editor = getSingleEditorOrFail();
- ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setIncludeCompletedCancelledCheckbox(selected);
- if (selected) {
- // select the group
- selectedUsers.add(groupArt);
- ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setSelectedGroups(selectedUsers);
- } else {
- // clear the group selected
- ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).handleSelectedGroupsClear();
- }
- runGeneralTaskSearchTest(item, expectedNum);
- }
-
- public void handleGeneralDoubleClickAndTestResults(XNavigateItem item, Class<?> clazz, int numOfType, TableLoadOption tableLoadOption) throws OseeCoreException {
- AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI, tableLoadOption);
- TaskEditor taskEditor = getSingleEditorOrFail();
- assertTrue(taskEditor != null);
- Collection<Artifact> arts = taskEditor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, clazz, numOfType);
- }
-
- public TaskEditor getSingleEditorOrFail() throws OseeCoreException {
- // Retrieve results from opened editor and test
- Collection<TaskEditor> editors = TaskEditor.getEditors();
- assertTrue("Expecting 1 editor open, currently " + editors.size(), editors.size() == 1);
-
- return editors.iterator().next();
- }
-
- public TaskXViewer getXViewer() throws OseeCoreException {
- return getSingleEditorOrFail().getTaskActionPage().getTaskComposite().getTaskXViewer();
- }
-
- public void handleTableCustomization() throws OseeCoreException {
- // add all columns
- CustomizeDemoTableTestUtil cdialog = new CustomizeDemoTableTestUtil(getXViewer());
- cdialog.createDialogArea(getSingleEditorOrFail().getTaskActionPage().getTaskComposite());
- cdialog.handleAddAllItemButtonClick();
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.navigate.AtsXNavigateItemLauncher;
+import org.eclipse.osee.ats.navigate.SearchNavigateItem;
+import org.eclipse.osee.ats.task.TaskEditor;
+import org.eclipse.osee.ats.task.TaskXViewer;
+import org.eclipse.osee.ats.test.util.CustomizeDemoTableTestUtil;
+import org.eclipse.osee.ats.test.util.DemoTestUtil;
+import org.eclipse.osee.ats.test.util.NavigateTestUtil;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.search.TaskSearchWorldSearchItem;
+import org.eclipse.osee.framework.core.enums.Active;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.support.test.util.DemoSawBuilds;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNavigateItemsToTaskEditorTest {
+
+ @org.junit.Test
+ public void testDemoDatabase() throws Exception {
+ DemoTestUtil.setUpTest();
+ }
+
+ @org.junit.Test
+ public void testMyTasksEditor() throws Exception {
+ TaskEditor.closeAll();
+ // Place holder for future navigate items opening TaskEditor
+ // XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("My Tasks (Editor)");
+ // handleGeneralDoubleClickAndTestResults(item, TaskArtifact.class, DemoDbTasks.getNumTasks());
+ }
+
+ @org.junit.Test
+ public void testTaskSearch() throws Exception {
+ Collection<TeamDefinitionArtifact> selectedUsers =
+ TeamDefinitionArtifact.getTeamTopLevelDefinitions(Active.Active);
+ TaskEditor.closeAll();
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Task Search");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof TaskSearchWorldSearchItem);
+ handleGeneralDoubleClickAndTestResults(item, TaskSearchWorldSearchItem.class, 0,
+ TableLoadOption.DontCopySearchItem);
+ runGeneralTaskSearchOnCompletedCancelledTest(item, true, 14);
+ runGeneralTaskSearchOnCompletedCancelledTest(item, false, 0);
+ runGeneralTaskSearchOnTeamTest(item, selectedUsers, 0);
+ selectedUsers.clear();
+ List<String> teamDefs = new ArrayList<String>();
+ teamDefs.add("SAW Code");
+ Set<TeamDefinitionArtifact> tda = TeamDefinitionArtifact.getTeamDefinitions(teamDefs);
+ runGeneralTaskSearchOnTeamTest(item, tda, 14);
+ runGeneralTaskSearchOnAssigneeTest(item, "Joe Smith", 14);
+ runGeneralTaskSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_1.getName(), 0);
+ runGeneralTaskSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_2.getName(), 14);
+ selectedUsers.clear();
+ runGeneralTaskSearchOnTeamTest(item, selectedUsers, 14);
+ runGeneralTaskSearchOnAssigneeTest(item, "Kay Jones", 8);
+
+ }
+
+ public void runGeneralTaskSearchTest(XNavigateItem item, int expectedNum) throws Exception {
+ TaskEditor editor = getSingleEditorOrFail();
+ editor.getTaskActionPage().reSearch();
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), expectedNum, arts.size());
+ }
+
+ public void runGeneralTaskSearchOnAssigneeTest(XNavigateItem item, String assignee, int expectedNum) throws Exception {
+ TaskEditor editor = getSingleEditorOrFail();
+ ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setSelectedUser(UserManager.getUserByName(assignee));
+ runGeneralTaskSearchTest(item, expectedNum);
+ }
+
+ public void runGeneralTaskSearchOnTeamTest(XNavigateItem item, Collection<TeamDefinitionArtifact> selectedUsers, int expectedNum) throws Exception {
+ // need to set team selected users
+ TaskEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getTaskActionPage().getDynamicWidgetLayoutListener();
+ ((TaskSearchWorldSearchItem) dwl).setSelectedTeamDefinitions(selectedUsers);
+ runGeneralTaskSearchTest(item, expectedNum);
+ }
+
+ public void runGeneralTaskSearchOnVersionTest(XNavigateItem item, String versionString, int expectedNum) throws Exception {
+ TaskEditor editor = getSingleEditorOrFail();
+ ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setVersion(versionString);
+ runGeneralTaskSearchTest(item, expectedNum);
+ }
+
+ public void runGeneralTaskSearchOnCompletedCancelledTest(XNavigateItem item, boolean selected, int expectedNum) throws Exception {
+ Artifact groupArt =
+ ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.UniversalGroup, "Test Group",
+ AtsUtil.getAtsBranch());
+ Set<Artifact> selectedUsers = new HashSet<Artifact>();
+ TaskEditor editor = getSingleEditorOrFail();
+ ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setIncludeCompletedCancelledCheckbox(selected);
+ if (selected) {
+ // select the group
+ selectedUsers.add(groupArt);
+ ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).setSelectedGroups(selectedUsers);
+ } else {
+ // clear the group selected
+ ((TaskSearchWorldSearchItem) editor.getTaskActionPage().getDynamicWidgetLayoutListener()).handleSelectedGroupsClear();
+ }
+ runGeneralTaskSearchTest(item, expectedNum);
+ }
+
+ public void handleGeneralDoubleClickAndTestResults(XNavigateItem item, Class<?> clazz, int numOfType, TableLoadOption tableLoadOption) throws OseeCoreException {
+ AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI, tableLoadOption);
+ TaskEditor taskEditor = getSingleEditorOrFail();
+ assertTrue(taskEditor != null);
+ Collection<Artifact> arts = taskEditor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, clazz, numOfType);
+ }
+
+ public TaskEditor getSingleEditorOrFail() throws OseeCoreException {
+ // Retrieve results from opened editor and test
+ Collection<TaskEditor> editors = TaskEditor.getEditors();
+ assertTrue("Expecting 1 editor open, currently " + editors.size(), editors.size() == 1);
+
+ return editors.iterator().next();
+ }
+
+ public TaskXViewer getXViewer() throws OseeCoreException {
+ return getSingleEditorOrFail().getTaskActionPage().getTaskComposite().getTaskXViewer();
+ }
+
+ public void handleTableCustomization() throws OseeCoreException {
+ // add all columns
+ CustomizeDemoTableTestUtil cdialog = new CustomizeDemoTableTestUtil(getXViewer());
+ cdialog.createDialogArea(getSingleEditorOrFail().getTaskActionPage().getTaskComposite());
+ cdialog.handleAddAllItemButtonClick();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToWorldViewTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToWorldViewTest.java
index 57669a0f0fe..873ffb7dfce 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToWorldViewTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNavigateItemsToWorldViewTest.java
@@ -1,674 +1,674 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.assertTrue;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.artifact.StateMachineArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.VersionArtifact;
-import org.eclipse.osee.ats.editor.SMAEditor;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.navigate.AtsXNavigateItemLauncher;
-import org.eclipse.osee.ats.navigate.SearchNavigateItem;
-import org.eclipse.osee.ats.navigate.TeamWorkflowSearchWorkflowSearchItem;
-import org.eclipse.osee.ats.navigate.UserSearchWorkflowSearchItem;
-import org.eclipse.osee.ats.navigate.VisitedItems;
-import org.eclipse.osee.ats.task.TaskEditor;
-import org.eclipse.osee.ats.task.TaskEditorSimpleProvider;
-import org.eclipse.osee.ats.test.util.CustomizeDemoTableTestUtil;
-import org.eclipse.osee.ats.test.util.DemoTestUtil;
-import org.eclipse.osee.ats.test.util.NavigateTestUtil;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.world.WorldEditor;
-import org.eclipse.osee.ats.world.WorldXViewer;
-import org.eclipse.osee.ats.world.search.ActionableItemWorldSearchItem;
-import org.eclipse.osee.ats.world.search.GroupWorldSearchItem;
-import org.eclipse.osee.ats.world.search.NextVersionSearchItem;
-import org.eclipse.osee.ats.world.search.ShowOpenWorkflowsByArtifactType;
-import org.eclipse.osee.ats.world.search.StateWorldSearchItem;
-import org.eclipse.osee.ats.world.search.UserCommunitySearchItem;
-import org.eclipse.osee.ats.world.search.UserSearchItem;
-import org.eclipse.osee.ats.world.search.VersionTargetedForTeamSearchItem;
-import org.eclipse.osee.ats.world.search.TeamWorldSearchItem.ReleasedOption;
-import org.eclipse.osee.ats.world.search.UserWorldSearchItem.UserSearchOption;
-import org.eclipse.osee.framework.core.enums.Active;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
-import org.eclipse.osee.support.test.util.AtsUserCommunity;
-import org.eclipse.osee.support.test.util.DemoSawBuilds;
-import org.eclipse.osee.support.test.util.DemoUsers;
-import org.eclipse.swt.widgets.TreeItem;
-import org.junit.Ignore;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNavigateItemsToWorldViewTest {
-
- @org.junit.Test
- public void testDemoDatabase() throws Exception {
- VisitedItems.clearVisited();
- DemoTestUtil.setUpTest();
- assertTrue(DemoTestUtil.getDemoUser(DemoUsers.Kay_Jones) != null);
- }
-
- @org.junit.Test
- public void testAttributeDeletion() throws Exception {
- Collection<Artifact> arts = runGeneralLoadingTest("My Favorites", TeamWorkFlowArtifact.class, 3, null);
- arts.clear();
- NavigateTestUtil.getAllArtifactChildren(getXViewer().getTree().getItems(), arts);
- // delete an artifact, look for expected !Errors in the XCol
- deleteAttributesForXColErrorTest(arts, "ats.Team Definition");
- deleteAttributesForXColErrorTest(arts, "ats.Actionable Item");
- deleteAttributesForXColErrorTest(arts, "ats.Change Type");
- }
-
- @org.junit.Test
- public void testMyWorld() throws Exception {
- runGeneralLoadingTest("My World", StateMachineArtifact.class, 11, null);
- runGeneralXColTest(28, false);
- }
-
- private XNavigateItem openUserSearchEditor() throws Exception {
- WorldEditor.closeAll();
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("User Search");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof UserSearchWorkflowSearchItem);
- AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
- return item;
- }
-
- @org.junit.Test
- public void testSearchMyFavorites() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- UserSearchWorkflowSearchItem dwl =
- (UserSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- dwl.setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
- dwl.setSelected(UserSearchOption.Favorites, true);
- runGeneralUserSearchTest(item, 3);
- runGeneralXColTest(20, false);
- // test the task tab - this is being done via open ats task editor
- runGeneralXColTest(20, true);
- // Open all three favorites
- editor.getWorldXWidgetActionPage().reSearch(true);
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- for (Artifact artifact : arts) {
- SMAEditor.editArtifact(artifact);
- }
- // Test that recently visited returns all three
- Collection<Artifact> artsLoaded = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), artsLoaded, TeamWorkFlowArtifact.class, 3);
- runGeneralXColTest(20, false);
- }
-
- @org.junit.Test
- public void testSearchMySubscribed() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Subscribed, true);
- editor.getWorldXWidgetActionPage().reSearch(true);
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), 1, arts.size());
- }
-
- @org.junit.Test
- public void testSearchMyReviews() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
- editor.getWorldXWidgetActionPage().reSearch(true);
-
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 2);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 2);
- runGeneralXColTest(4, false);
- }
-
- @org.junit.Test
- public void testSearchMyReviewsAll() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCompleted, true);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCancelled, true);
- editor.getWorldXWidgetActionPage().reSearch(true);
-
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 2);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 3);
- runGeneralXColTest(5, false);
- }
-
- @org.junit.Test
- public void testSearchMyOriginator() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Originator, true);
- editor.getWorldXWidgetActionPage().reSearch(true);
-
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TaskArtifact.class, DemoTestUtil.getNumTasks());
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TeamWorkFlowArtifact.class, 18);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 7);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 7);
- }
-
- @org.junit.Test
- public void testSearchMyOriginatorAll() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Originator, true);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCompleted, true);
- editor.getWorldXWidgetActionPage().reSearch(true);
-
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TaskArtifact.class, DemoTestUtil.getNumTasks());
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TeamWorkFlowArtifact.class, 25);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 7);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 8);
- runGeneralXColTest(84, false);
- }
-
- public void runGeneralUserSearchTest(XNavigateItem item, int expectedNum) throws Exception {
- WorldEditor editor = getSingleEditorOrFail();
- editor.getWorldXWidgetActionPage().reSearch(true);
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- // validate
- NavigateTestUtil.testExpectedVersusActual(item.getName(), expectedNum, arts.size());
- }
-
- @org.junit.Test
- public void testSearchMyCompleted() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- UserSearchWorkflowSearchItem dwl =
- (UserSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- dwl.setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
- dwl.setSelected(UserSearchOption.IncludeCompleted, true);
- dwl.setSelected(UserSearchOption.IncludeTasks, false);
- editor.getWorldXWidgetActionPage().reSearch(true);
-
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TeamWorkFlowArtifact.class, 7);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 2);
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 3);
- runGeneralXColTest(29, false);
- }
-
- @org.junit.Test
- public void testMyRecentlyVisited() throws Exception {
- // Load Recently Visited
- runGeneralLoadingTest("My Recently Visited", TeamWorkFlowArtifact.class, 3, null);
- }
-
- @org.junit.Test
- public void testOtherUsersWorld() throws Exception {
- OseeLog.log(AtsPlugin.class, Level.INFO,
- "Testing User's items relating to " + DemoTestUtil.getDemoUser(DemoUsers.Kay_Jones));
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItems("User's World").iterator().next();
- runGeneralLoadingTest(item, StateMachineArtifact.class, 8, DemoTestUtil.getDemoUser(DemoUsers.Kay_Jones));
- }
-
- @org.junit.Test
- public void testSearchOtherUserReviews() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
- editor.getWorldXWidgetActionPage().reSearch(true);
-
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 1);
- }
-
- @org.junit.Test
- public void testSearchOtherUserAllReviews() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCompleted, false);
- editor.getWorldXWidgetActionPage().reSearch(true);
-
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 1);
- }
-
- @org.junit.Test
- public void testSearchOtherUserFavorites() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Favorites, true);
- editor.getWorldXWidgetActionPage().reSearch(true);
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), 0, arts.size());
- }
-
- @org.junit.Test
- public void testSearchOtherUserSubscribed() throws Exception {
- XNavigateItem item = openUserSearchEditor();
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
- ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Subscribed, true);
- editor.getWorldXWidgetActionPage().reSearch(true);
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), 0, arts.size());
- }
-
- @org.junit.Test
- public void testGroupsSearch() throws Exception {
- WorldEditor.closeAll();
- Artifact groupArt =
- ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.UniversalGroup, "Test Group",
- AtsUtil.getAtsBranch());
- assertTrue(groupArt != null);
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Group Search");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof GroupWorldSearchItem);
- ((GroupWorldSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedGroup(groupArt);
- AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
- WorldEditor worldEditor = getSingleEditorOrFail();
- Collection<Artifact> arts = worldEditor.getLoadedArtifacts();
-
- NavigateTestUtil.testExpectedVersusActual(item.getName() + " Actions", arts, ActionArtifact.class, 2);
- NavigateTestUtil.testExpectedVersusActual(item.getName() + " Teams", arts, TeamWorkFlowArtifact.class, 7);
- NavigateTestUtil.testExpectedVersusActual(item.getName() + " Tasks", arts, TaskArtifact.class,
- DemoTestUtil.getNumTasks());
- }
-
- @org.junit.Test
- public void testTeamWorkflowSearch() throws Exception {
- List<TeamDefinitionArtifact> selectedTeamDefs = TeamDefinitionArtifact.getTeamTopLevelDefinitions(Active.Active);
- WorldEditor.closeAll();
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Team Workflow Search");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof TeamWorkflowSearchWorkflowSearchItem);
- AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
- runGeneralTeamWorkflowSearchOnTeamTest(item, selectedTeamDefs, 1);
- runGeneralTeamWorkflowSearchOnCompletedCancelledTest(item, true, 2);
- runGeneralTeamWorkflowSearchOnCompletedCancelledTest(item, false, 1);
- runGeneralTeamWorkflowSearchOnAssigneeTest(item, "Joe Smith", 0);
- selectedTeamDefs.clear();
- runGeneralTeamWorkflowSearchOnTeamTest(item, selectedTeamDefs, 7);
- runGeneralTeamWorkflowSearchOnReleasedTest(item, ReleasedOption.UnReleased, 7);
- runGeneralTeamWorkflowSearchOnAssigneeTest(item, "Kay Jones", 6);
- runGeneralTeamWorkflowSearchOnReleasedTest(item, ReleasedOption.Released, 0);
- runGeneralTeamWorkflowSearchOnReleasedTest(item, ReleasedOption.Both, 6);
- List<String> teamDefs = new ArrayList<String>();
- teamDefs.add("SAW Test");
- teamDefs.add("SAW Design");
- Set<TeamDefinitionArtifact> tda = TeamDefinitionArtifact.getTeamDefinitions(teamDefs);
- runGeneralTeamWorkflowSearchOnTeamTest(item, tda, 3);
- runGeneralTeamWorkflowSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_1.getName(), 0);
- runGeneralTeamWorkflowSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_2.getName(), 3);
- selectedTeamDefs.clear();
- runGeneralTeamWorkflowSearchOnTeamTest(item, selectedTeamDefs, 6);
- }
-
- public void runGeneralTeamWorkflowSearchTest(XNavigateItem item, int expectedNum) throws Exception {
- WorldEditor editor = getSingleEditorOrFail();
- editor.getWorldXWidgetActionPage().reSearch(true);
- Collection<Artifact> arts = editor.getLoadedArtifacts();
- // validate
- NavigateTestUtil.testExpectedVersusActual(item.getName(), expectedNum, arts.size());
- }
-
- public void runGeneralTeamWorkflowSearchOnAssigneeTest(XNavigateItem item, String assignee, int expectedNum) throws Exception {
- WorldEditor editor = getSingleEditorOrFail();
- ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).setSelectedUser(UserManager.getUserByName(assignee));
- runGeneralTeamWorkflowSearchTest(item, expectedNum);
- }
-
- public void runGeneralTeamWorkflowSearchOnTeamTest(XNavigateItem item, Collection<TeamDefinitionArtifact> selectedTeamDefs, int expectedNum) throws Exception {
- // need to set team selected users
- WorldEditor editor = getSingleEditorOrFail();
- IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
- ((TeamWorkflowSearchWorkflowSearchItem) dwl).setSelectedTeamDefinitions(selectedTeamDefs);
- runGeneralTeamWorkflowSearchTest(item, expectedNum);
- }
-
- public void runGeneralTeamWorkflowSearchOnReleasedTest(XNavigateItem item, ReleasedOption released, int expectedNum) throws Exception {
- WorldEditor editor = getSingleEditorOrFail();
- ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).setSelectedReleased(released);
- runGeneralTeamWorkflowSearchTest(item, expectedNum);
- }
-
- public void runGeneralTeamWorkflowSearchOnVersionTest(XNavigateItem item, String versionString, int expectedNum) throws Exception {
- WorldEditor editor = getSingleEditorOrFail();
- ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).setVersion(versionString);
- runGeneralTeamWorkflowSearchTest(item, expectedNum);
- }
-
- public void runGeneralTeamWorkflowSearchOnCompletedCancelledTest(XNavigateItem item, boolean selected, int expectedNum) throws Exception {
- WorldEditor editor = getSingleEditorOrFail();
- ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).includeCompletedCancelledCheckbox(selected);
- runGeneralTeamWorkflowSearchTest(item, expectedNum);
- }
-
- @Ignore
- @org.junit.Test
- public void testUserCommunitySearch() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("User Community Search");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof UserCommunitySearchItem);
- ((UserCommunitySearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedUserComm(AtsUserCommunity.Program_2.name());
- // normal searches copy search item which would clear out the set value above; for this test, don't copy item
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 4, null, TableLoadOption.DontCopySearchItem);
- }
-
- @org.junit.Test
- public void testActionableItemSearch() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Actionable Item Search");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ActionableItemWorldSearchItem);
- ((ActionableItemWorldSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedActionItems(ActionableItemArtifact.getActionableItems(Arrays.asList("SAW Code")));
- // normal searches copy search item which would clear out the set value above; for this test, don't copy item
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 3, null, TableLoadOption.DontCopySearchItem);
- }
-
- @org.junit.Test
- public void testTargetedForVersionTeamSearch() throws Exception {
- List<XNavigateItem> items = NavigateTestUtil.getAtsNavigateItems("Workflows Targeted-For Version");
- // First one is the global one
- XNavigateItem item = items.iterator().next();
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof VersionTargetedForTeamSearchItem);
- ((VersionTargetedForTeamSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedVersionArt(VersionArtifact.getVersions(
- Arrays.asList(DemoSawBuilds.SAW_Bld_2.getName())).iterator().next());
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 14, null, TableLoadOption.DontCopySearchItem);
- }
-
- @org.junit.Test
- public void testTargetedForTeamSearch() throws Exception {
- List<XNavigateItem> items = NavigateTestUtil.getAtsNavigateItems("Workflows Targeted-For Next Version");
- // First one is the global one
- XNavigateItem item = items.iterator().next();
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof NextVersionSearchItem);
- ((NextVersionSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedTeamDef(TeamDefinitionArtifact.getTeamDefinitions(
- Arrays.asList("SAW SW")).iterator().next());
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 14, null, TableLoadOption.DontCopySearchItem);
- }
-
- @org.junit.Test
- public void testShowOpenDecisionReviewsSearch() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Open Decision Reviews");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
- runGeneralLoadingTest(item, DecisionReviewArtifact.class, 7);
- }
-
- @org.junit.Test
- public void testShowWorkflowsWaitingForDecisionReviewsSearch() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Workflows Waiting Decision Reviews");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 7);
- }
-
- @org.junit.Test
- public void testShowOpenPeerToPeerReviewsSearch() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Open PeerToPeer Reviews");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
- runGeneralLoadingTest(item, PeerToPeerReviewArtifact.class, 7);
- }
-
- @org.junit.Test
- public void testShowWorkflowsWaitingForPeerToPeerReviewsSearch() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Workflows Waiting PeerToPeer Reviews");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 6);
- }
-
- @org.junit.Test
- public void testSearchByCurrentState() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Search by Current State");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof StateWorldSearchItem);
- ((StateWorldSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedStateClass("Implement");
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 17, null, TableLoadOption.DontCopySearchItem);
- }
-
- @org.junit.Test
- public void testSearchForAuthorizeActions() throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Search for Authorize Actions");
- assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof StateWorldSearchItem);
- runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 0);
- }
-
- public Collection<Artifact> runGeneralLoadingTest(String xNavigateItemName, Class<?> clazz, int numOfType, User user) throws Exception {
- XNavigateItem item = NavigateTestUtil.getAtsNavigateItem(xNavigateItemName);
- return runGeneralLoadingTest(item, clazz, numOfType, user);
- }
-
- public Collection<Artifact> runGeneralLoadingTest(XNavigateItem item, Class<?> clazz, int numOfType) throws Exception {
- return runGeneralLoadingTest(item, clazz, numOfType, null);
- }
-
- public Collection<Artifact> runGeneralLoadingTest(XNavigateItem item, Class<?> clazz, int numOfType, User user) throws Exception {
- return runGeneralLoadingTest(item, clazz, numOfType, user, TableLoadOption.None);
- }
-
- public Collection<Artifact> runGeneralLoadingTest(XNavigateItem item, Class<?> clazz, int numOfType, User user, TableLoadOption tableLoadOption) throws Exception {
- WorldEditor.closeAll();
- // Find the correct navigate item
- if (user != null && item instanceof SearchNavigateItem) {
- if (((SearchNavigateItem) item).getWorldSearchItem() instanceof UserSearchItem) {
- ((UserSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedUser(user);
- }
- }
- // Simulate double-click of navigate item
- AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI, tableLoadOption);
-
- WorldEditor worldEditor = getSingleEditorOrFail();
- Collection<Artifact> arts = worldEditor.getLoadedArtifacts();
- NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, clazz, numOfType);
- return arts;
- }
-
- public void runGeneralXColTest(int itemCount, boolean testTaskTab) throws Exception {
- int itemCnt, beforeSize, afterSize = 0;
- XViewer xv = getXViewer();
- xv.expandAll();
- itemCnt = xv.getVisibleItemCount(xv.getTree().getItems());
- NavigateTestUtil.testExpectedVersusActual("Item Count - ", itemCount, itemCnt);
- beforeSize = getXViewer().getCustomizeMgr().getCurrentVisibleTableColumns().size();
- // show all columns
- handleTableCustomization();
- afterSize = getXViewer().getCustomizeMgr().getCurrentVisibleTableColumns().size();
- NavigateTestUtil.testExpectedVersusActual("Column Count - ", true, (afterSize >= beforeSize));
- runGeneralXColTest(itemCount, false, "", testTaskTab);
- }
-
- public void runGeneralXColTest(int expected, boolean isErrorCheck, String attributeToDelete, boolean testTaskTab) throws OseeCoreException {
- List<Artifact> arts = new ArrayList<Artifact>();
- List<Artifact> taskArts = new ArrayList<Artifact>();
- List<XViewerColumn> columns = getXViewer().getCustomizeMgr().getCurrentTableColumns();
- ITableLabelProvider labelProv = (ITableLabelProvider) getXViewer().getLabelProvider();
- // want to check all valid children
- TreeItem[] treeItem = getXViewer().getTree().getItems();
- NavigateTestUtil.getAllArtifactChildren(treeItem, arts);
- NavigateTestUtil.testExpectedVersusActual("Number of Artifacts - ", expected, arts.size());
- // are we running the fault case?
- if (testTaskTab) {
- getXViewer().expandAll();
- arts.clear();
- // grab the Task Artifacts and set them as selected
- this.getAllTreeItems(getXViewer().getTree().getItems(), taskArts);
- // open the task in the Task Editor
- TaskEditor.open(new TaskEditorSimpleProvider("ATS Tasks", getXViewer().getSelectedTaskArtifacts()));
- handleTableCustomization();
- columns = getXViewer().getCustomizeMgr().getCurrentTableColumns();
- verifyXColumns(labelProv, arts, columns);
- } else if (isErrorCheck) {
- verifyXColumnsHasErrors(labelProv, arts, columns, attributeToDelete);
- } else {
- verifyXColumns(labelProv, arts, columns);
- }
- }
-
- public void getAllTreeItems(TreeItem[] treeItem, List<Artifact> taskArts) throws OseeCoreException {
- for (TreeItem item : treeItem) {
- if (item.getData() instanceof Artifact) {
- if (((Artifact) item.getData()).isOfType(AtsArtifactTypes.Task)) {
- getXViewer().getTree().setSelection(item);
- taskArts.add((Artifact) item.getData());
- }
- }
- if (item.getExpanded()) {
- getAllTreeItems(item.getItems(), taskArts);
- }
- }
- }
-
- public WorldEditor getSingleEditorOrFail() throws OseeCoreException {
- // Retrieve results from opened editor and test
- Collection<WorldEditor> editors = WorldEditor.getEditors();
- assertTrue("Expecting 1 editor open, currently " + editors.size(), editors.size() == 1);
-
- return editors.iterator().next();
- }
-
- public WorldXViewer getXViewer() throws OseeCoreException {
- return getSingleEditorOrFail().getWorldComposite().getXViewer();
- }
-
- public void handleTableCustomization() throws OseeCoreException {
- // add all columns
- CustomizeDemoTableTestUtil cdialog = new CustomizeDemoTableTestUtil(getXViewer());
- cdialog.createDialogArea(getSingleEditorOrFail().getWorldComposite());
- cdialog.handleAddAllItemButtonClick();
- }
-
- public void deleteAttributesForXColErrorTest(Collection<Artifact> arts, String attributeToDelete) throws Exception {
- Map<Artifact, Object> attributeValues = new HashMap<Artifact, Object>();
- getXViewer().expandAll();
- handleTableCustomization();
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Navigate Test");
- // select a workflow artifact; get its attributes; delete an attribute
- for (Artifact art : arts) {
- attributeValues.put(art, art.getSoleAttributeValue(attributeToDelete));
- art.deleteAttribute(attributeToDelete, art.getSoleAttributeValue(attributeToDelete));
- art.persist(transaction);
- }
- transaction.execute();
- try {
- runGeneralXColTest(20, true, attributeToDelete, false);
- } finally {
- transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Navigate Test");
- // restore the attribute to leave the demo db back in its original state
- for (Artifact art : arts) {
- art.setSoleAttributeValue(attributeToDelete, attributeValues.get(art));
- art.persist(transaction);
- }
- transaction.execute();
- }
- }
-
- public void verifyXColumnsHasErrors(ITableLabelProvider labelProv, List<Artifact> arts, List<XViewerColumn> columns, String attributeToDelete) throws OseeCoreException {
- List<String> actualErrorCols = new ArrayList<String>();
- for (XViewerColumn xCol : columns) {
- verifyArtifactsHasErrors(labelProv, arts, xCol, getXViewer().getCustomizeMgr().getColumnNumFromXViewerColumn(
- xCol), attributeToDelete, actualErrorCols);
- }
- if (!attributeToDelete.equals("ats.Current State") && !attributeToDelete.equals("ats.Priority")) {
- verifyXCol1HasErrors(actualErrorCols);
- } else {
- verifyXCol2HasErrors(actualErrorCols);
- }
- }
-
- public void verifyXCol1HasErrors(List<String> actualErrorCols) {
- int index = 0;
- for (String col : actualErrorCols) {
- NavigateTestUtil.testExpectedVersusActual("Expected xCol errors", true,
- NavigateTestUtil.expectedErrorCols1[index++].contains(col));
- }
- }
-
- public void verifyXCol2HasErrors(List<String> actualErrorCols) {
- int index = 0;
- NavigateTestUtil.testExpectedVersusActual("Expected number of xCol errors",
- NavigateTestUtil.expectedErrorCols2.length, actualErrorCols.size());
- for (String col : actualErrorCols) {
- NavigateTestUtil.testExpectedVersusActual("Expected xCol errors", true,
- NavigateTestUtil.expectedErrorCols2[index++].equals(col));
- }
- }
-
- public void verifyXColumns(ITableLabelProvider labelProv, Collection<Artifact> arts, List<XViewerColumn> columns) throws OseeCoreException {
- for (XViewerColumn xCol : columns) {
- verifyArtifact(labelProv, arts, getXViewer().getCustomizeMgr().getColumnNumFromXViewerColumn(xCol));
- }
- }
-
- public void verifyArtifact(ITableLabelProvider labelProv, Collection<Artifact> arts, int colIndex) {
- for (Artifact art : arts) {
- String colText = labelProv.getColumnText(art, colIndex);
- NavigateTestUtil.testExpectedVersusActual("No Error in XCol expected", true, !colText.contains("!Error"));
- }
- }
-
- public void verifyArtifactsHasErrors(ITableLabelProvider labelProv, Collection<Artifact> arts, XViewerColumn xCol, int colIndex, String attributeToDelete, List<String> actualErrorCols) throws OseeCoreException {
- for (Artifact art : arts) {
- String colText = labelProv.getColumnText(art, colIndex);
- if (art.isOfType("Demo Code Team Workflow")) {
- if (colText.contains("!Error")) {
- if (!actualErrorCols.contains(xCol.getId())) {
- actualErrorCols.add(xCol.getId());
- }
- }
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.assertTrue;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.XViewerColumn;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
+import org.eclipse.osee.ats.artifact.StateMachineArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.VersionArtifact;
+import org.eclipse.osee.ats.editor.SMAEditor;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.navigate.AtsXNavigateItemLauncher;
+import org.eclipse.osee.ats.navigate.SearchNavigateItem;
+import org.eclipse.osee.ats.navigate.TeamWorkflowSearchWorkflowSearchItem;
+import org.eclipse.osee.ats.navigate.UserSearchWorkflowSearchItem;
+import org.eclipse.osee.ats.navigate.VisitedItems;
+import org.eclipse.osee.ats.task.TaskEditor;
+import org.eclipse.osee.ats.task.TaskEditorSimpleProvider;
+import org.eclipse.osee.ats.test.util.CustomizeDemoTableTestUtil;
+import org.eclipse.osee.ats.test.util.DemoTestUtil;
+import org.eclipse.osee.ats.test.util.NavigateTestUtil;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.world.WorldEditor;
+import org.eclipse.osee.ats.world.WorldXViewer;
+import org.eclipse.osee.ats.world.search.ActionableItemWorldSearchItem;
+import org.eclipse.osee.ats.world.search.GroupWorldSearchItem;
+import org.eclipse.osee.ats.world.search.NextVersionSearchItem;
+import org.eclipse.osee.ats.world.search.ShowOpenWorkflowsByArtifactType;
+import org.eclipse.osee.ats.world.search.StateWorldSearchItem;
+import org.eclipse.osee.ats.world.search.UserCommunitySearchItem;
+import org.eclipse.osee.ats.world.search.UserSearchItem;
+import org.eclipse.osee.ats.world.search.VersionTargetedForTeamSearchItem;
+import org.eclipse.osee.ats.world.search.TeamWorldSearchItem.ReleasedOption;
+import org.eclipse.osee.ats.world.search.UserWorldSearchItem.UserSearchOption;
+import org.eclipse.osee.framework.core.enums.Active;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateComposite.TableLoadOption;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.IDynamicWidgetLayoutListener;
+import org.eclipse.osee.support.test.util.AtsUserCommunity;
+import org.eclipse.osee.support.test.util.DemoSawBuilds;
+import org.eclipse.osee.support.test.util.DemoUsers;
+import org.eclipse.swt.widgets.TreeItem;
+import org.junit.Ignore;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNavigateItemsToWorldViewTest {
+
+ @org.junit.Test
+ public void testDemoDatabase() throws Exception {
+ VisitedItems.clearVisited();
+ DemoTestUtil.setUpTest();
+ assertTrue(DemoTestUtil.getDemoUser(DemoUsers.Kay_Jones) != null);
+ }
+
+ @org.junit.Test
+ public void testAttributeDeletion() throws Exception {
+ Collection<Artifact> arts = runGeneralLoadingTest("My Favorites", TeamWorkFlowArtifact.class, 3, null);
+ arts.clear();
+ NavigateTestUtil.getAllArtifactChildren(getXViewer().getTree().getItems(), arts);
+ // delete an artifact, look for expected !Errors in the XCol
+ deleteAttributesForXColErrorTest(arts, "ats.Team Definition");
+ deleteAttributesForXColErrorTest(arts, "ats.Actionable Item");
+ deleteAttributesForXColErrorTest(arts, "ats.Change Type");
+ }
+
+ @org.junit.Test
+ public void testMyWorld() throws Exception {
+ runGeneralLoadingTest("My World", StateMachineArtifact.class, 11, null);
+ runGeneralXColTest(28, false);
+ }
+
+ private XNavigateItem openUserSearchEditor() throws Exception {
+ WorldEditor.closeAll();
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("User Search");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof UserSearchWorkflowSearchItem);
+ AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
+ return item;
+ }
+
+ @org.junit.Test
+ public void testSearchMyFavorites() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ UserSearchWorkflowSearchItem dwl =
+ (UserSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ dwl.setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
+ dwl.setSelected(UserSearchOption.Favorites, true);
+ runGeneralUserSearchTest(item, 3);
+ runGeneralXColTest(20, false);
+ // test the task tab - this is being done via open ats task editor
+ runGeneralXColTest(20, true);
+ // Open all three favorites
+ editor.getWorldXWidgetActionPage().reSearch(true);
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ for (Artifact artifact : arts) {
+ SMAEditor.editArtifact(artifact);
+ }
+ // Test that recently visited returns all three
+ Collection<Artifact> artsLoaded = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), artsLoaded, TeamWorkFlowArtifact.class, 3);
+ runGeneralXColTest(20, false);
+ }
+
+ @org.junit.Test
+ public void testSearchMySubscribed() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Subscribed, true);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), 1, arts.size());
+ }
+
+ @org.junit.Test
+ public void testSearchMyReviews() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 2);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 2);
+ runGeneralXColTest(4, false);
+ }
+
+ @org.junit.Test
+ public void testSearchMyReviewsAll() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCompleted, true);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCancelled, true);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 2);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 3);
+ runGeneralXColTest(5, false);
+ }
+
+ @org.junit.Test
+ public void testSearchMyOriginator() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Originator, true);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TaskArtifact.class, DemoTestUtil.getNumTasks());
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TeamWorkFlowArtifact.class, 18);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 7);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 7);
+ }
+
+ @org.junit.Test
+ public void testSearchMyOriginatorAll() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Originator, true);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCompleted, true);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TaskArtifact.class, DemoTestUtil.getNumTasks());
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TeamWorkFlowArtifact.class, 25);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 7);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 8);
+ runGeneralXColTest(84, false);
+ }
+
+ public void runGeneralUserSearchTest(XNavigateItem item, int expectedNum) throws Exception {
+ WorldEditor editor = getSingleEditorOrFail();
+ editor.getWorldXWidgetActionPage().reSearch(true);
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ // validate
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), expectedNum, arts.size());
+ }
+
+ @org.junit.Test
+ public void testSearchMyCompleted() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ UserSearchWorkflowSearchItem dwl =
+ (UserSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ dwl.setSelectedUser(UserManager.getUser(DemoUsers.Joe_Smith));
+ dwl.setSelected(UserSearchOption.IncludeCompleted, true);
+ dwl.setSelected(UserSearchOption.IncludeTasks, false);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, TeamWorkFlowArtifact.class, 7);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 2);
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, DecisionReviewArtifact.class, 3);
+ runGeneralXColTest(29, false);
+ }
+
+ @org.junit.Test
+ public void testMyRecentlyVisited() throws Exception {
+ // Load Recently Visited
+ runGeneralLoadingTest("My Recently Visited", TeamWorkFlowArtifact.class, 3, null);
+ }
+
+ @org.junit.Test
+ public void testOtherUsersWorld() throws Exception {
+ OseeLog.log(AtsPlugin.class, Level.INFO,
+ "Testing User's items relating to " + DemoTestUtil.getDemoUser(DemoUsers.Kay_Jones));
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItems("User's World").iterator().next();
+ runGeneralLoadingTest(item, StateMachineArtifact.class, 8, DemoTestUtil.getDemoUser(DemoUsers.Kay_Jones));
+ }
+
+ @org.junit.Test
+ public void testSearchOtherUserReviews() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 1);
+ }
+
+ @org.junit.Test
+ public void testSearchOtherUserAllReviews() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeReviews, true);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTeamWorkflows, false);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeTasks, false);
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.IncludeCompleted, false);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, PeerToPeerReviewArtifact.class, 1);
+ }
+
+ @org.junit.Test
+ public void testSearchOtherUserFavorites() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Favorites, true);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), 0, arts.size());
+ }
+
+ @org.junit.Test
+ public void testSearchOtherUserSubscribed() throws Exception {
+ XNavigateItem item = openUserSearchEditor();
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((UserSearchWorkflowSearchItem) dwl).setSelectedUser(UserManager.getUser(DemoUsers.Kay_Jones));
+ ((UserSearchWorkflowSearchItem) dwl).setSelected(UserSearchOption.Subscribed, true);
+ editor.getWorldXWidgetActionPage().reSearch(true);
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), 0, arts.size());
+ }
+
+ @org.junit.Test
+ public void testGroupsSearch() throws Exception {
+ WorldEditor.closeAll();
+ Artifact groupArt =
+ ArtifactQuery.getArtifactFromTypeAndName(CoreArtifactTypes.UniversalGroup, "Test Group",
+ AtsUtil.getAtsBranch());
+ assertTrue(groupArt != null);
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Group Search");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof GroupWorldSearchItem);
+ ((GroupWorldSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedGroup(groupArt);
+ AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
+ WorldEditor worldEditor = getSingleEditorOrFail();
+ Collection<Artifact> arts = worldEditor.getLoadedArtifacts();
+
+ NavigateTestUtil.testExpectedVersusActual(item.getName() + " Actions", arts, ActionArtifact.class, 2);
+ NavigateTestUtil.testExpectedVersusActual(item.getName() + " Teams", arts, TeamWorkFlowArtifact.class, 7);
+ NavigateTestUtil.testExpectedVersusActual(item.getName() + " Tasks", arts, TaskArtifact.class,
+ DemoTestUtil.getNumTasks());
+ }
+
+ @org.junit.Test
+ public void testTeamWorkflowSearch() throws Exception {
+ List<TeamDefinitionArtifact> selectedTeamDefs = TeamDefinitionArtifact.getTeamTopLevelDefinitions(Active.Active);
+ WorldEditor.closeAll();
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Team Workflow Search");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof TeamWorkflowSearchWorkflowSearchItem);
+ AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI);
+ runGeneralTeamWorkflowSearchOnTeamTest(item, selectedTeamDefs, 1);
+ runGeneralTeamWorkflowSearchOnCompletedCancelledTest(item, true, 2);
+ runGeneralTeamWorkflowSearchOnCompletedCancelledTest(item, false, 1);
+ runGeneralTeamWorkflowSearchOnAssigneeTest(item, "Joe Smith", 0);
+ selectedTeamDefs.clear();
+ runGeneralTeamWorkflowSearchOnTeamTest(item, selectedTeamDefs, 7);
+ runGeneralTeamWorkflowSearchOnReleasedTest(item, ReleasedOption.UnReleased, 7);
+ runGeneralTeamWorkflowSearchOnAssigneeTest(item, "Kay Jones", 6);
+ runGeneralTeamWorkflowSearchOnReleasedTest(item, ReleasedOption.Released, 0);
+ runGeneralTeamWorkflowSearchOnReleasedTest(item, ReleasedOption.Both, 6);
+ List<String> teamDefs = new ArrayList<String>();
+ teamDefs.add("SAW Test");
+ teamDefs.add("SAW Design");
+ Set<TeamDefinitionArtifact> tda = TeamDefinitionArtifact.getTeamDefinitions(teamDefs);
+ runGeneralTeamWorkflowSearchOnTeamTest(item, tda, 3);
+ runGeneralTeamWorkflowSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_1.getName(), 0);
+ runGeneralTeamWorkflowSearchOnVersionTest(item, DemoSawBuilds.SAW_Bld_2.getName(), 3);
+ selectedTeamDefs.clear();
+ runGeneralTeamWorkflowSearchOnTeamTest(item, selectedTeamDefs, 6);
+ }
+
+ public void runGeneralTeamWorkflowSearchTest(XNavigateItem item, int expectedNum) throws Exception {
+ WorldEditor editor = getSingleEditorOrFail();
+ editor.getWorldXWidgetActionPage().reSearch(true);
+ Collection<Artifact> arts = editor.getLoadedArtifacts();
+ // validate
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), expectedNum, arts.size());
+ }
+
+ public void runGeneralTeamWorkflowSearchOnAssigneeTest(XNavigateItem item, String assignee, int expectedNum) throws Exception {
+ WorldEditor editor = getSingleEditorOrFail();
+ ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).setSelectedUser(UserManager.getUserByName(assignee));
+ runGeneralTeamWorkflowSearchTest(item, expectedNum);
+ }
+
+ public void runGeneralTeamWorkflowSearchOnTeamTest(XNavigateItem item, Collection<TeamDefinitionArtifact> selectedTeamDefs, int expectedNum) throws Exception {
+ // need to set team selected users
+ WorldEditor editor = getSingleEditorOrFail();
+ IDynamicWidgetLayoutListener dwl = editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener();
+ ((TeamWorkflowSearchWorkflowSearchItem) dwl).setSelectedTeamDefinitions(selectedTeamDefs);
+ runGeneralTeamWorkflowSearchTest(item, expectedNum);
+ }
+
+ public void runGeneralTeamWorkflowSearchOnReleasedTest(XNavigateItem item, ReleasedOption released, int expectedNum) throws Exception {
+ WorldEditor editor = getSingleEditorOrFail();
+ ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).setSelectedReleased(released);
+ runGeneralTeamWorkflowSearchTest(item, expectedNum);
+ }
+
+ public void runGeneralTeamWorkflowSearchOnVersionTest(XNavigateItem item, String versionString, int expectedNum) throws Exception {
+ WorldEditor editor = getSingleEditorOrFail();
+ ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).setVersion(versionString);
+ runGeneralTeamWorkflowSearchTest(item, expectedNum);
+ }
+
+ public void runGeneralTeamWorkflowSearchOnCompletedCancelledTest(XNavigateItem item, boolean selected, int expectedNum) throws Exception {
+ WorldEditor editor = getSingleEditorOrFail();
+ ((TeamWorkflowSearchWorkflowSearchItem) editor.getWorldXWidgetActionPage().getDynamicWidgetLayoutListener()).includeCompletedCancelledCheckbox(selected);
+ runGeneralTeamWorkflowSearchTest(item, expectedNum);
+ }
+
+ @Ignore
+ @org.junit.Test
+ public void testUserCommunitySearch() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("User Community Search");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof UserCommunitySearchItem);
+ ((UserCommunitySearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedUserComm(AtsUserCommunity.Program_2.name());
+ // normal searches copy search item which would clear out the set value above; for this test, don't copy item
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 4, null, TableLoadOption.DontCopySearchItem);
+ }
+
+ @org.junit.Test
+ public void testActionableItemSearch() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Actionable Item Search");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ActionableItemWorldSearchItem);
+ ((ActionableItemWorldSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedActionItems(ActionableItemArtifact.getActionableItems(Arrays.asList("SAW Code")));
+ // normal searches copy search item which would clear out the set value above; for this test, don't copy item
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 3, null, TableLoadOption.DontCopySearchItem);
+ }
+
+ @org.junit.Test
+ public void testTargetedForVersionTeamSearch() throws Exception {
+ List<XNavigateItem> items = NavigateTestUtil.getAtsNavigateItems("Workflows Targeted-For Version");
+ // First one is the global one
+ XNavigateItem item = items.iterator().next();
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof VersionTargetedForTeamSearchItem);
+ ((VersionTargetedForTeamSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedVersionArt(VersionArtifact.getVersions(
+ Arrays.asList(DemoSawBuilds.SAW_Bld_2.getName())).iterator().next());
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 14, null, TableLoadOption.DontCopySearchItem);
+ }
+
+ @org.junit.Test
+ public void testTargetedForTeamSearch() throws Exception {
+ List<XNavigateItem> items = NavigateTestUtil.getAtsNavigateItems("Workflows Targeted-For Next Version");
+ // First one is the global one
+ XNavigateItem item = items.iterator().next();
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof NextVersionSearchItem);
+ ((NextVersionSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedTeamDef(TeamDefinitionArtifact.getTeamDefinitions(
+ Arrays.asList("SAW SW")).iterator().next());
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 14, null, TableLoadOption.DontCopySearchItem);
+ }
+
+ @org.junit.Test
+ public void testShowOpenDecisionReviewsSearch() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Open Decision Reviews");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
+ runGeneralLoadingTest(item, DecisionReviewArtifact.class, 7);
+ }
+
+ @org.junit.Test
+ public void testShowWorkflowsWaitingForDecisionReviewsSearch() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Workflows Waiting Decision Reviews");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 7);
+ }
+
+ @org.junit.Test
+ public void testShowOpenPeerToPeerReviewsSearch() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Open PeerToPeer Reviews");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
+ runGeneralLoadingTest(item, PeerToPeerReviewArtifact.class, 7);
+ }
+
+ @org.junit.Test
+ public void testShowWorkflowsWaitingForPeerToPeerReviewsSearch() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Show Workflows Waiting PeerToPeer Reviews");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof ShowOpenWorkflowsByArtifactType);
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 6);
+ }
+
+ @org.junit.Test
+ public void testSearchByCurrentState() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Search by Current State");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof StateWorldSearchItem);
+ ((StateWorldSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedStateClass("Implement");
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 17, null, TableLoadOption.DontCopySearchItem);
+ }
+
+ @org.junit.Test
+ public void testSearchForAuthorizeActions() throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem("Search for Authorize Actions");
+ assertTrue(((SearchNavigateItem) item).getWorldSearchItem() instanceof StateWorldSearchItem);
+ runGeneralLoadingTest(item, TeamWorkFlowArtifact.class, 0);
+ }
+
+ public Collection<Artifact> runGeneralLoadingTest(String xNavigateItemName, Class<?> clazz, int numOfType, User user) throws Exception {
+ XNavigateItem item = NavigateTestUtil.getAtsNavigateItem(xNavigateItemName);
+ return runGeneralLoadingTest(item, clazz, numOfType, user);
+ }
+
+ public Collection<Artifact> runGeneralLoadingTest(XNavigateItem item, Class<?> clazz, int numOfType) throws Exception {
+ return runGeneralLoadingTest(item, clazz, numOfType, null);
+ }
+
+ public Collection<Artifact> runGeneralLoadingTest(XNavigateItem item, Class<?> clazz, int numOfType, User user) throws Exception {
+ return runGeneralLoadingTest(item, clazz, numOfType, user, TableLoadOption.None);
+ }
+
+ public Collection<Artifact> runGeneralLoadingTest(XNavigateItem item, Class<?> clazz, int numOfType, User user, TableLoadOption tableLoadOption) throws Exception {
+ WorldEditor.closeAll();
+ // Find the correct navigate item
+ if (user != null && item instanceof SearchNavigateItem) {
+ if (((SearchNavigateItem) item).getWorldSearchItem() instanceof UserSearchItem) {
+ ((UserSearchItem) ((SearchNavigateItem) item).getWorldSearchItem()).setSelectedUser(user);
+ }
+ }
+ // Simulate double-click of navigate item
+ AtsXNavigateItemLauncher.handleDoubleClick(item, TableLoadOption.ForcePend, TableLoadOption.NoUI, tableLoadOption);
+
+ WorldEditor worldEditor = getSingleEditorOrFail();
+ Collection<Artifact> arts = worldEditor.getLoadedArtifacts();
+ NavigateTestUtil.testExpectedVersusActual(item.getName(), arts, clazz, numOfType);
+ return arts;
+ }
+
+ public void runGeneralXColTest(int itemCount, boolean testTaskTab) throws Exception {
+ int itemCnt, beforeSize, afterSize = 0;
+ XViewer xv = getXViewer();
+ xv.expandAll();
+ itemCnt = xv.getVisibleItemCount(xv.getTree().getItems());
+ NavigateTestUtil.testExpectedVersusActual("Item Count - ", itemCount, itemCnt);
+ beforeSize = getXViewer().getCustomizeMgr().getCurrentVisibleTableColumns().size();
+ // show all columns
+ handleTableCustomization();
+ afterSize = getXViewer().getCustomizeMgr().getCurrentVisibleTableColumns().size();
+ NavigateTestUtil.testExpectedVersusActual("Column Count - ", true, (afterSize >= beforeSize));
+ runGeneralXColTest(itemCount, false, "", testTaskTab);
+ }
+
+ public void runGeneralXColTest(int expected, boolean isErrorCheck, String attributeToDelete, boolean testTaskTab) throws OseeCoreException {
+ List<Artifact> arts = new ArrayList<Artifact>();
+ List<Artifact> taskArts = new ArrayList<Artifact>();
+ List<XViewerColumn> columns = getXViewer().getCustomizeMgr().getCurrentTableColumns();
+ ITableLabelProvider labelProv = (ITableLabelProvider) getXViewer().getLabelProvider();
+ // want to check all valid children
+ TreeItem[] treeItem = getXViewer().getTree().getItems();
+ NavigateTestUtil.getAllArtifactChildren(treeItem, arts);
+ NavigateTestUtil.testExpectedVersusActual("Number of Artifacts - ", expected, arts.size());
+ // are we running the fault case?
+ if (testTaskTab) {
+ getXViewer().expandAll();
+ arts.clear();
+ // grab the Task Artifacts and set them as selected
+ this.getAllTreeItems(getXViewer().getTree().getItems(), taskArts);
+ // open the task in the Task Editor
+ TaskEditor.open(new TaskEditorSimpleProvider("ATS Tasks", getXViewer().getSelectedTaskArtifacts()));
+ handleTableCustomization();
+ columns = getXViewer().getCustomizeMgr().getCurrentTableColumns();
+ verifyXColumns(labelProv, arts, columns);
+ } else if (isErrorCheck) {
+ verifyXColumnsHasErrors(labelProv, arts, columns, attributeToDelete);
+ } else {
+ verifyXColumns(labelProv, arts, columns);
+ }
+ }
+
+ public void getAllTreeItems(TreeItem[] treeItem, List<Artifact> taskArts) throws OseeCoreException {
+ for (TreeItem item : treeItem) {
+ if (item.getData() instanceof Artifact) {
+ if (((Artifact) item.getData()).isOfType(AtsArtifactTypes.Task)) {
+ getXViewer().getTree().setSelection(item);
+ taskArts.add((Artifact) item.getData());
+ }
+ }
+ if (item.getExpanded()) {
+ getAllTreeItems(item.getItems(), taskArts);
+ }
+ }
+ }
+
+ public WorldEditor getSingleEditorOrFail() throws OseeCoreException {
+ // Retrieve results from opened editor and test
+ Collection<WorldEditor> editors = WorldEditor.getEditors();
+ assertTrue("Expecting 1 editor open, currently " + editors.size(), editors.size() == 1);
+
+ return editors.iterator().next();
+ }
+
+ public WorldXViewer getXViewer() throws OseeCoreException {
+ return getSingleEditorOrFail().getWorldComposite().getXViewer();
+ }
+
+ public void handleTableCustomization() throws OseeCoreException {
+ // add all columns
+ CustomizeDemoTableTestUtil cdialog = new CustomizeDemoTableTestUtil(getXViewer());
+ cdialog.createDialogArea(getSingleEditorOrFail().getWorldComposite());
+ cdialog.handleAddAllItemButtonClick();
+ }
+
+ public void deleteAttributesForXColErrorTest(Collection<Artifact> arts, String attributeToDelete) throws Exception {
+ Map<Artifact, Object> attributeValues = new HashMap<Artifact, Object>();
+ getXViewer().expandAll();
+ handleTableCustomization();
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Navigate Test");
+ // select a workflow artifact; get its attributes; delete an attribute
+ for (Artifact art : arts) {
+ attributeValues.put(art, art.getSoleAttributeValue(attributeToDelete));
+ art.deleteAttribute(attributeToDelete, art.getSoleAttributeValue(attributeToDelete));
+ art.persist(transaction);
+ }
+ transaction.execute();
+ try {
+ runGeneralXColTest(20, true, attributeToDelete, false);
+ } finally {
+ transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Navigate Test");
+ // restore the attribute to leave the demo db back in its original state
+ for (Artifact art : arts) {
+ art.setSoleAttributeValue(attributeToDelete, attributeValues.get(art));
+ art.persist(transaction);
+ }
+ transaction.execute();
+ }
+ }
+
+ public void verifyXColumnsHasErrors(ITableLabelProvider labelProv, List<Artifact> arts, List<XViewerColumn> columns, String attributeToDelete) throws OseeCoreException {
+ List<String> actualErrorCols = new ArrayList<String>();
+ for (XViewerColumn xCol : columns) {
+ verifyArtifactsHasErrors(labelProv, arts, xCol, getXViewer().getCustomizeMgr().getColumnNumFromXViewerColumn(
+ xCol), attributeToDelete, actualErrorCols);
+ }
+ if (!attributeToDelete.equals("ats.Current State") && !attributeToDelete.equals("ats.Priority")) {
+ verifyXCol1HasErrors(actualErrorCols);
+ } else {
+ verifyXCol2HasErrors(actualErrorCols);
+ }
+ }
+
+ public void verifyXCol1HasErrors(List<String> actualErrorCols) {
+ int index = 0;
+ for (String col : actualErrorCols) {
+ NavigateTestUtil.testExpectedVersusActual("Expected xCol errors", true,
+ NavigateTestUtil.expectedErrorCols1[index++].contains(col));
+ }
+ }
+
+ public void verifyXCol2HasErrors(List<String> actualErrorCols) {
+ int index = 0;
+ NavigateTestUtil.testExpectedVersusActual("Expected number of xCol errors",
+ NavigateTestUtil.expectedErrorCols2.length, actualErrorCols.size());
+ for (String col : actualErrorCols) {
+ NavigateTestUtil.testExpectedVersusActual("Expected xCol errors", true,
+ NavigateTestUtil.expectedErrorCols2[index++].equals(col));
+ }
+ }
+
+ public void verifyXColumns(ITableLabelProvider labelProv, Collection<Artifact> arts, List<XViewerColumn> columns) throws OseeCoreException {
+ for (XViewerColumn xCol : columns) {
+ verifyArtifact(labelProv, arts, getXViewer().getCustomizeMgr().getColumnNumFromXViewerColumn(xCol));
+ }
+ }
+
+ public void verifyArtifact(ITableLabelProvider labelProv, Collection<Artifact> arts, int colIndex) {
+ for (Artifact art : arts) {
+ String colText = labelProv.getColumnText(art, colIndex);
+ NavigateTestUtil.testExpectedVersusActual("No Error in XCol expected", true, !colText.contains("!Error"));
+ }
+ }
+
+ public void verifyArtifactsHasErrors(ITableLabelProvider labelProv, Collection<Artifact> arts, XViewerColumn xCol, int colIndex, String attributeToDelete, List<String> actualErrorCols) throws OseeCoreException {
+ for (Artifact art : arts) {
+ String colText = labelProv.getColumnText(art, colIndex);
+ if (art.isOfType("Demo Code Team Workflow")) {
+ if (colText.contains("!Error")) {
+ if (!actualErrorCols.contains(xCol.getId())) {
+ actualErrorCols.add(xCol.getId());
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNotifyUsersTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNotifyUsersTest.java
index c64948dfe1e..ca346878338 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNotifyUsersTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsNotifyUsersTest.java
@@ -8,138 +8,138 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.test.cases;
-
+package org.eclipse.osee.ats.test.cases;
+
import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import junit.framework.Assert;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.artifact.ATSLog.LogType;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-import org.eclipse.osee.ats.test.util.DemoTestUtil;
-import org.eclipse.osee.ats.test.util.TestNotificationManager;
-import org.eclipse.osee.ats.util.AtsNotifyUsers;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.SubscribeManager;
-import org.eclipse.osee.ats.util.AtsNotifyUsers.NotifyType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationEvent;
-import org.eclipse.osee.support.test.util.DemoUsers;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsNotifyUsersTest {
-
- @BeforeClass
- @AfterClass
- public static void cleanup() throws OseeCoreException {
- for (Artifact artifact : ArtifactQuery.getArtifactListFromName(AtsNotifyUsersTest.class.getSimpleName(),
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.artifact.ATSLog.LogType;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
+import org.eclipse.osee.ats.test.util.DemoTestUtil;
+import org.eclipse.osee.ats.test.util.TestNotificationManager;
+import org.eclipse.osee.ats.util.AtsNotifyUsers;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.SubscribeManager;
+import org.eclipse.osee.ats.util.AtsNotifyUsers.NotifyType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationEvent;
+import org.eclipse.osee.support.test.util.DemoUsers;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsNotifyUsersTest {
+
+ @BeforeClass
+ @AfterClass
+ public static void cleanup() throws OseeCoreException {
+ for (Artifact artifact : ArtifactQuery.getArtifactListFromName(AtsNotifyUsersTest.class.getSimpleName(),
AtsUtil.getAtsBranch(), EXCLUDE_DELETED)) {
- artifact.delete();
- }
- }
-
- @Test
- public void testNotify() throws OseeCoreException {
- User jason_ValidEmail = UserManager.getUser(DemoUsers.Jason_Michael);
- jason_ValidEmail.setEmail("this@boeing.com");
- User alex_NoValidEmail = UserManager.getUser(DemoUsers.Alex_Kay);
- User kay_ValidEmail = UserManager.getUser(DemoUsers.Kay_Jones);
- kay_ValidEmail.setEmail("this@boeing.com");
- User joeSmith_CurrentUser = UserManager.getUser(DemoUsers.Joe_Smith);
- joeSmith_CurrentUser.setEmail("this@boeing.com");
-
- TestNotificationManager notifyManager = new TestNotificationManager();
- AtsNotifyUsers atsNotifyUsers = AtsNotifyUsers.getInstance();
- atsNotifyUsers.setNotificationManager(notifyManager);
- atsNotifyUsers.setInTest(true);
-
- TeamWorkFlowArtifact teamArt = DemoTestUtil.createSimpleAction(AtsNotifyUsersTest.class.getSimpleName(), null);
- teamArt.setOriginator(kay_ValidEmail);
- List<User> assignees = Arrays.asList(alex_NoValidEmail, jason_ValidEmail, kay_ValidEmail, joeSmith_CurrentUser);
- teamArt.getStateMgr().setAssignees(assignees);
- teamArt.persist();
-
- notifyManager.clear();
- AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Originator);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- OseeNotificationEvent event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(NotifyType.Originator.name(), event.getType());
- Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
- Assert.assertEquals(
- "You have been set as the originator of [Demo Code Team Workflow] state [Endorse] titled [AtsNotifyUsersTest]",
- event.getDescription());
-
- notifyManager.clear();
- AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Assigned);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(NotifyType.Assigned.name(), event.getType());
- // joe smith should be removed from list cause it's current user
- // alex should be removed cause not valid email
- Assert.assertTrue(org.eclipse.osee.framework.jdk.core.util.Collections.isEqual(Arrays.asList(jason_ValidEmail,
- kay_ValidEmail), event.getUsers()));
- Assert.assertEquals(
- "You have been set as the assignee of [Demo Code Team Workflow] in state [Endorse] titled [AtsNotifyUsersTest]",
- event.getDescription());
-
- notifyManager.clear();
- AtsNotifyUsers.getInstance().notify(teamArt, Collections.singleton(jason_ValidEmail), NotifyType.Assigned);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(NotifyType.Assigned.name(), event.getType());
- // only alex should be emailed cause sent in list
- Assert.assertEquals(Collections.singleton(jason_ValidEmail), event.getUsers());
- Assert.assertEquals(
- "You have been set as the assignee of [Demo Code Team Workflow] in state [Endorse] titled [AtsNotifyUsersTest]",
- event.getDescription());
-
- notifyManager.clear();
- new SubscribeManager(teamArt).toggleSubscribe(false);
- AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Subscribed);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(NotifyType.Subscribed.name(), event.getType());
- Assert.assertEquals(UserManager.getUser(), event.getUsers().iterator().next());
- Assert.assertEquals(
- "[Demo Code Team Workflow] titled [AtsNotifyUsersTest] transitioned to [Endorse] and you subscribed for notification.",
- event.getDescription());
- new SubscribeManager(teamArt).toggleSubscribe(false);
-
- notifyManager.clear();
- AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Completed);
- Assert.assertEquals(0, notifyManager.getNotificationEvents().size());
-
- notifyManager.clear();
- teamArt.getStateMgr().initializeStateMachine(DefaultTeamState.Completed.name());
- AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Completed);
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(NotifyType.Completed.name(), event.getType());
- Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
- Assert.assertEquals("[Demo Code Team Workflow] titled [AtsNotifyUsersTest] is Completed", event.getDescription());
-
- notifyManager.clear();
- teamArt.getLog().addLog(LogType.StateCancelled, "Endorse", "this is the reason");
- teamArt.getStateMgr().initializeStateMachine(DefaultTeamState.Cancelled.name());
- AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Cancelled);
- Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
- event = notifyManager.getNotificationEvents().get(0);
- Assert.assertEquals(NotifyType.Cancelled.name(), event.getType());
- Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
- Assert.assertTrue(event.getDescription().startsWith(
- "[Demo Code Team Workflow] titled [AtsNotifyUsersTest] was cancelled from the [Endorse] state on"));
- Assert.assertTrue(event.getDescription().endsWith(".<br>Reason: [this is the reason]"));
-
- }
-
-}
+ artifact.delete();
+ }
+ }
+
+ @Test
+ public void testNotify() throws OseeCoreException {
+ User jason_ValidEmail = UserManager.getUser(DemoUsers.Jason_Michael);
+ jason_ValidEmail.setEmail("this@boeing.com");
+ User alex_NoValidEmail = UserManager.getUser(DemoUsers.Alex_Kay);
+ User kay_ValidEmail = UserManager.getUser(DemoUsers.Kay_Jones);
+ kay_ValidEmail.setEmail("this@boeing.com");
+ User joeSmith_CurrentUser = UserManager.getUser(DemoUsers.Joe_Smith);
+ joeSmith_CurrentUser.setEmail("this@boeing.com");
+
+ TestNotificationManager notifyManager = new TestNotificationManager();
+ AtsNotifyUsers atsNotifyUsers = AtsNotifyUsers.getInstance();
+ atsNotifyUsers.setNotificationManager(notifyManager);
+ atsNotifyUsers.setInTest(true);
+
+ TeamWorkFlowArtifact teamArt = DemoTestUtil.createSimpleAction(AtsNotifyUsersTest.class.getSimpleName(), null);
+ teamArt.setOriginator(kay_ValidEmail);
+ List<User> assignees = Arrays.asList(alex_NoValidEmail, jason_ValidEmail, kay_ValidEmail, joeSmith_CurrentUser);
+ teamArt.getStateMgr().setAssignees(assignees);
+ teamArt.persist();
+
+ notifyManager.clear();
+ AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Originator);
+ Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
+ OseeNotificationEvent event = notifyManager.getNotificationEvents().get(0);
+ Assert.assertEquals(NotifyType.Originator.name(), event.getType());
+ Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
+ Assert.assertEquals(
+ "You have been set as the originator of [Demo Code Team Workflow] state [Endorse] titled [AtsNotifyUsersTest]",
+ event.getDescription());
+
+ notifyManager.clear();
+ AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Assigned);
+ Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
+ event = notifyManager.getNotificationEvents().get(0);
+ Assert.assertEquals(NotifyType.Assigned.name(), event.getType());
+ // joe smith should be removed from list cause it's current user
+ // alex should be removed cause not valid email
+ Assert.assertTrue(org.eclipse.osee.framework.jdk.core.util.Collections.isEqual(Arrays.asList(jason_ValidEmail,
+ kay_ValidEmail), event.getUsers()));
+ Assert.assertEquals(
+ "You have been set as the assignee of [Demo Code Team Workflow] in state [Endorse] titled [AtsNotifyUsersTest]",
+ event.getDescription());
+
+ notifyManager.clear();
+ AtsNotifyUsers.getInstance().notify(teamArt, Collections.singleton(jason_ValidEmail), NotifyType.Assigned);
+ Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
+ event = notifyManager.getNotificationEvents().get(0);
+ Assert.assertEquals(NotifyType.Assigned.name(), event.getType());
+ // only alex should be emailed cause sent in list
+ Assert.assertEquals(Collections.singleton(jason_ValidEmail), event.getUsers());
+ Assert.assertEquals(
+ "You have been set as the assignee of [Demo Code Team Workflow] in state [Endorse] titled [AtsNotifyUsersTest]",
+ event.getDescription());
+
+ notifyManager.clear();
+ new SubscribeManager(teamArt).toggleSubscribe(false);
+ AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Subscribed);
+ Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
+ event = notifyManager.getNotificationEvents().get(0);
+ Assert.assertEquals(NotifyType.Subscribed.name(), event.getType());
+ Assert.assertEquals(UserManager.getUser(), event.getUsers().iterator().next());
+ Assert.assertEquals(
+ "[Demo Code Team Workflow] titled [AtsNotifyUsersTest] transitioned to [Endorse] and you subscribed for notification.",
+ event.getDescription());
+ new SubscribeManager(teamArt).toggleSubscribe(false);
+
+ notifyManager.clear();
+ AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Completed);
+ Assert.assertEquals(0, notifyManager.getNotificationEvents().size());
+
+ notifyManager.clear();
+ teamArt.getStateMgr().initializeStateMachine(DefaultTeamState.Completed.name());
+ AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Completed);
+ event = notifyManager.getNotificationEvents().get(0);
+ Assert.assertEquals(NotifyType.Completed.name(), event.getType());
+ Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
+ Assert.assertEquals("[Demo Code Team Workflow] titled [AtsNotifyUsersTest] is Completed", event.getDescription());
+
+ notifyManager.clear();
+ teamArt.getLog().addLog(LogType.StateCancelled, "Endorse", "this is the reason");
+ teamArt.getStateMgr().initializeStateMachine(DefaultTeamState.Cancelled.name());
+ AtsNotifyUsers.getInstance().notify(teamArt, NotifyType.Cancelled);
+ Assert.assertEquals(1, notifyManager.getNotificationEvents().size());
+ event = notifyManager.getNotificationEvents().get(0);
+ Assert.assertEquals(NotifyType.Cancelled.name(), event.getType());
+ Assert.assertEquals(kay_ValidEmail, event.getUsers().iterator().next());
+ Assert.assertTrue(event.getDescription().startsWith(
+ "[Demo Code Team Workflow] titled [AtsNotifyUsersTest] was cancelled from the [Endorse] state on"));
+ Assert.assertTrue(event.getDescription().endsWith(".<br>Reason: [this is the reason]"));
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsPurgeTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsPurgeTest.java
index 61cbe5735e9..4d7cedf8daf 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsPurgeTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsPurgeTest.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.assertFalse;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.util.ActionManager;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
-import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
-import org.eclipse.osee.support.test.util.TestUtil;
-import org.junit.Before;
-
-/**
- * This test is intended to be run against a demo database. It tests the purge logic by counting the rows of the version
- * and txs tables, then adds an Action, Workflow and 30 Tasks, deletes these objects and compares the row count. If
- * purge works properly, all rows should be equal.
- *
- * @author Donald G. Dunne
- */
-public class AtsPurgeTest {
-
- private final Map<String, Integer> preCreateActionCount = new HashMap<String, Integer>();
- private final Map<String, Integer> postCreateActionCount = new HashMap<String, Integer>();
- private final Map<String, Integer> postPurgeCount = new HashMap<String, Integer>();
- List<String> tables =
- Arrays.asList("osee_attribute", "osee_artifact", "osee_relation_link", "osee_tx_details", "osee_txs");
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- // This test should only be run on test db
- assertFalse(AtsUtil.isProductionDb());
- }
-
- @org.junit.Test
- public void testPurgeArtifacts() throws Exception {
- // Count rows in tables prior to purge
- DbUtil.getTableRowCounts(preCreateActionCount, tables);
-
- Set<Artifact> artsToPurge = new HashSet<Artifact>();
-
- // Create Action, Workflow and Tasks
- SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Purge Test");
- ActionArtifact actionArt =
- ActionManager.createAction(null, getClass().getSimpleName(), "description", ChangeType.Improvement,
- PriorityType.Priority_2, false, null, org.eclipse.osee.framework.jdk.core.util.Collections.castAll(
- ActionableItemArtifact.class, ArtifactQuery.getArtifactListFromTypeAndName(
- AtsArtifactTypes.ActionableItem, "SAW Test", AtsUtil.getAtsBranch())), transaction);
- actionArt.persist(transaction);
- transaction.execute();
-
- artsToPurge.add(actionArt);
- artsToPurge.addAll(actionArt.getTeamWorkFlowArtifacts());
-
- for (int x = 0; x < 30; x++) {
- TaskArtifact taskArt =
- actionArt.getTeamWorkFlowArtifacts().iterator().next().createNewTask(getClass().getSimpleName() + x);
- taskArt.persist();
- artsToPurge.add(taskArt);
- }
-
- // Count rows and check that increased
- DbUtil.getTableRowCounts(postCreateActionCount, tables);
- TestUtil.checkThatIncreased(preCreateActionCount, postCreateActionCount);
-
- // Purge Action, Workflow and Tasks
- new PurgeArtifacts(artsToPurge).execute();
-
- // Count rows and check that same as when began
- DbUtil.getTableRowCounts(postPurgeCount, tables);
- TestUtil.checkThatEqual(preCreateActionCount, postPurgeCount);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.assertFalse;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.util.ActionManager;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.utility.DbUtil;
+import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
+import org.eclipse.osee.support.test.util.TestUtil;
+import org.junit.Before;
+
+/**
+ * This test is intended to be run against a demo database. It tests the purge logic by counting the rows of the version
+ * and txs tables, then adds an Action, Workflow and 30 Tasks, deletes these objects and compares the row count. If
+ * purge works properly, all rows should be equal.
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsPurgeTest {
+
+ private final Map<String, Integer> preCreateActionCount = new HashMap<String, Integer>();
+ private final Map<String, Integer> postCreateActionCount = new HashMap<String, Integer>();
+ private final Map<String, Integer> postPurgeCount = new HashMap<String, Integer>();
+ List<String> tables =
+ Arrays.asList("osee_attribute", "osee_artifact", "osee_relation_link", "osee_tx_details", "osee_txs");
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ // This test should only be run on test db
+ assertFalse(AtsUtil.isProductionDb());
+ }
+
+ @org.junit.Test
+ public void testPurgeArtifacts() throws Exception {
+ // Count rows in tables prior to purge
+ DbUtil.getTableRowCounts(preCreateActionCount, tables);
+
+ Set<Artifact> artsToPurge = new HashSet<Artifact>();
+
+ // Create Action, Workflow and Tasks
+ SkynetTransaction transaction = new SkynetTransaction(AtsUtil.getAtsBranch(), "Purge Test");
+ ActionArtifact actionArt =
+ ActionManager.createAction(null, getClass().getSimpleName(), "description", ChangeType.Improvement,
+ PriorityType.Priority_2, false, null, org.eclipse.osee.framework.jdk.core.util.Collections.castAll(
+ ActionableItemArtifact.class, ArtifactQuery.getArtifactListFromTypeAndName(
+ AtsArtifactTypes.ActionableItem, "SAW Test", AtsUtil.getAtsBranch())), transaction);
+ actionArt.persist(transaction);
+ transaction.execute();
+
+ artsToPurge.add(actionArt);
+ artsToPurge.addAll(actionArt.getTeamWorkFlowArtifacts());
+
+ for (int x = 0; x < 30; x++) {
+ TaskArtifact taskArt =
+ actionArt.getTeamWorkFlowArtifacts().iterator().next().createNewTask(getClass().getSimpleName() + x);
+ taskArt.persist();
+ artsToPurge.add(taskArt);
+ }
+
+ // Count rows and check that increased
+ DbUtil.getTableRowCounts(postCreateActionCount, tables);
+ TestUtil.checkThatIncreased(preCreateActionCount, postCreateActionCount);
+
+ // Purge Action, Workflow and Tasks
+ new PurgeArtifacts(artsToPurge).execute();
+
+ // Count rows and check that same as when began
+ DbUtil.getTableRowCounts(postPurgeCount, tables);
+ TestUtil.checkThatEqual(preCreateActionCount, postPurgeCount);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsQueryPerformanceTests.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsQueryPerformanceTests.java
index b4c060c28d0..01deaa371f4 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsQueryPerformanceTests.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsQueryPerformanceTests.java
@@ -1,75 +1,75 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.ats.config.AtsBulkLoad;
-import org.eclipse.osee.ats.world.search.MyWorldSearchItem;
-import org.eclipse.osee.ats.world.search.TeamWorldSearchItem;
-import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-
-/**
- * @author Andrew M. Finkbeiner
- */
-public class AtsQueryPerformanceTests {
-
- public AtsQueryPerformanceTests() {
- AtsBulkLoad.loadConfig(true);
- }
-
- @org.junit.Test
- public void testUserWorldSearch() throws Exception {
- User usr = getAUser();
- assertNotNull("User does not exist", usr);
- MyWorldSearchItem search = new MyWorldSearchItem();
- long startTime = System.currentTimeMillis();
- Collection<Artifact> artifacts = search.searchIt(usr);
- long elapsedTime = System.currentTimeMillis() - startTime;
- System.out.println(String.format("testUserWorldSearch took %dms for %d artifacts", elapsedTime, artifacts.size()));
- assertTrue("No artifacts found", artifacts.size() > 0);
- assertTrue("testUserWorldSearch should take less than 2500ms", elapsedTime < 2500);
- }
-
- @org.junit.Test
- public void testTeamWorldSearchItem() throws Exception {
- TeamWorldSearchItem searchItem =
- new TeamWorldSearchItem("Show Open OSEE Actions", new String[] {"ATS", "Define", "OTE"}, false, true,
- false, null, null, null, null);
- long startTime = System.currentTimeMillis();
- Collection<Artifact> artifacts = searchItem.performSearch(SearchType.Search);
- long elapsedTime = System.currentTimeMillis() - startTime;
- System.out.println(String.format("testTeamWorldSearchItem took %dms for %d artifacts", elapsedTime,
- artifacts.size()));
- assertTrue("No artifacts found", artifacts.size() > 0);
- assertTrue("testTeamWorldSearchItem should take less than 20000ms; took " + elapsedTime + "ms",
- elapsedTime < 20000);
- }
-
- private User getAUser() throws OseeCoreException {
- List<User> users = UserManager.getUsers();
- User andy = null;
- for (User usr : users) {
- if (usr.getSoleAttributeValueAsString("Name", "unknown").contains("Finkbeiner")) {
- andy = usr;
- break;
- }
- }
- return andy;
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.ats.config.AtsBulkLoad;
+import org.eclipse.osee.ats.world.search.MyWorldSearchItem;
+import org.eclipse.osee.ats.world.search.TeamWorldSearchItem;
+import org.eclipse.osee.ats.world.search.WorldSearchItem.SearchType;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+
+/**
+ * @author Andrew M. Finkbeiner
+ */
+public class AtsQueryPerformanceTests {
+
+ public AtsQueryPerformanceTests() {
+ AtsBulkLoad.loadConfig(true);
+ }
+
+ @org.junit.Test
+ public void testUserWorldSearch() throws Exception {
+ User usr = getAUser();
+ assertNotNull("User does not exist", usr);
+ MyWorldSearchItem search = new MyWorldSearchItem();
+ long startTime = System.currentTimeMillis();
+ Collection<Artifact> artifacts = search.searchIt(usr);
+ long elapsedTime = System.currentTimeMillis() - startTime;
+ System.out.println(String.format("testUserWorldSearch took %dms for %d artifacts", elapsedTime, artifacts.size()));
+ assertTrue("No artifacts found", artifacts.size() > 0);
+ assertTrue("testUserWorldSearch should take less than 2500ms", elapsedTime < 2500);
+ }
+
+ @org.junit.Test
+ public void testTeamWorldSearchItem() throws Exception {
+ TeamWorldSearchItem searchItem =
+ new TeamWorldSearchItem("Show Open OSEE Actions", new String[] {"ATS", "Define", "OTE"}, false, true,
+ false, null, null, null, null);
+ long startTime = System.currentTimeMillis();
+ Collection<Artifact> artifacts = searchItem.performSearch(SearchType.Search);
+ long elapsedTime = System.currentTimeMillis() - startTime;
+ System.out.println(String.format("testTeamWorldSearchItem took %dms for %d artifacts", elapsedTime,
+ artifacts.size()));
+ assertTrue("No artifacts found", artifacts.size() > 0);
+ assertTrue("testTeamWorldSearchItem should take less than 20000ms; took " + elapsedTime + "ms",
+ elapsedTime < 20000);
+ }
+
+ private User getAUser() throws OseeCoreException {
+ List<User> users = UserManager.getUsers();
+ User andy = null;
+ for (User usr : users) {
+ if (usr.getSoleAttributeValueAsString("Name", "unknown").contains("Finkbeiner")) {
+ andy = usr;
+ break;
+ }
+ }
+ return andy;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsTeamDefintionToWorkflowTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsTeamDefintionToWorkflowTest.java
index 8fe799e1fac..68d68b6bb8b 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsTeamDefintionToWorkflowTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsTeamDefintionToWorkflowTest.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.assertFalse;
-import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.junit.Before;
-
-/**
- * @author Donald G. Dunne
- */
-public class AtsTeamDefintionToWorkflowTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @org.junit.Test
- public void testTeamDefinitionToWorkflow() throws Exception {
- boolean error = false;
- StringBuffer sb = new StringBuffer();
- for (Artifact artifact : ArtifactQuery.getArtifactListFromType(AtsArtifactTypes.TeamDefinition,
- AtsUtil.getAtsBranch())) {
- TeamDefinitionArtifact teamDef = (TeamDefinitionArtifact) artifact;
- if (teamDef.isActionable() && teamDef.getWorkFlowDefinition() == null) {
- sb.append("Team Definition \"" + teamDef + "\" has no Work Flow associated and is Actionable.");
- error = true;
- }
- }
- assertFalse(sb.toString(), error);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.assertFalse;
+import org.eclipse.osee.ats.artifact.TeamDefinitionArtifact;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.junit.Before;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class AtsTeamDefintionToWorkflowTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @org.junit.Test
+ public void testTeamDefinitionToWorkflow() throws Exception {
+ boolean error = false;
+ StringBuffer sb = new StringBuffer();
+ for (Artifact artifact : ArtifactQuery.getArtifactListFromType(AtsArtifactTypes.TeamDefinition,
+ AtsUtil.getAtsBranch())) {
+ TeamDefinitionArtifact teamDef = (TeamDefinitionArtifact) artifact;
+ if (teamDef.isActionable() && teamDef.getWorkFlowDefinition() == null) {
+ sb.append("Team Definition \"" + teamDef + "\" has no Work Flow associated and is Actionable.");
+ error = true;
+ }
+ }
+ assertFalse(sb.toString(), error);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsValidateAtsDatabaseTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsValidateAtsDatabaseTest.java
index c37029cf9ed..633400871f0 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsValidateAtsDatabaseTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsValidateAtsDatabaseTest.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.fail;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import org.eclipse.osee.ats.config.AtsBulkLoad;
-import org.eclipse.osee.ats.health.ValidateAtsDatabase;
-import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.support.test.util.TestUtil;
-
-/**
- * This test runs the validate ats database check against whatever database is run against.
- *
- * @author Donald G. Dunne
- */
-public class AtsValidateAtsDatabaseTest {
-
- public AtsValidateAtsDatabaseTest() {
- AtsBulkLoad.loadConfig(true);
- }
-
- @org.junit.Test
- public void testValidateAtsDatabase() throws Exception {
- SevereLoggingMonitor monitorLog = TestUtil.severeLoggingStart();
-
- ValidateAtsDatabase validateAtsDatabase = new ValidateAtsDatabase(null);
- XResultData rd = new XResultData();
- validateAtsDatabase.setFixAssignees(false);
- validateAtsDatabase.setFixAttributeValues(false);
- validateAtsDatabase.runIt(null, rd);
- Matcher m = Pattern.compile("Error:.*$").matcher(rd.getReport("").getManipulatedHtml());
- while (m.find()) {
- fail(m.group());
- }
-
- TestUtil.severeLoggingEnd(monitorLog);
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.fail;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.eclipse.osee.ats.config.AtsBulkLoad;
+import org.eclipse.osee.ats.health.ValidateAtsDatabase;
+import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.support.test.util.TestUtil;
+
+/**
+ * This test runs the validate ats database check against whatever database is run against.
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsValidateAtsDatabaseTest {
+
+ public AtsValidateAtsDatabaseTest() {
+ AtsBulkLoad.loadConfig(true);
+ }
+
+ @org.junit.Test
+ public void testValidateAtsDatabase() throws Exception {
+ SevereLoggingMonitor monitorLog = TestUtil.severeLoggingStart();
+
+ ValidateAtsDatabase validateAtsDatabase = new ValidateAtsDatabase(null);
+ XResultData rd = new XResultData();
+ validateAtsDatabase.setFixAssignees(false);
+ validateAtsDatabase.setFixAttributeValues(false);
+ validateAtsDatabase.runIt(null, rd);
+ Matcher m = Pattern.compile("Error:.*$").matcher(rd.getReport("").getManipulatedHtml());
+ while (m.find()) {
+ fail(m.group());
+ }
+
+ TestUtil.severeLoggingEnd(monitorLog);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsWorkItemDefinitionTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsWorkItemDefinitionTest.java
index 3131301a638..5ba9162013c 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsWorkItemDefinitionTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/AtsWorkItemDefinitionTest.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * 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.ats.test.cases;
-
-import static org.junit.Assert.fail;
-import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
-import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
-import org.junit.Before;
-
-/**
- * This test can be run on a test or production Db
- *
- * @author Donald G. Dunne
- */
-public class AtsWorkItemDefinitionTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @org.junit.Test
- public void testWorkItemDefinitions() throws Exception {
- for (WorkItemDefinition workItemDefinition : WorkItemDefinitionFactory.getWorkItemDefinitions()) {
- System.out.println("Testing " + workItemDefinition);
- // set up dynamic layout for work widget definition
- if (workItemDefinition instanceof WorkWidgetDefinition) {
- WorkWidgetDefinition workWidgetDefinition = (WorkWidgetDefinition) workItemDefinition;
- DynamicXWidgetLayoutData dynamicXWidgetLayoutData = workWidgetDefinition.get();
- if (dynamicXWidgetLayoutData.getDynamicXWidgetLayout() == null) {
- dynamicXWidgetLayoutData.setDynamicXWidgetLayout(new DynamicXWidgetLayout());
- workWidgetDefinition.set(dynamicXWidgetLayoutData);
- }
- }
- Result result = AtsWorkDefinitions.validateWorkItemDefinition(workItemDefinition);
- if (result.isFalse()) {
- fail(result.getText());
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.cases;
+
+import static org.junit.Assert.fail;
+import org.eclipse.osee.ats.workflow.item.AtsWorkDefinitions;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayout;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.DynamicXWidgetLayoutData;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinition;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkItemDefinitionFactory;
+import org.eclipse.osee.framework.ui.skynet.widgets.workflow.WorkWidgetDefinition;
+import org.junit.Before;
+
+/**
+ * This test can be run on a test or production Db
+ *
+ * @author Donald G. Dunne
+ */
+public class AtsWorkItemDefinitionTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @org.junit.Test
+ public void testWorkItemDefinitions() throws Exception {
+ for (WorkItemDefinition workItemDefinition : WorkItemDefinitionFactory.getWorkItemDefinitions()) {
+ System.out.println("Testing " + workItemDefinition);
+ // set up dynamic layout for work widget definition
+ if (workItemDefinition instanceof WorkWidgetDefinition) {
+ WorkWidgetDefinition workWidgetDefinition = (WorkWidgetDefinition) workItemDefinition;
+ DynamicXWidgetLayoutData dynamicXWidgetLayoutData = workWidgetDefinition.get();
+ if (dynamicXWidgetLayoutData.getDynamicXWidgetLayout() == null) {
+ dynamicXWidgetLayoutData.setDynamicXWidgetLayout(new DynamicXWidgetLayout());
+ workWidgetDefinition.set(dynamicXWidgetLayoutData);
+ }
+ }
+ Result result = AtsWorkDefinitions.validateWorkItemDefinition(workItemDefinition);
+ if (result.isFalse()) {
+ fail(result.getText());
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/SMAPrintTest.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/SMAPrintTest.java
index 339e3ee1922..1deeecee0c6 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/SMAPrintTest.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/cases/SMAPrintTest.java
@@ -8,81 +8,81 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.test.cases;
-
-import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
-import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.editor.SMAPrint;
-import org.eclipse.osee.ats.util.AtsArtifactTypes;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.widgets.ReviewManager;
-import org.eclipse.osee.framework.core.data.IArtifactType;
-import org.eclipse.osee.framework.core.model.type.ArtifactType;
-import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.ui.skynet.results.XResultData;
-import org.eclipse.osee.support.test.util.TestUtil;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Demo test that will run the SMAPrint action against Demo populated actions to ensure that nothing has broken.This
- * test simply runs the html generation portion of SMAPrint, ensures the results are of a reasonable length and looks
- * for exceptions at the end.
- *
- * @author Donald G. Dunne
- */
-public class SMAPrintTest {
-
- @Test
- public void testSMAPrint() throws Exception {
- SevereLoggingMonitor monitorLog = TestUtil.severeLoggingStart();
- IArtifactType DemoCodeTeamWorkflow = new ArtifactType("ABRNqDKnpGEKAyUm49gA", "Demo Code Team Workflow", false);
-
- TeamWorkFlowArtifact teamArt =
- (TeamWorkFlowArtifact) ArtifactQuery.getArtifactFromTypeAndName(DemoCodeTeamWorkflow,
- "SAW (uncommitted) More Reqt Changes for Diagram View", AtsUtil.getAtsBranch());
- Assert.assertNotNull(teamArt);
-
- SMAPrint smaPrint = new SMAPrint(teamArt);
- XResultData resultData = smaPrint.getResultData();
- Assert.assertNotNull(resultData);
- // Make sure it's a reasonable length
- Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 7000);
-
- PeerToPeerReviewArtifact peerArt = (PeerToPeerReviewArtifact) ReviewManager.getReviews(teamArt).iterator().next();
- smaPrint = new SMAPrint(peerArt);
- resultData = smaPrint.getResultData();
- Assert.assertNotNull(resultData);
- // Make sure it's a reasonable length
- Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 3500);
-
- TaskArtifact taskArt = null;
- for (TaskArtifact taskArtifact : teamArt.getTaskArtifacts()) {
- if (taskArtifact.getName().equals("Deploy release")) {
- taskArt = taskArtifact;
- }
- }
- Assert.assertNotNull(taskArt);
- smaPrint = new SMAPrint(taskArt);
- resultData = smaPrint.getResultData();
- Assert.assertNotNull(resultData);
- // Make sure it's a reasonable length
- Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 2700);
-
- teamArt =
- (TeamWorkFlowArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamWorkflow,
- "Button S doesn't work on help", AtsUtil.getAtsBranch());
- Assert.assertNotNull(teamArt);
- DecisionReviewArtifact decArt = (DecisionReviewArtifact) ReviewManager.getReviews(teamArt).iterator().next();
- smaPrint = new SMAPrint(decArt);
- resultData = smaPrint.getResultData();
- Assert.assertNotNull(resultData);
- // Make sure it's a reasonable length
- Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 2900);
-
- TestUtil.severeLoggingEnd(monitorLog);
- }
-}
+package org.eclipse.osee.ats.test.cases;
+
+import org.eclipse.osee.ats.artifact.DecisionReviewArtifact;
+import org.eclipse.osee.ats.artifact.PeerToPeerReviewArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.editor.SMAPrint;
+import org.eclipse.osee.ats.util.AtsArtifactTypes;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.widgets.ReviewManager;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.model.type.ArtifactType;
+import org.eclipse.osee.framework.logging.SevereLoggingMonitor;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.ui.skynet.results.XResultData;
+import org.eclipse.osee.support.test.util.TestUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Demo test that will run the SMAPrint action against Demo populated actions to ensure that nothing has broken.This
+ * test simply runs the html generation portion of SMAPrint, ensures the results are of a reasonable length and looks
+ * for exceptions at the end.
+ *
+ * @author Donald G. Dunne
+ */
+public class SMAPrintTest {
+
+ @Test
+ public void testSMAPrint() throws Exception {
+ SevereLoggingMonitor monitorLog = TestUtil.severeLoggingStart();
+ IArtifactType DemoCodeTeamWorkflow = new ArtifactType("ABRNqDKnpGEKAyUm49gA", "Demo Code Team Workflow", false);
+
+ TeamWorkFlowArtifact teamArt =
+ (TeamWorkFlowArtifact) ArtifactQuery.getArtifactFromTypeAndName(DemoCodeTeamWorkflow,
+ "SAW (uncommitted) More Reqt Changes for Diagram View", AtsUtil.getAtsBranch());
+ Assert.assertNotNull(teamArt);
+
+ SMAPrint smaPrint = new SMAPrint(teamArt);
+ XResultData resultData = smaPrint.getResultData();
+ Assert.assertNotNull(resultData);
+ // Make sure it's a reasonable length
+ Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 7000);
+
+ PeerToPeerReviewArtifact peerArt = (PeerToPeerReviewArtifact) ReviewManager.getReviews(teamArt).iterator().next();
+ smaPrint = new SMAPrint(peerArt);
+ resultData = smaPrint.getResultData();
+ Assert.assertNotNull(resultData);
+ // Make sure it's a reasonable length
+ Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 3500);
+
+ TaskArtifact taskArt = null;
+ for (TaskArtifact taskArtifact : teamArt.getTaskArtifacts()) {
+ if (taskArtifact.getName().equals("Deploy release")) {
+ taskArt = taskArtifact;
+ }
+ }
+ Assert.assertNotNull(taskArt);
+ smaPrint = new SMAPrint(taskArt);
+ resultData = smaPrint.getResultData();
+ Assert.assertNotNull(resultData);
+ // Make sure it's a reasonable length
+ Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 2700);
+
+ teamArt =
+ (TeamWorkFlowArtifact) ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamWorkflow,
+ "Button S doesn't work on help", AtsUtil.getAtsBranch());
+ Assert.assertNotNull(teamArt);
+ DecisionReviewArtifact decArt = (DecisionReviewArtifact) ReviewManager.getReviews(teamArt).iterator().next();
+ smaPrint = new SMAPrint(decArt);
+ resultData = smaPrint.getResultData();
+ Assert.assertNotNull(resultData);
+ // Make sure it's a reasonable length
+ Assert.assertTrue(resultData.getReport("report").getManipulatedHtml().length() > 2900);
+
+ TestUtil.severeLoggingEnd(monitorLog);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/CustomizeDemoTableTestUtil.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/CustomizeDemoTableTestUtil.java
index 062668fbfcd..bca08a0dbf2 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/CustomizeDemoTableTestUtil.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/CustomizeDemoTableTestUtil.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * 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.ats.test.util;
-
-import java.util.logging.Level;
-import org.eclipse.nebula.widgets.xviewer.XViewer;
-import org.eclipse.nebula.widgets.xviewer.customize.dialog.XViewerCustomizeDialog;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Megumi Telles
- */
-public class CustomizeDemoTableTestUtil extends XViewerCustomizeDialog {
-
- /**
- * @param viewer
- */
- public CustomizeDemoTableTestUtil(XViewer viewer) {
- super(viewer);
- }
-
- /**
- * for testing purposes - simulate customization view
- */
- public Control createDialogArea(Composite parent) {
- OseeLog.log(AtsPlugin.class, Level.INFO, "===> Simulating CustomizationView " + "\"...");
- return super.createDialogArea(parent);
- }
-
- /**
- * for testing purposes - simulate the add all button click
- */
- public void handleAddAllItemButtonClick() {
- OseeLog.log(AtsPlugin.class, Level.INFO, "===> Simulating CustomizationView Add All Columns" + "\"...");
- super.handleAddAllItem();
- super.handleLoadConfigCust();
- }
-}
+/*******************************************************************************
+ * 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.ats.test.util;
+
+import java.util.logging.Level;
+import org.eclipse.nebula.widgets.xviewer.XViewer;
+import org.eclipse.nebula.widgets.xviewer.customize.dialog.XViewerCustomizeDialog;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Megumi Telles
+ */
+public class CustomizeDemoTableTestUtil extends XViewerCustomizeDialog {
+
+ /**
+ * @param viewer
+ */
+ public CustomizeDemoTableTestUtil(XViewer viewer) {
+ super(viewer);
+ }
+
+ /**
+ * for testing purposes - simulate customization view
+ */
+ public Control createDialogArea(Composite parent) {
+ OseeLog.log(AtsPlugin.class, Level.INFO, "===> Simulating CustomizationView " + "\"...");
+ return super.createDialogArea(parent);
+ }
+
+ /**
+ * for testing purposes - simulate the add all button click
+ */
+ public void handleAddAllItemButtonClick() {
+ OseeLog.log(AtsPlugin.class, Level.INFO, "===> Simulating CustomizationView Add All Columns" + "\"...");
+ super.handleAddAllItem();
+ super.handleLoadConfigCust();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/DemoTestUtil.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/DemoTestUtil.java
index 488639627b5..12d8a29e3d4 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/DemoTestUtil.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/DemoTestUtil.java
@@ -1,152 +1,152 @@
-/*******************************************************************************
- * 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.ats.test.util;
-
+/*******************************************************************************
+ * 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.ats.test.util;
+
import static org.eclipse.osee.framework.skynet.core.artifact.DeletionFlag.EXCLUDE_DELETED;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.logging.Level;
-import junit.framework.TestCase;
-import org.eclipse.osee.ats.artifact.ActionArtifact;
-import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
-import org.eclipse.osee.ats.artifact.TaskArtifact;
-import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.util.ActionManager;
-import org.eclipse.osee.ats.util.AtsUtil;
-import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.OseeAuthenticationException;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.User;
-import org.eclipse.osee.framework.skynet.core.UserManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
-import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
-import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
-import org.eclipse.osee.framework.ui.plugin.util.Result;
-import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
-import org.eclipse.osee.support.test.util.DemoActionableItems;
-import org.eclipse.osee.support.test.util.DemoSawBuilds;
-import org.eclipse.osee.support.test.util.DemoUsers;
-import org.eclipse.osee.support.test.util.TestUtil;
-
-/**
- * @author Donald G. Dunne
- */
-public class DemoTestUtil {
-
- public static Result isDbPopulatedWithDemoData() throws Exception {
- Branch branch = BranchManager.getBranchByGuid(DemoSawBuilds.SAW_Bld_1.getGuid());
-
- if (ArtifactQuery.getArtifactListFromTypeAndName(CoreArtifactTypes.SoftwareRequirement, "%Robot%", branch).size() != 6) {
- return new Result(
- "Expected at least 6 Software Requirements with word \"Robot\". Database is not be populated with demo data.");
- }
- return Result.TrueResult;
- }
-
- public static Collection<String> getTaskTitles(boolean firstTaskWorkflow) {
- if (firstTaskWorkflow) {
- firstTaskWorkflow = false;
- return Arrays.asList("Look into Graph View.", "Redesign how view shows values.",
- "Discuss new design with Senior Engineer", "Develop prototype", "Show prototype to management",
- "Create development plan", "Create test plan", "Make changes");
- } else {
- return Arrays.asList("Document how Graph View works", "Update help contents", "Review new documentation",
- "Publish documentation to website", "Remove old viewer", "Deploy release");
- }
- }
-
- public static int getNumTasks() {
- return getTaskTitles(false).size() + getTaskTitles(true).size();
- }
-
- public static User getDemoUser(DemoUsers demoUser) throws OseeCoreException {
- return UserManager.getUserByName(demoUser.getName());
- }
-
- /**
- * Creates an action with the name title and demo code workflow
- */
- public static TeamWorkFlowArtifact createSimpleAction(String title, SkynetTransaction transaction) throws OseeCoreException {
- ActionArtifact actionArt =
- ActionManager.createAction(null, title, "Description", ChangeType.Improvement, PriorityType.Priority_2,
- false, null,
- ActionableItemArtifact.getActionableItems(Arrays.asList(DemoActionableItems.SAW_Code.getName())),
- transaction);
-
- TeamWorkFlowArtifact teamArt = null;
- for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
- if (team.getTeamDefinition().getName().contains("Code")) {
- teamArt = team;
- }
- }
- return teamArt;
- }
-
- /**
- * Create tasks named title + <num>
- */
- public static Collection<TaskArtifact> createSimpleTasks(TeamWorkFlowArtifact teamArt, String title, int numTasks, SkynetTransaction transaction) throws Exception {
- List<String> names = new ArrayList<String>();
- for (int x = 1; x < numTasks + 1; x++) {
- names.add(title + " " + x);
- }
- return teamArt.createTasks(names, Arrays.asList(UserManager.getUser()), transaction);
- }
-
- /**
- * Deletes all artifacts with names that start with any title given
- */
- public static void cleanupSimpleTest(Collection<String> titles) throws Exception {
- List<Artifact> artifacts = new ArrayList<Artifact>();
- for (String title : titles) {
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.logging.Level;
+import junit.framework.TestCase;
+import org.eclipse.osee.ats.artifact.ActionArtifact;
+import org.eclipse.osee.ats.artifact.ActionableItemArtifact;
+import org.eclipse.osee.ats.artifact.TaskArtifact;
+import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.util.ActionManager;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.ats.util.AtsPriority.PriorityType;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.OseeAuthenticationException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.User;
+import org.eclipse.osee.framework.skynet.core.UserManager;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.ui.plugin.util.Result;
+import org.eclipse.osee.framework.ui.skynet.util.ChangeType;
+import org.eclipse.osee.support.test.util.DemoActionableItems;
+import org.eclipse.osee.support.test.util.DemoSawBuilds;
+import org.eclipse.osee.support.test.util.DemoUsers;
+import org.eclipse.osee.support.test.util.TestUtil;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class DemoTestUtil {
+
+ public static Result isDbPopulatedWithDemoData() throws Exception {
+ Branch branch = BranchManager.getBranchByGuid(DemoSawBuilds.SAW_Bld_1.getGuid());
+
+ if (ArtifactQuery.getArtifactListFromTypeAndName(CoreArtifactTypes.SoftwareRequirement, "%Robot%", branch).size() != 6) {
+ return new Result(
+ "Expected at least 6 Software Requirements with word \"Robot\". Database is not be populated with demo data.");
+ }
+ return Result.TrueResult;
+ }
+
+ public static Collection<String> getTaskTitles(boolean firstTaskWorkflow) {
+ if (firstTaskWorkflow) {
+ firstTaskWorkflow = false;
+ return Arrays.asList("Look into Graph View.", "Redesign how view shows values.",
+ "Discuss new design with Senior Engineer", "Develop prototype", "Show prototype to management",
+ "Create development plan", "Create test plan", "Make changes");
+ } else {
+ return Arrays.asList("Document how Graph View works", "Update help contents", "Review new documentation",
+ "Publish documentation to website", "Remove old viewer", "Deploy release");
+ }
+ }
+
+ public static int getNumTasks() {
+ return getTaskTitles(false).size() + getTaskTitles(true).size();
+ }
+
+ public static User getDemoUser(DemoUsers demoUser) throws OseeCoreException {
+ return UserManager.getUserByName(demoUser.getName());
+ }
+
+ /**
+ * Creates an action with the name title and demo code workflow
+ */
+ public static TeamWorkFlowArtifact createSimpleAction(String title, SkynetTransaction transaction) throws OseeCoreException {
+ ActionArtifact actionArt =
+ ActionManager.createAction(null, title, "Description", ChangeType.Improvement, PriorityType.Priority_2,
+ false, null,
+ ActionableItemArtifact.getActionableItems(Arrays.asList(DemoActionableItems.SAW_Code.getName())),
+ transaction);
+
+ TeamWorkFlowArtifact teamArt = null;
+ for (TeamWorkFlowArtifact team : actionArt.getTeamWorkFlowArtifacts()) {
+ if (team.getTeamDefinition().getName().contains("Code")) {
+ teamArt = team;
+ }
+ }
+ return teamArt;
+ }
+
+ /**
+ * Create tasks named title + <num>
+ */
+ public static Collection<TaskArtifact> createSimpleTasks(TeamWorkFlowArtifact teamArt, String title, int numTasks, SkynetTransaction transaction) throws Exception {
+ List<String> names = new ArrayList<String>();
+ for (int x = 1; x < numTasks + 1; x++) {
+ names.add(title + " " + x);
+ }
+ return teamArt.createTasks(names, Arrays.asList(UserManager.getUser()), transaction);
+ }
+
+ /**
+ * Deletes all artifacts with names that start with any title given
+ */
+ public static void cleanupSimpleTest(Collection<String> titles) throws Exception {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ for (String title : titles) {
artifacts.addAll(ArtifactQuery.getArtifactListFromName(title + "%", AtsUtil.getAtsBranch(), EXCLUDE_DELETED));
- }
- new PurgeArtifacts(artifacts).execute();
- TestUtil.sleep(4000);
- }
-
- /**
- * Deletes any artifact with name that starts with title
- */
- public static void cleanupSimpleTest(String title) throws Exception {
- cleanupSimpleTest(Arrays.asList(title));
- }
-
- public static void setUpTest() throws Exception {
- try {
- // This test should only be run on test db
- TestCase.assertFalse(AtsUtil.isProductionDb());
- // Confirm test setup with demo data
- TestCase.assertTrue(isDbPopulatedWithDemoData().isTrue());
- // Confirm user is Joe Smith
- TestCase.assertTrue("User \"Joe Smith\" does not exist in DB. Run Demo DBInit prior to this test.",
- UserManager.getUserByUserId("Joe Smith") != null);
- // Confirm user is Joe Smith
- TestCase.assertTrue(
- "Authenticated user should be \"Joe Smith\" and is not. Check that Demo Application Server is being run.",
- UserManager.getUser().getUserId().equals("Joe Smith"));
- TestUtil.setIsInTest(true);
- } catch (OseeAuthenticationException ex) {
- OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
- TestCase.fail("Can't authenticate, either Demo Application Server is not running or Demo DbInit has not been performed");
- }
-
- }
-
-}
+ }
+ new PurgeArtifacts(artifacts).execute();
+ TestUtil.sleep(4000);
+ }
+
+ /**
+ * Deletes any artifact with name that starts with title
+ */
+ public static void cleanupSimpleTest(String title) throws Exception {
+ cleanupSimpleTest(Arrays.asList(title));
+ }
+
+ public static void setUpTest() throws Exception {
+ try {
+ // This test should only be run on test db
+ TestCase.assertFalse(AtsUtil.isProductionDb());
+ // Confirm test setup with demo data
+ TestCase.assertTrue(isDbPopulatedWithDemoData().isTrue());
+ // Confirm user is Joe Smith
+ TestCase.assertTrue("User \"Joe Smith\" does not exist in DB. Run Demo DBInit prior to this test.",
+ UserManager.getUserByUserId("Joe Smith") != null);
+ // Confirm user is Joe Smith
+ TestCase.assertTrue(
+ "Authenticated user should be \"Joe Smith\" and is not. Check that Demo Application Server is being run.",
+ UserManager.getUser().getUserId().equals("Joe Smith"));
+ TestUtil.setIsInTest(true);
+ } catch (OseeAuthenticationException ex) {
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, ex);
+ TestCase.fail("Can't authenticate, either Demo Application Server is not running or Demo DbInit has not been performed");
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/NavigateTestUtil.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/NavigateTestUtil.java
index 3ca7aee885c..f78380b17a3 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/NavigateTestUtil.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/NavigateTestUtil.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * 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.ats.test.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import junit.framework.TestCase;
-import org.eclipse.osee.ats.internal.AtsPlugin;
-import org.eclipse.osee.ats.navigate.AtsNavigateViewItems;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * @author Donald G. Dunne
- */
-public class NavigateTestUtil {
- private static Map<String, List<XNavigateItem>> nameToNavItem;
- public static String[] expectedErrorCols1 =
- {"ats.column.type", "ats.column.team", "ats.column.initWf", "ats.column.origWf"};
- public static String[] expectedErrorCols2 =
- {"ats.column.state", "ats.column.assignees", "ats.column.versionTarget", "ats.column.annualCostAvoidance",
- "ats.column.remainingHours", "ats.column.statePercentComplete", "ats.column.stateTaskPercentComplete",
- "ats.column.stateReviewPercentComplete", "ats.column.totalPercentComplete",
- "ats.column.stateHoursSpent", "ats.column.stateTaskHoursSpent", "ats.column.stateReviewHoursSpent",
- "ats.column.stateTotalHoursSpent", "ats.column.totalHoursSpent", "ats.column.implementer",
- "ats.column.completedDate", "ats.column.cancelledDate", "ats.column.manDaysNeeded"};
-
- public static XNavigateItem getAtsNavigateItem(String itemName) {
- if (nameToNavItem == null) {
- nameToNavItem = new HashMap<String, List<XNavigateItem>>(100);
- // Setup hash if navigate items to names
- for (XNavigateItem item : AtsNavigateViewItems.getInstance().getSearchNavigateItems())
- NavigateTestUtil.createNameToNavItemMap(item, nameToNavItem);
- }
- if (nameToNavItem.get(itemName) == null) throw new IllegalStateException(
- "No items of name \"" + itemName + "\" found");
- if (nameToNavItem.get(itemName).size() > 1) throw new IllegalStateException(
- "Multiple items of name \"" + itemName + "\" found; use getAtsNavigateItems");
- return nameToNavItem.get(itemName).iterator().next();
- }
-
- public static List<XNavigateItem> getAtsNavigateItems(String itemName) {
- if (nameToNavItem == null) {
- nameToNavItem = new HashMap<String, List<XNavigateItem>>(100);
- // Setup hash if navigate items to names
- for (XNavigateItem item : AtsNavigateViewItems.getInstance().getSearchNavigateItems())
- NavigateTestUtil.createNameToNavItemMap(item, nameToNavItem);
- }
- return nameToNavItem.get(itemName);
- }
-
- public static void testExpectedVersusActual(String name, Collection<? extends Artifact> arts, Class<?> clazz, int expectedNumOfType) {
- int actualNumOfType = numOfType(arts, clazz);
- String expectedStr =
- "\"" + name + "\" Expected: " + expectedNumOfType + " Found: " + actualNumOfType + " Of Type: " + clazz;
- compare(expectedNumOfType, actualNumOfType, expectedStr);
- }
-
- public static void testExpectedVersusActual(String testStr, int expected, int actual) {
- String expectedStr = testStr + "Expected: " + expected + " Found: " + actual;
- compare(expected, actual, expectedStr);
- }
-
- public static void testExpectedVersusActual(String testStr, boolean expectedCond, boolean actualCond) {
- String expectedStr = testStr + "Expected: " + expectedCond + " Found: " + actualCond;
- compare(expectedCond, actualCond, expectedStr);
- }
-
- public static void compare(int expectedNumOfType, int actualNumOfType, String expectedStr) {
- if (expectedNumOfType != actualNumOfType)
- OseeLog.log(AtsPlugin.class, Level.SEVERE, expectedStr, null);
- else
- OseeLog.log(AtsPlugin.class, Level.INFO, expectedStr);
- TestCase.assertTrue(expectedStr, actualNumOfType == expectedNumOfType);
- }
-
- public static void compare(boolean expectedCond, boolean actualCond, String expectedStr) {
- if (expectedCond != actualCond)
- OseeLog.log(AtsPlugin.class, Level.SEVERE, expectedStr, null);
- else
- OseeLog.log(AtsPlugin.class, Level.INFO, expectedStr);
- TestCase.assertTrue(expectedStr, expectedCond == actualCond);
- }
-
- public static int numOfType(Collection<? extends Artifact> arts, Class<?> clazz) {
- int num = 0;
- for (Artifact art : arts)
- if (clazz.isAssignableFrom(art.getClass())) num++;
- return num;
- }
-
- public static void createNameToNavItemMap(XNavigateItem item, Map<String, List<XNavigateItem>> nameToItemMap) {
- List<XNavigateItem> items = new ArrayList<XNavigateItem>();
- if (nameToItemMap.containsKey(item.getName())) {
- items.addAll(nameToItemMap.get(item.getName()));
- }
- items.add(item);
- nameToItemMap.put(item.getName(), items);
- for (XNavigateItem child : item.getChildren()) {
- createNameToNavItemMap(child, nameToItemMap);
- }
- }
-
- public static void getAllArtifactChildren(TreeItem items[], Collection<Artifact> children) {
- for (TreeItem item : items) {
- if (item.getData() instanceof Artifact) {
- //if (!children.contains(item.getData())) children.add((Artifact) item.getData());
- children.add((Artifact) item.getData());
- if (item.getExpanded()) getAllArtifactChildren(item.getItems(), children);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * 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.ats.test.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import junit.framework.TestCase;
+import org.eclipse.osee.ats.internal.AtsPlugin;
+import org.eclipse.osee.ats.navigate.AtsNavigateViewItems;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.ui.plugin.xnavigate.XNavigateItem;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class NavigateTestUtil {
+ private static Map<String, List<XNavigateItem>> nameToNavItem;
+ public static String[] expectedErrorCols1 =
+ {"ats.column.type", "ats.column.team", "ats.column.initWf", "ats.column.origWf"};
+ public static String[] expectedErrorCols2 =
+ {"ats.column.state", "ats.column.assignees", "ats.column.versionTarget", "ats.column.annualCostAvoidance",
+ "ats.column.remainingHours", "ats.column.statePercentComplete", "ats.column.stateTaskPercentComplete",
+ "ats.column.stateReviewPercentComplete", "ats.column.totalPercentComplete",
+ "ats.column.stateHoursSpent", "ats.column.stateTaskHoursSpent", "ats.column.stateReviewHoursSpent",
+ "ats.column.stateTotalHoursSpent", "ats.column.totalHoursSpent", "ats.column.implementer",
+ "ats.column.completedDate", "ats.column.cancelledDate", "ats.column.manDaysNeeded"};
+
+ public static XNavigateItem getAtsNavigateItem(String itemName) {
+ if (nameToNavItem == null) {
+ nameToNavItem = new HashMap<String, List<XNavigateItem>>(100);
+ // Setup hash if navigate items to names
+ for (XNavigateItem item : AtsNavigateViewItems.getInstance().getSearchNavigateItems())
+ NavigateTestUtil.createNameToNavItemMap(item, nameToNavItem);
+ }
+ if (nameToNavItem.get(itemName) == null) throw new IllegalStateException(
+ "No items of name \"" + itemName + "\" found");
+ if (nameToNavItem.get(itemName).size() > 1) throw new IllegalStateException(
+ "Multiple items of name \"" + itemName + "\" found; use getAtsNavigateItems");
+ return nameToNavItem.get(itemName).iterator().next();
+ }
+
+ public static List<XNavigateItem> getAtsNavigateItems(String itemName) {
+ if (nameToNavItem == null) {
+ nameToNavItem = new HashMap<String, List<XNavigateItem>>(100);
+ // Setup hash if navigate items to names
+ for (XNavigateItem item : AtsNavigateViewItems.getInstance().getSearchNavigateItems())
+ NavigateTestUtil.createNameToNavItemMap(item, nameToNavItem);
+ }
+ return nameToNavItem.get(itemName);
+ }
+
+ public static void testExpectedVersusActual(String name, Collection<? extends Artifact> arts, Class<?> clazz, int expectedNumOfType) {
+ int actualNumOfType = numOfType(arts, clazz);
+ String expectedStr =
+ "\"" + name + "\" Expected: " + expectedNumOfType + " Found: " + actualNumOfType + " Of Type: " + clazz;
+ compare(expectedNumOfType, actualNumOfType, expectedStr);
+ }
+
+ public static void testExpectedVersusActual(String testStr, int expected, int actual) {
+ String expectedStr = testStr + "Expected: " + expected + " Found: " + actual;
+ compare(expected, actual, expectedStr);
+ }
+
+ public static void testExpectedVersusActual(String testStr, boolean expectedCond, boolean actualCond) {
+ String expectedStr = testStr + "Expected: " + expectedCond + " Found: " + actualCond;
+ compare(expectedCond, actualCond, expectedStr);
+ }
+
+ public static void compare(int expectedNumOfType, int actualNumOfType, String expectedStr) {
+ if (expectedNumOfType != actualNumOfType)
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, expectedStr, null);
+ else
+ OseeLog.log(AtsPlugin.class, Level.INFO, expectedStr);
+ TestCase.assertTrue(expectedStr, actualNumOfType == expectedNumOfType);
+ }
+
+ public static void compare(boolean expectedCond, boolean actualCond, String expectedStr) {
+ if (expectedCond != actualCond)
+ OseeLog.log(AtsPlugin.class, Level.SEVERE, expectedStr, null);
+ else
+ OseeLog.log(AtsPlugin.class, Level.INFO, expectedStr);
+ TestCase.assertTrue(expectedStr, expectedCond == actualCond);
+ }
+
+ public static int numOfType(Collection<? extends Artifact> arts, Class<?> clazz) {
+ int num = 0;
+ for (Artifact art : arts)
+ if (clazz.isAssignableFrom(art.getClass())) num++;
+ return num;
+ }
+
+ public static void createNameToNavItemMap(XNavigateItem item, Map<String, List<XNavigateItem>> nameToItemMap) {
+ List<XNavigateItem> items = new ArrayList<XNavigateItem>();
+ if (nameToItemMap.containsKey(item.getName())) {
+ items.addAll(nameToItemMap.get(item.getName()));
+ }
+ items.add(item);
+ nameToItemMap.put(item.getName(), items);
+ for (XNavigateItem child : item.getChildren()) {
+ createNameToNavItemMap(child, nameToItemMap);
+ }
+ }
+
+ public static void getAllArtifactChildren(TreeItem items[], Collection<Artifact> children) {
+ for (TreeItem item : items) {
+ if (item.getData() instanceof Artifact) {
+ //if (!children.contains(item.getData())) children.add((Artifact) item.getData());
+ children.add((Artifact) item.getData());
+ if (item.getExpanded()) getAllArtifactChildren(item.getItems(), children);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/SMATestUtil.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/SMATestUtil.java
index 545c586e367..f3a7ee8acf1 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/SMATestUtil.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/SMATestUtil.java
@@ -8,45 +8,45 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.test.util;
-
+package org.eclipse.osee.ats.test.util;
+
import java.util.Arrays;
import java.util.Collection;
import junit.framework.TestCase;
import org.eclipse.osee.ats.artifact.ATSAttributes;
import org.eclipse.osee.ats.artifact.StateMachineArtifact;
import org.eclipse.osee.ats.artifact.TeamWorkFlowArtifact.DefaultTeamState;
-
-/**
- * @author Donald G. Dunne
- */
-public class SMATestUtil {
-
- public static void validateSMA(StateMachineArtifact sma, String stateName, int totalPercent, double hoursSpent) throws Exception {
- validateSMAs(Arrays.asList(sma), stateName, totalPercent, hoursSpent);
-
- }
-
- public static void validateSMAs(Collection<? extends StateMachineArtifact> smas, String stateName, int totalPercent, double hoursSpent) throws Exception {
- for (StateMachineArtifact sma : smas) {
- TestCase.assertEquals("Current State wronf for " + sma.getHumanReadableId(),
- sma.getStateMgr().getCurrentStateName(), stateName);
- if (sma.isCancelledOrCompleted()) {
- TestCase.assertEquals("ats.CurrentState wrong " + sma.getHumanReadableId(),
- sma.getStateMgr().getCurrentStateName() + ";;;",
- sma.getSoleAttributeValue(ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName()));
- }
- TestCase.assertEquals("Percent wrong for " + sma.getHumanReadableId(), sma.getWorldViewPercentCompleteTotal(),
- totalPercent);
- TestCase.assertEquals("Hours Spent wrong for " + sma.getHumanReadableId(), sma.getWorldViewHoursSpentTotal(),
- hoursSpent);
- for (String stateValue : sma.getAttributesToStringList(ATSAttributes.STATE_ATTRIBUTE.getStoreName())) {
- if (stateValue.startsWith(DefaultTeamState.Completed.name())) {
- TestCase.assertEquals("ats.State wrong " + sma.getHumanReadableId(), stateValue, "Completed;;;");
- } else if (stateValue.startsWith(DefaultTeamState.Cancelled.name())) {
- TestCase.assertEquals("ats.State wrong " + sma.getHumanReadableId(), stateValue, "Cancelled;;;");
- }
- }
- }
- }
-}
+
+/**
+ * @author Donald G. Dunne
+ */
+public class SMATestUtil {
+
+ public static void validateSMA(StateMachineArtifact sma, String stateName, int totalPercent, double hoursSpent) throws Exception {
+ validateSMAs(Arrays.asList(sma), stateName, totalPercent, hoursSpent);
+
+ }
+
+ public static void validateSMAs(Collection<? extends StateMachineArtifact> smas, String stateName, int totalPercent, double hoursSpent) throws Exception {
+ for (StateMachineArtifact sma : smas) {
+ TestCase.assertEquals("Current State wronf for " + sma.getHumanReadableId(),
+ sma.getStateMgr().getCurrentStateName(), stateName);
+ if (sma.isCancelledOrCompleted()) {
+ TestCase.assertEquals("ats.CurrentState wrong " + sma.getHumanReadableId(),
+ sma.getStateMgr().getCurrentStateName() + ";;;",
+ sma.getSoleAttributeValue(ATSAttributes.CURRENT_STATE_ATTRIBUTE.getStoreName()));
+ }
+ TestCase.assertEquals("Percent wrong for " + sma.getHumanReadableId(), sma.getWorldViewPercentCompleteTotal(),
+ totalPercent);
+ TestCase.assertEquals("Hours Spent wrong for " + sma.getHumanReadableId(), sma.getWorldViewHoursSpentTotal(),
+ hoursSpent);
+ for (String stateValue : sma.getAttributesToStringList(ATSAttributes.STATE_ATTRIBUTE.getStoreName())) {
+ if (stateValue.startsWith(DefaultTeamState.Completed.name())) {
+ TestCase.assertEquals("ats.State wrong " + sma.getHumanReadableId(), stateValue, "Completed;;;");
+ } else if (stateValue.startsWith(DefaultTeamState.Cancelled.name())) {
+ TestCase.assertEquals("ats.State wrong " + sma.getHumanReadableId(), stateValue, "Cancelled;;;");
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/TestNotificationManager.java b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/TestNotificationManager.java
index 253dddc8b14..3fb6b96bcdc 100644
--- a/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/TestNotificationManager.java
+++ b/plugins/org.eclipse.osee.ats.test/src/org/eclipse/osee/ats/test/util/TestNotificationManager.java
@@ -8,38 +8,38 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.ats.test.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.ui.skynet.notify.INotificationManager;
-import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationEvent;
-
-/**
- * @author Donald G. Dunne
- */
-public class TestNotificationManager implements INotificationManager {
-
- private List<OseeNotificationEvent> notificationEvents = new ArrayList<OseeNotificationEvent>();
-
- @Override
- public void addNotificationEvent(OseeNotificationEvent notificationEvent) {
- notificationEvents.add(notificationEvent);
- }
-
- @Override
- public void clear() {
- notificationEvents.clear();
- }
-
- @Override
- public List<OseeNotificationEvent> getNotificationEvents() {
- return notificationEvents;
- }
-
- @Override
- public void sendNotifications() throws OseeCoreException {
- }
-
-}
+package org.eclipse.osee.ats.test.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.skynet.notify.INotificationManager;
+import org.eclipse.osee.framework.ui.skynet.notify.OseeNotificationEvent;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class TestNotificationManager implements INotificationManager {
+
+ private List<OseeNotificationEvent> notificationEvents = new ArrayList<OseeNotificationEvent>();
+
+ @Override
+ public void addNotificationEvent(OseeNotificationEvent notificationEvent) {
+ notificationEvents.add(notificationEvent);
+ }
+
+ @Override
+ public void clear() {
+ notificationEvents.clear();
+ }
+
+ @Override
+ public List<OseeNotificationEvent> getNotificationEvents() {
+ return notificationEvents;
+ }
+
+ @Override
+ public void sendNotifications() throws OseeCoreException {
+ }
+
+}

Back to the top