diff options
author | donald.g.dunne | 2016-06-27 18:41:29 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2016-08-31 16:17:14 +0000 |
commit | c528c3efea67769ed206c08fc7ba7106b69e9dbc (patch) | |
tree | 19935b213ae70fcbd45351b451c1bc876cedbd65 /plugins/org.eclipse.osee.ats.client.integration.tests | |
parent | f7d99f3fb3973a7a68ce9a3f903654a87bc7f896 (diff) | |
download | org.eclipse.osee-c528c3efea67769ed206c08fc7ba7106b69e9dbc.tar.gz org.eclipse.osee-c528c3efea67769ed206c08fc7ba7106b69e9dbc.tar.xz org.eclipse.osee-c528c3efea67769ed206c08fc7ba7106b69e9dbc.zip |
bug[ats_ATS292323]: Consolidate Version
Change-Id: I53de68836e0c2c8b3edb8a5ecbc4f05305ed3bf7
Diffstat (limited to 'plugins/org.eclipse.osee.ats.client.integration.tests')
9 files changed, 27 insertions, 284 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/ActionableItemArtifactReaderTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/ActionableItemArtifactReaderTest.java deleted file mode 100644 index fe101eb609e..00000000000 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/ActionableItemArtifactReaderTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 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.client.integration.tests.ats.config; - -import java.util.Arrays; -import org.eclipse.osee.ats.api.ai.IAtsActionableItem; -import org.eclipse.osee.ats.api.data.AtsAttributeTypes; -import org.eclipse.osee.ats.client.integration.tests.AtsClientService; -import org.eclipse.osee.ats.core.client.util.AtsChangeSet; -import org.eclipse.osee.ats.core.config.ActionableItems; -import org.eclipse.osee.ats.demo.api.DemoArtifactToken; -import org.junit.Assert; -import org.junit.Test; - -/** - * Test Case for {@link ActionableItemArtifactReader} - * - * @author Donald G. Dunne - */ -public class ActionableItemArtifactReaderTest { - - @Test - public void testLoad() { - IAtsActionableItem sawTestAi = - AtsClientService.get().getCache().getByUuid(DemoArtifactToken.SAW_Test_AI.getUuid(), IAtsActionableItem.class); - Assert.assertTrue(sawTestAi.isAllowUserActionCreation()); - Assert.assertEquals(1, ActionableItems.getUserEditableActionableItems(Arrays.asList(sawTestAi)).size()); - - AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName()); - changes.setSoleAttributeValue(sawTestAi, AtsAttributeTypes.AllowUserActionCreation, false); - AtsClientService.get().storeConfigObject(sawTestAi, changes); - changes.execute(); - - sawTestAi = - AtsClientService.get().getCache().getByUuid(DemoArtifactToken.SAW_Test_AI.getUuid(), IAtsActionableItem.class); - Assert.assertFalse(sawTestAi.isAllowUserActionCreation()); - Assert.assertEquals(0, ActionableItems.getUserEditableActionableItems(Arrays.asList(sawTestAi)).size()); - - changes.setSoleAttributeValue(sawTestAi, AtsAttributeTypes.AllowUserActionCreation, true); - changes = new AtsChangeSet(getClass().getSimpleName()); - AtsClientService.get().storeConfigObject(sawTestAi, changes); - changes.execute(); - - sawTestAi = - AtsClientService.get().getCache().getByUuid(DemoArtifactToken.SAW_Test_AI.getUuid(), IAtsActionableItem.class); - Assert.assertTrue(sawTestAi.isAllowUserActionCreation()); - Assert.assertEquals(1, ActionableItems.getUserEditableActionableItems(Arrays.asList(sawTestAi)).size()); - - } - -} diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsBranchConfigurationTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsBranchConfigurationTest.java index c2ce645ceec..9fe6cfacd51 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsBranchConfigurationTest.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsBranchConfigurationTest.java @@ -144,12 +144,11 @@ public class AtsBranchConfigurationTest { } Assert.assertNotNull(versionToTarget); - versionToTarget.setBaselineBranchUuid(viaTeamDefBranch.getUuid()); - versionToTarget.setAllowCommitBranch(true); - versionToTarget.setAllowCreateBranch(true); - AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName()); - AtsClientService.get().storeConfigObject(versionToTarget, changes); + changes.setSoleAttributeValue(versionToTarget, AtsAttributeTypes.BaselineBranchUuid, + viaTeamDefBranch.getUuid().toString()); + changes.setSoleAttributeValue(versionToTarget, AtsAttributeTypes.AllowCommitBranch, true); + changes.setSoleAttributeValue(versionToTarget, AtsAttributeTypes.AllowCreateBranch, true); changes.execute(); TestUtil.sleep(2000); @@ -261,7 +260,6 @@ public class AtsBranchConfigurationTest { // setup team def to allow create/commit of branch changes.setSoleAttributeValue(teamDef, AtsAttributeTypes.AllowCommitBranch, true); changes.setSoleAttributeValue(teamDef, AtsAttributeTypes.AllowCreateBranch, true); - AtsClientService.get().storeConfigObject(teamDef, changes); changes.execute(); TestUtil.sleep(2000); diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsTest_Config_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsTest_Config_Suite.java index 01a72dc2196..a17cbb19209 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsTest_Config_Suite.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/config/AtsTest_Config_Suite.java @@ -28,8 +28,7 @@ import org.junit.runners.Suite; InsertionActivityResourceTest.class, ActionableItemResourceTest.class, AtsTest_Demo_Copy_Suite.class, - AtsBranchConfigurationTest.class, - ActionableItemArtifactReaderTest.class}) + AtsBranchConfigurationTest.class}) /** * This test suite contains test that can be run against any production db * diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java index 5d8f63ba97b..519da80d2c4 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsTestUtil.java @@ -333,26 +333,22 @@ public class AtsTestUtil { guid = GUID.create(); verArt1 = AtsClientService.get().getVersionService().createVersion(getTitle("ver 1.0", postFixName), guid, - AtsUtilClient.createConfigObjectUuid()); - AtsClientService.get().storeConfigObject(verArt1, changes); + AtsUtilClient.createConfigObjectUuid(), changes); changes.relate(teamDef, AtsRelationTypes.TeamDefinitionToVersion_Version, verArt1); guid = GUID.create(); verArt2 = AtsClientService.get().getVersionService().createVersion(getTitle("ver 2.0", postFixName), guid, - AtsUtilClient.createConfigObjectUuid()); - AtsClientService.get().storeConfigObject(verArt2, changes); + AtsUtilClient.createConfigObjectUuid(), changes); changes.relate(teamDef, AtsRelationTypes.TeamDefinitionToVersion_Version, verArt2); guid = GUID.create(); verArt3 = AtsClientService.get().getVersionService().createVersion(getTitle("ver 3.0", postFixName), guid, - AtsUtilClient.createConfigObjectUuid()); - AtsClientService.get().storeConfigObject(verArt3, changes); + AtsUtilClient.createConfigObjectUuid(), changes); changes.relate(teamDef, AtsRelationTypes.TeamDefinitionToVersion_Version, verArt3); guid = GUID.create(); verArt4 = AtsClientService.get().getVersionService().createVersion(getTitle("ver 4.0", postFixName), guid, - AtsUtilClient.createConfigObjectUuid()); - AtsClientService.get().storeConfigObject(verArt4, changes); + AtsUtilClient.createConfigObjectUuid(), changes); changes.relate(teamDef, AtsRelationTypes.TeamDefinitionToVersion_Version, verArt4); actionArt = ActionManager.createAction(null, getTitle("Team WF", postFixName), "description", @@ -788,15 +784,14 @@ public class AtsTestUtil { public static void configureVer1ForWorkingBranch() throws OseeCoreException { IAtsVersion version = getVerArt1(); - version.setAllowCreateBranch(true); - version.setAllowCommitBranch(true); - version.setBaselineBranchUuid(SAW_Bld_1.getUuid()); - ((Artifact) version.getStoreObject()).persist(AtsTestUtil.class.getSimpleName() + "-SetTeamWfTargetedVer1"); + Artifact verArt = ((Artifact) version.getStoreObject()); + verArt.setSoleAttributeValue(AtsAttributeTypes.AllowCreateBranch, true); + verArt.setSoleAttributeValue(AtsAttributeTypes.AllowCommitBranch, true); + verArt.setSoleAttributeValue(AtsAttributeTypes.BaselineBranchUuid, SAW_Bld_1.getUuid().toString()); + verArt.setRelations(AtsRelationTypes.TeamWorkflowTargetedForVersion_Workflow, + Arrays.asList((Artifact) getTeamWf().getStoreObject())); + verArt.persist(AtsTestUtil.class.getSimpleName() + "-SetTeamWfTargetedVer1"); AtsClientService.get().getCache().deCacheAtsObject(version); - if (!AtsClientService.get().getVersionService().hasTargetedVersion(getTeamWf())) { - AtsClientService.get().getVersionService().setTargetedVersion(getTeamWf(), getVerArt1()); - getTeamWf().persist(AtsTestUtil.class.getSimpleName() + "-SetTeamWfTargetedVer1"); - } } public static String getName() { diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java index 2335b40f9d2..8638b817a75 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java @@ -11,7 +11,6 @@ package org.eclipse.osee.ats.client.integration.tests.ats.core.client.action; import java.util.List; -import org.eclipse.osee.ats.api.ai.IAtsActionableItem; import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.team.IAtsTeamDefinition; import org.eclipse.osee.ats.api.version.IAtsVersion; @@ -80,10 +79,8 @@ public class AutoAddActionToGoalTest { AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName()); GoalArtifact goalArt = GoalManager.createGoal("AutoAddActionToGoalTest - AddActionToGoalFromAI", changes); changes.execute(); - IAtsActionableItem actionItem2 = AtsTestUtil.getTestAi2(); changes.clear(); - AtsClientService.get().storeConfigObject(actionItem2, changes); IAtsTeamDefinition teamDef = AtsTestUtil.getTestTeamDef(); for (IAtsVersion version : teamDef.getVersions()) { @@ -146,13 +143,10 @@ public class AutoAddActionToGoalTest { IAtsWorkDefinition workDef = AtsTestUtil.getWorkDef(); AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName()); - IAtsActionableItem testAI2 = AtsTestUtil.getTestAi2(); - AtsClientService.get().storeConfigObject(testAI2, changes); IAtsTeamDefinition teamDef = AtsTestUtil.getTestTeamDef(); for (IAtsVersion version : teamDef.getVersions()) { changes.deleteArtifact(version.getStoreObject()); } - AtsClientService.get().storeConfigObject(teamDef, changes); Artifact testAI2Art = AtsClientService.get().getArtifact(AtsTestUtil.getTestAi2()); Artifact teamDefArtifact = AtsClientService.get().getArtifact(AtsTestUtil.getTestTeamDef()); @@ -191,11 +185,7 @@ public class AutoAddActionToGoalTest { AtsChangeSet changes = new AtsChangeSet(getClass().getSimpleName()); GoalArtifact goalArt = GoalManager.createGoal("AutoAddActionToGoalTest - AddTwoActions", changes); GoalArtifact goalArt2 = GoalManager.createGoal("AutoAddActionToGoalTest - SecondGoal", changes); - IAtsActionableItem actionItem2 = AtsTestUtil.getTestAi2(); - IAtsActionableItem actionItem3 = AtsTestUtil.getTestAi3(); - AtsClientService.get().storeConfigObject(actionItem2, changes); - AtsClientService.get().storeConfigObject(actionItem3, changes); IAtsTeamDefinition teamDef = AtsTestUtil.getTestTeamDef(); for (IAtsVersion version : teamDef.getVersions()) { changes.deleteArtifact(version.getStoreObject()); diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/branch/AtsBranchServiceImplTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/branch/AtsBranchServiceImplTest.java index f18c0ac2d43..999736f643a 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/branch/AtsBranchServiceImplTest.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/branch/AtsBranchServiceImplTest.java @@ -18,6 +18,7 @@ import java.util.Date; import java.util.HashSet; import org.eclipse.osee.ats.api.commit.ICommitConfigItem; import org.eclipse.osee.ats.api.data.AtsAttributeTypes; +import org.eclipse.osee.ats.api.data.AtsRelationTypes; import org.eclipse.osee.ats.api.team.IAtsTeamDefinition; import org.eclipse.osee.ats.api.version.IAtsVersion; import org.eclipse.osee.ats.client.integration.tests.AtsClientService; @@ -30,6 +31,7 @@ import org.eclipse.osee.framework.core.model.TransactionRecord; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.OseeProperties; import org.eclipse.osee.framework.skynet.core.UserManager; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; import org.eclipse.osee.support.test.util.TestUtil; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -82,15 +84,17 @@ public class AtsBranchServiceImplTest { AtsBranchServiceImplTest.class.getSimpleName() + ".testGetCommitTransactionsAndConfigItemsForTeamWf_versions"); TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf(); //Test Version-based Team Arts - IAtsVersion verArt1 = AtsTestUtil.getVerArt1(); - IAtsVersion verArt2 = AtsTestUtil.getVerArt2(); - verArt1.getParallelVersions().add(verArt2); - AtsClientService.get().getVersionService().setTargetedVersion(teamArt, verArt1); + IAtsVersion version1 = AtsTestUtil.getVerArt1(); + IAtsVersion version2 = AtsTestUtil.getVerArt2(); + ((Artifact) version1.getStoreObject()).addRelation(AtsRelationTypes.ParallelVersion_Child, + (Artifact) version2.getStoreObject()); + ((Artifact) version1.getStoreObject()).persist(getClass().getSimpleName()); + AtsClientService.get().getVersionService().setTargetedVersionAndStore(teamArt, version1); Collection<Object> commitObjs = AtsClientService.get().getBranchService().getCommitTransactionsAndConfigItemsForTeamWf(teamArt); assertTrue("commitObjs has wrong size", commitObjs.size() == 2); - assertTrue("commitObjs is missing verArt1", commitObjs.contains(verArt1)); - assertTrue("commitObjs is missing verArt2", commitObjs.contains(verArt2)); + assertTrue("commitObjs is missing verArt1", commitObjs.contains(version1)); + assertTrue("commitObjs is missing verArt2", commitObjs.contains(version2)); } @Test diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/AtsCoreClient_Config_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/AtsCoreClient_Config_Suite.java index 37ade7ab63f..f5c3a012c23 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/AtsCoreClient_Config_Suite.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/AtsCoreClient_Config_Suite.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.eclipse.osee.ats.client.integration.tests.ats.core.client.config; -import org.eclipse.osee.ats.client.integration.tests.ats.core.client.config.store.AtsCoreClient_Store_Suite; import org.eclipse.osee.framework.jdk.core.util.OseeProperties; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -21,7 +20,7 @@ import org.junit.runners.Suite; * @author Donald G. Dunne */ @RunWith(Suite.class) -@Suite.SuiteClasses({AtsActionableItemToTeamDefinitionTest.class, AtsCoreClient_Store_Suite.class}) +@Suite.SuiteClasses({AtsActionableItemToTeamDefinitionTest.class}) public class AtsCoreClient_Config_Suite { @BeforeClass public static void setUp() throws Exception { diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/store/AtsCoreClient_Store_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/store/AtsCoreClient_Store_Suite.java deleted file mode 100644 index 99ec62cc89c..00000000000 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/store/AtsCoreClient_Store_Suite.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 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.client.integration.tests.ats.core.client.config.store; - -import org.eclipse.osee.ats.client.integration.tests.util.DemoTestUtil; -import org.eclipse.osee.framework.jdk.core.util.OseeProperties; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * @author Roberto E. Escobar - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({VersionArtifactStoreTest.class}) -public class AtsCoreClient_Store_Suite { - - @BeforeClass - public static void setUp() throws Exception { - OseeProperties.setIsInTest(true); - System.out.println("\n\nBegin " + AtsCoreClient_Store_Suite.class.getSimpleName()); - DemoTestUtil.setUpTest(); - } - - @AfterClass - public static void tearDown() throws Exception { - System.out.println("End " + AtsCoreClient_Store_Suite.class.getSimpleName()); - } -} diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/store/VersionArtifactStoreTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/store/VersionArtifactStoreTest.java deleted file mode 100644 index 183322363fc..00000000000 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/config/store/VersionArtifactStoreTest.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 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.client.integration.tests.ats.core.client.config.store; - -import java.util.Arrays; -import java.util.Date; -import org.eclipse.osee.ats.api.IAtsConfigObject; -import org.eclipse.osee.ats.api.config.IAtsCache; -import org.eclipse.osee.ats.api.data.AtsArtifactTypes; -import org.eclipse.osee.ats.api.data.AtsAttributeTypes; -import org.eclipse.osee.ats.api.data.AtsRelationTypes; -import org.eclipse.osee.ats.api.version.IAtsVersion; -import org.eclipse.osee.ats.client.integration.tests.AtsClientService; -import org.eclipse.osee.ats.core.client.util.AtsChangeSet; -import org.eclipse.osee.ats.core.util.AtsUtilCore; -import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; -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.search.ArtifactQuery; -import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction; -import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * @author Donald G. Dunne - */ -public class VersionArtifactStoreTest { - - @BeforeClass - @AfterClass - public static void cleanup() throws OseeCoreException { - SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), - VersionArtifactStoreTest.class.getSimpleName() + " - cleanup"); - - IAtsCache cache = AtsClientService.get().getCache(); - for (String name : Arrays.asList("VersionArtifactStoreTest - version 1", "VersionArtifactStoreTest - version 2", - "VersionArtifactStoreTest - version 3")) { - for (Artifact art : ArtifactQuery.getArtifactListFromTypeAndName(AtsArtifactTypes.Version, name, - AtsUtilCore.getAtsBranch())) { - art.deleteAndPersist(transaction); - - IAtsConfigObject atsObject = cache.getByUuid(art.getUuid(), IAtsConfigObject.class); - if (atsObject != null) { - cache.deCacheAtsObject(atsObject); - } - } - } - transaction.execute(); - } - - @Test - public void testLoadFromArtifact() throws OseeCoreException { - Artifact verArt = ArtifactTypeManager.addArtifact(AtsArtifactTypes.Version, AtsUtilCore.getAtsBranch()); - verArt.setName("VersionArtifactStoreTest - version 1"); - verArt.persist(getClass().getSimpleName()); - - IAtsVersion version = AtsClientService.get().getConfigObject(verArt); - Assert.assertEquals("VersionArtifactStoreTest - version 1", version.getName()); - Assert.assertFalse(version.isAllowCommitBranch()); - Assert.assertFalse(version.isAllowCreateBranch()); - Assert.assertFalse(version.isLocked()); - Assert.assertFalse(version.isReleased()); - Assert.assertFalse(version.isNextVersion()); - Assert.assertEquals(0L, version.getBaselineBranchUuid()); - Assert.assertEquals("", version.getDescription()); - Assert.assertEquals("", version.getFullName()); - Assert.assertNull(version.getReleaseDate()); - - verArt.setSoleAttributeValue(AtsAttributeTypes.AllowCommitBranch, true); - verArt.setSoleAttributeValue(AtsAttributeTypes.AllowCreateBranch, true); - verArt.setSoleAttributeValue(AtsAttributeTypes.NextVersion, true); - verArt.setSoleAttributeValue(AtsAttributeTypes.Released, true); - verArt.setSoleAttributeValue(AtsAttributeTypes.VersionLocked, true); - verArt.setSoleAttributeValue(AtsAttributeTypes.BaselineBranchUuid, "1234"); - verArt.setSoleAttributeValue(AtsAttributeTypes.Description, "description"); - verArt.setSoleAttributeValue(AtsAttributeTypes.FullName, "this is full name"); - Date releaseDate = new Date(); - verArt.setSoleAttributeValue(AtsAttributeTypes.ReleaseDate, releaseDate); - verArt.persist(getClass().getSimpleName()); - - version = AtsClientService.get().getConfigObject(verArt); - Assert.assertEquals("VersionArtifactStoreTest - version 1", version.getName()); - Assert.assertTrue(version.isAllowCommitBranch()); - Assert.assertTrue(version.isAllowCreateBranch()); - Assert.assertTrue(version.isLocked()); - Assert.assertTrue(version.isReleased()); - Assert.assertTrue(version.isNextVersion()); - Assert.assertEquals(1234, version.getBaselineBranchUuid()); - Assert.assertEquals("description", version.getDescription()); - Assert.assertEquals("this is full name", version.getFullName()); - Assert.assertEquals(releaseDate, version.getReleaseDate()); - } - - @Test - public void testSaveToArtifact() throws OseeCoreException { - Artifact verArt = ArtifactTypeManager.addArtifact(AtsArtifactTypes.Version, AtsUtilCore.getAtsBranch()); - verArt.setName("VersionArtifactStoreTest - version 2"); - - Artifact teamDef = ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.TeamDefinition, "SAW SW", - AtsUtilCore.getAtsBranch()); - verArt.addRelation(AtsRelationTypes.TeamDefinitionToVersion_TeamDefinition, teamDef); - verArt.persist(getClass().getSimpleName()); - - IAtsVersion version = AtsClientService.get().getConfigObject(verArt); - - version.setAllowCommitBranch(true); - version.setAllowCreateBranch(true); - version.setName("VersionArtifactStoreTest - version 3"); - version.setNextVersion(true); - version.setLocked(true); - Date releaseDate = new Date(); - version.setReleaseDate(releaseDate); - version.setVersionLocked(true); - version.setBaselineBranchUuid(3456L); - version.setDescription("description"); - version.setFullName("full name"); - - AtsChangeSet changes = new AtsChangeSet(VersionArtifactStoreTest.class.getSimpleName() + " - testSaveToArtifact"); - AtsClientService.get().storeConfigObject(version, changes); - changes.execute(); - - Artifact saveArt = AtsClientService.get().getConfigArtifact(version); - Assert.assertEquals("VersionArtifactStoreTest - version 3", version.getName()); - Assert.assertTrue(saveArt.getSoleAttributeValue(AtsAttributeTypes.AllowCommitBranch, true)); - Assert.assertTrue(saveArt.getSoleAttributeValue(AtsAttributeTypes.AllowCreateBranch, true)); - Assert.assertTrue(saveArt.getSoleAttributeValue(AtsAttributeTypes.VersionLocked, true)); - Assert.assertTrue(saveArt.getSoleAttributeValue(AtsAttributeTypes.Released, true)); - Assert.assertTrue(saveArt.getSoleAttributeValue(AtsAttributeTypes.NextVersion, true)); - Assert.assertEquals("3456", saveArt.getSoleAttributeValue(AtsAttributeTypes.BaselineBranchUuid, "")); - Assert.assertEquals("description", saveArt.getSoleAttributeValue(AtsAttributeTypes.Description, "")); - Assert.assertEquals("full name", saveArt.getSoleAttributeValue(AtsAttributeTypes.FullName, "")); - Assert.assertEquals(releaseDate, saveArt.getSoleAttributeValue(AtsAttributeTypes.ReleaseDate, null)); - } -} |