diff options
author | donald.g.dunne | 2015-09-16 20:51:15 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2015-09-16 20:51:15 +0000 |
commit | c2a741d3c9501b2e411804db02e09b7a9bfe410d (patch) | |
tree | 8716a8c3e1052d547e9112d90b71e8d44dd97b03 /plugins/org.eclipse.osee.ats.client.integration.tests | |
parent | f12239abe2b4267948195947a6b59ab0bd1917a4 (diff) | |
download | org.eclipse.osee-c2a741d3c9501b2e411804db02e09b7a9bfe410d.tar.gz org.eclipse.osee-c2a741d3c9501b2e411804db02e09b7a9bfe410d.tar.xz org.eclipse.osee-c2a741d3c9501b2e411804db02e09b7a9bfe410d.zip |
bug[ats_ATS224335]: Add methods to AtsChangeSet
Change-Id: I50724c2e3487d800ab81fd85fc17f4cc2ccda3cb
Diffstat (limited to 'plugins/org.eclipse.osee.ats.client.integration.tests')
2 files changed, 86 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/util/AtsChangeSetTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/util/AtsChangeSetTest.java new file mode 100644 index 00000000000..f0a9bfc30e2 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/util/AtsChangeSetTest.java @@ -0,0 +1,85 @@ +/******************************************************************************* + * 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.util; + +import static org.eclipse.osee.framework.core.enums.DeletionFlag.EXCLUDE_DELETED; +import org.eclipse.osee.ats.api.util.IAtsChangeSet; +import org.eclipse.osee.ats.client.integration.tests.AtsClientService; +import org.eclipse.osee.ats.core.util.AtsUtilCore; +import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; +import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.core.enums.QueryOption; +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.Attribute; +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.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Donald G. Dunne + */ +public class AtsChangeSetTest { + + Artifact folderArt = null; + + @Before + public void setup() { + folderArt = + ArtifactTypeManager.addArtifact(CoreArtifactTypes.Folder, AtsUtilCore.getAtsBranch(), "AtsChangeSetTest"); + folderArt.setSoleAttributeValue(CoreAttributeTypes.StaticId, "my static id"); + folderArt.persist(getClass().getSimpleName()); + } + + @After + public void cleanup() { + SkynetTransaction transaction = + TransactionManager.createTransaction(AtsUtilCore.getAtsBranch(), getClass().getSimpleName()); + for (Artifact artifact : ArtifactQuery.getArtifactListFromName(getClass().getSimpleName(), + AtsUtilCore.getAtsBranch(), EXCLUDE_DELETED, QueryOption.CONTAINS_MATCH_OPTIONS)) { + artifact.deleteAndPersist(transaction); + } + transaction.execute(); + } + + @Test + public void testSetAttributeById_ArtifactId() { + Attribute<?> staticIdAttr = null; + for (Attribute<?> attr : folderArt.getAttributes()) { + if (attr.getAttributeType().getId() == CoreAttributeTypes.StaticId.getGuid()) { + staticIdAttr = attr; + break; + } + } + + IAtsChangeSet changes = AtsClientService.get().getStoreService().createAtsChangeSet(getClass().getSimpleName()); + changes.setAttribute(folderArt, staticIdAttr.getId(), "new id"); + changes.execute(); + + folderArt.reloadAttributesAndRelations(); + Assert.assertEquals("new id", folderArt.getSoleAttributeValue(CoreAttributeTypes.StaticId, null)); + } + + @Test + public void testSetSoleAttributeById() { + IAtsChangeSet changes = AtsClientService.get().getStoreService().createAtsChangeSet(getClass().getSimpleName()); + changes.setSoleAttributeValue(folderArt, CoreAttributeTypes.StaticId, "newest id"); + changes.execute(); + + folderArt.reloadAttributesAndRelations(); + Assert.assertEquals("newest id", folderArt.getSoleAttributeValue(CoreAttributeTypes.StaticId, null)); + } + +} diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/util/AtsTest_Util_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/util/AtsTest_Util_Suite.java index 641b62d3240..6ee95f9df7c 100644 --- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/util/AtsTest_Util_Suite.java +++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/util/AtsTest_Util_Suite.java @@ -21,6 +21,7 @@ import org.junit.runners.Suite; @Suite.SuiteClasses({ AtsNotifyEndpointImplTest.class, AbstractAtsQueryImplTest.class, + AtsChangeSetTest.class, AtsDeleteManagerTest.class, AtsImageTest.class, AtsXWidgetsExampleBlamTest.class, |