Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2016-06-27 21:12:34 +0000
committerRyan T. Baldwin2016-06-27 21:12:34 +0000
commit14561ae3d24688e05f7673132230103598447eb0 (patch)
treeb942d697d5fde9c8f3f0a096ddbceca0d56a5e81
parent00fc734471617e5705978ee08489d987ba234207 (diff)
downloadorg.eclipse.osee-14561ae3d24688e05f7673132230103598447eb0.tar.gz
org.eclipse.osee-14561ae3d24688e05f7673132230103598447eb0.tar.xz
org.eclipse.osee-14561ae3d24688e05f7673132230103598447eb0.zip
feature[ats_ATS286643]: HLR - Implement Types Versioning
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClient.java4
-rw-r--r--plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java10
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java5
-rw-r--r--plugins/org.eclipse.osee.ats.mocks/data/README.txt7
-rw-r--r--plugins/org.eclipse.osee.ats.mocks/data/binary_data.zipbin321093 -> 322541 bytes
-rw-r--r--plugins/org.eclipse.osee.ats.mocks/data/hsql.zipbin1650975 -> 150186 bytes
-rw-r--r--plugins/org.eclipse.osee.client.demo/.project6
-rw-r--r--plugins/org.eclipse.osee.client.demo/plugin.xml2
-rw-r--r--plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslRenderer.java12
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java6
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypeSheet.java66
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypesData.java42
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java2
-rw-r--r--plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java35
-rw-r--r--plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/OseeTypesSetup.java53
-rw-r--r--plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java9
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/plugin.xml2
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/schema/OseeTypes.exsd22
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/.project6
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/oauth.dbinit.types.xml10
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorage.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java18
-rw-r--r--plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthDbInit.java45
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.db.mock/data/README.txt13
-rw-r--r--plugins/org.eclipse.osee.orcs.db.mock/data/binary_data.zipbin298952 -> 322541 bytes
-rw-r--r--plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zipbin57807 -> 150186 bytes
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java40
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java168
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java21
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java11
-rw-r--r--plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TypesEndpoint.java13
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.application.xml1
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java57
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java33
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchQueryTest.java76
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java10
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java129
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java29
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsScriptTest.java226
-rw-r--r--plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTxQueryTest.java484
-rw-r--r--plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/OrcsTopicEvents.java24
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/README_BEFORE_RUNNING_TESTS.txt10
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/AccountClientTest.java11
-rw-r--r--plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java66
-rw-r--r--plugins/org.eclipse.osee.x.server.p2/demo/README.txt11
-rw-r--r--plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zipbin314935 -> 322541 bytes
-rw-r--r--plugins/org.eclipse.osee.x.server.p2/demo/hsql.zipbin115826 -> 150186 bytes
55 files changed, 1016 insertions, 825 deletions
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClient.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClient.java
index bb5969a83ce..0202921f139 100644
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClient.java
+++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/AccountClient.java
@@ -68,4 +68,8 @@ public interface AccountClient {
AccountWebPreferences getAccountWebPreferencesByUniqueField(Long accountId);
+ boolean isLocalHost();
+
+ String getBaseUri();
+
}
diff --git a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
index 7e5033efc1a..98cfda85c87 100644
--- a/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
+++ b/plugins/org.eclipse.osee.account.rest.client/src/org/eclipse/osee/account/rest/client/internal/AccountClientImpl.java
@@ -290,4 +290,14 @@ public class AccountClientImpl implements AccountClient {
}
};
}
+
+ @Override
+ public boolean isLocalHost() {
+ return baseUri.toString().contains("localhost");
+ }
+
+ @Override
+ public String getBaseUri() {
+ return baseUri.toString();
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java
index 2ff9925a58a..bed73151749 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/query/AbstractAtsQueryImpl.java
@@ -562,11 +562,6 @@ public abstract class AbstractAtsQueryImpl implements IAtsQuery {
artifactTypes.add(workItemType.getArtifactType());
}
}
- if (workItemTypes.contains(WorkItemType.WorkItem)) {
- for (WorkItemType workItemType : WorkItemType.values()) {
- artifactTypes.add(workItemType.getArtifactType());
- }
- }
return artifactTypes;
}
diff --git a/plugins/org.eclipse.osee.ats.mocks/data/README.txt b/plugins/org.eclipse.osee.ats.mocks/data/README.txt
index 573565570d7..8aa5fbe176e 100644
--- a/plugins/org.eclipse.osee.ats.mocks/data/README.txt
+++ b/plugins/org.eclipse.osee.ats.mocks/data/README.txt
@@ -2,7 +2,10 @@ When database schema, types or dbinit change, the files in this data directory m
To do so:
1) Delete C:/Users/<account>/hsql and C:/Users/<account>/attr
-2) Do a normal AtsClient_Integration_TestSuite
+2) Do a normal AtsClient_Integration_TestSuite, stop before ClientResourceTest
3) Zip up hsql dir to hsql.zip and copy to this directory
4) Zip up attr to binary_data.zip and copy to this directory
-5) Re-run AtsServer_Integration_TestSuite and fix any errors \ No newline at end of file
+5) Re-run AtsServer_Integration_TestSuite and fix any errors
+
+All canned-db test bundles should be updated with the same zip files, there are
+- search for hsql.db for all locations
diff --git a/plugins/org.eclipse.osee.ats.mocks/data/binary_data.zip b/plugins/org.eclipse.osee.ats.mocks/data/binary_data.zip
index a3d239ff17f..fa798cb3b4e 100644
--- a/plugins/org.eclipse.osee.ats.mocks/data/binary_data.zip
+++ b/plugins/org.eclipse.osee.ats.mocks/data/binary_data.zip
Binary files differ
diff --git a/plugins/org.eclipse.osee.ats.mocks/data/hsql.zip b/plugins/org.eclipse.osee.ats.mocks/data/hsql.zip
index 725a06ce884..9102f85784e 100644
--- a/plugins/org.eclipse.osee.ats.mocks/data/hsql.zip
+++ b/plugins/org.eclipse.osee.ats.mocks/data/hsql.zip
Binary files differ
diff --git a/plugins/org.eclipse.osee.client.demo/.project b/plugins/org.eclipse.osee.client.demo/.project
index a864250fb0c..7937684eb1d 100644
--- a/plugins/org.eclipse.osee.client.demo/.project
+++ b/plugins/org.eclipse.osee.client.demo/.project
@@ -6,6 +6,11 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -24,5 +29,6 @@
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
diff --git a/plugins/org.eclipse.osee.client.demo/plugin.xml b/plugins/org.eclipse.osee.client.demo/plugin.xml
index e48a61279e2..79e52c33583 100644
--- a/plugins/org.eclipse.osee.client.demo/plugin.xml
+++ b/plugins/org.eclipse.osee.client.demo/plugin.xml
@@ -56,6 +56,8 @@
name="OseeTypes_ClientDemo"
point="org.eclipse.osee.framework.skynet.core.OseeTypes">
<OseeTypes
+ guid="AQjoNnwNdyjicTck2UwA"
+ id="466104557"
resource="support/OseeTypes_ClientDemo.osee">
</OseeTypes>
</extension>
diff --git a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslRenderer.java b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslRenderer.java
index d440c5355a1..de1b29eb66c 100644
--- a/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslRenderer.java
+++ b/plugins/org.eclipse.osee.framework.core.dsl.ui.integration/src/org/eclipse/osee/framework/core/dsl/ui/integration/internal/OseeDslRenderer.java
@@ -32,8 +32,10 @@ import org.eclipse.osee.framework.ui.skynet.render.PresentationType;
* @author Roberto E. Escobar
*/
public final class OseeDslRenderer extends AbstractDslRenderer {
- private static final IArtifactType[] MATCHING_ARTIFACT_TYPES =
- {CoreArtifactTypes.AccessControlModel, CoreArtifactTypes.OseeTypeDefinition};
+ private static final IArtifactType[] MATCHING_ARTIFACT_TYPES = {
+ CoreArtifactTypes.AccessControlModel,
+ CoreArtifactTypes.OseeTypeDefinition,
+ CoreArtifactTypes.OseeTypeDefinitionTemp};
private static final OseeDslSegmentParser parser = new OseeDslSegmentParser();
@@ -57,7 +59,8 @@ public final class OseeDslRenderer extends AbstractDslRenderer {
Artifact artifact = artifacts.iterator().next();
String data;
- if (artifact.isOfType(CoreArtifactTypes.OseeTypeDefinition)) {
+ if (artifact.isOfType(CoreArtifactTypes.OseeTypeDefinition) || artifact.isOfType(
+ CoreArtifactTypes.OseeTypeDefinitionTemp)) {
data = artifact.getSoleAttributeValueAsString(CoreAttributeTypes.UriGeneralStringData, "");
} else {
StringBuilder builder = new StringBuilder();
@@ -80,7 +83,8 @@ public final class OseeDslRenderer extends AbstractDslRenderer {
protected IOperation getUpdateOperation(File file, List<Artifact> artifacts, BranchId branch, PresentationType presentationType) {
IOperation op;
Artifact artifact = artifacts.iterator().next();
- if (artifact.isOfType(CoreArtifactTypes.OseeTypeDefinition)) {
+ if (artifact.isOfType(CoreArtifactTypes.OseeTypeDefinition) || artifact.isOfType(
+ CoreArtifactTypes.OseeTypeDefinitionTemp)) {
OseeTypeModifier modifier = new OseeTypeModifier();
op = new FileToAttributeUpdateOperation(file, artifacts.get(0), CoreAttributeTypes.UriGeneralStringData,
modifier);
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java
index ffbacdd8419..73dbac43a42 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/AttributeId.java
@@ -25,8 +25,8 @@ public interface AttributeId extends HasLocalId<Integer>, Id {
@JsonCreator
public static AttributeId valueOf(long id) {
- final class AttributeIdImpl extends BaseId implements AttributeId {
- public AttributeIdImpl(Long txId) {
+ final class AttributeToken extends BaseId implements AttributeId {
+ public AttributeToken(Long txId) {
super(txId);
}
@@ -35,6 +35,6 @@ public interface AttributeId extends HasLocalId<Integer>, Id {
return getId().intValue();
}
}
- return new AttributeIdImpl(id);
+ return new AttributeToken(id);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypeSheet.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypeSheet.java
new file mode 100644
index 00000000000..1501a0ab638
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypeSheet.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.data;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class OrcsTypeSheet {
+
+ public String name;
+ public String typesSheet;
+ public String id;
+ public String guid;
+
+ public OrcsTypeSheet() {
+ // For JAX-RS Instantiation
+ }
+
+ public OrcsTypeSheet(String name, String typesSheet) {
+ this.name = name;
+ this.typesSheet = typesSheet;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getTypesSheet() {
+ return typesSheet;
+ }
+
+ public void setTypesSheet(String typesSheet) {
+ this.typesSheet = typesSheet;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypesData.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypesData.java
new file mode 100644
index 00000000000..3d9e9a5b4cd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/data/OrcsTypesData.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.core.data;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author Donald G. Dunne
+ */
+@XmlRootElement
+public class OrcsTypesData {
+
+ /**
+ * This value should change and the corresponding entries made in the Tuple2 table that maps this version to the Uri
+ * attribute ids of the types to load. This provides for production code to access an over version of the types
+ * model/sheets while the current code base works of this specified version.</br>
+ * </br>
+ * Version 1 = Corresponds to 0.23.1 and earlier code base
+ */
+ public static final Long OSEE_TYPE_VERSION = 2L; // Corresponds to 0.24.0 code base
+
+ private List<OrcsTypeSheet> sheets = new ArrayList<>();
+
+ public List<OrcsTypeSheet> getSheets() {
+ return sheets;
+ }
+
+ public void setSheets(List<OrcsTypeSheet> sheets) {
+ this.sheets = sheets;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java
index f6f27f049ef..1f2f9af2c2e 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/enums/CoreArtifactTypes.java
@@ -52,6 +52,8 @@ public final class CoreArtifactTypes {
public static final IArtifactType WholeWord = TokenFactory.createArtifactType(0x0000000000000012L, "MS Word Whole Document");
public static final IArtifactType OseeApp = TokenFactory.createArtifactType(0x0000000000000059L, "OSEE App");
public static final IArtifactType OseeTypeDefinition = TokenFactory.createArtifactType(0x000000000000003CL, "Osee Type Definition");
+ // Added to support OSEE types versioning between 23.1 and 24. Remove after 24.0 release.
+ public static final IArtifactType OseeTypeDefinitionTemp = TokenFactory.createArtifactType(0x19F3D0F33D5ACC54L, "Osee Type Definition Temp");
public static final IArtifactType OseeTypesEnum = TokenFactory.createArtifactType(0x4B9A7DCF0856C368L, "Osee Type Enum");
public static final IArtifactType RendererTemplate = TokenFactory.createArtifactType(0x0000000000000009L, "Renderer Template");
public static final IArtifactType Requirement = TokenFactory.createArtifactType(0x0000000000000015L, "Requirement");
diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java
index 5776068095e..41f86dfcebc 100644
--- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java
+++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/AddCommonBranch.java
@@ -12,13 +12,10 @@
package org.eclipse.osee.framework.database.init;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Map;
-import java.util.Map.Entry;
+import java.util.List;
import org.eclipse.osee.framework.core.data.IUserToken;
+import org.eclipse.osee.framework.core.data.OrcsTypeSheet;
+import org.eclipse.osee.framework.core.data.OrcsTypesData;
import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
@@ -26,7 +23,6 @@ import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.database.init.internal.OseeTypesSetup;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
-import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.skynet.core.GlobalXViewerSettings;
import org.eclipse.osee.framework.skynet.core.OseeSystemArtifacts;
import org.eclipse.osee.framework.skynet.core.SystemGroup;
@@ -67,27 +63,10 @@ public abstract class AddCommonBranch implements IDbInitializationTask {
BranchManager.createTopLevelBranch(CoreBranches.COMMON);
OseeTypesSetup types = new OseeTypesSetup();
- Map<String, URL> typeMap = types.getOseeTypeExtensions();
-
- SkynetTransaction transaction1 = TransactionManager.createTransaction(COMMON, "Add Types to Common Branch");
-
- for (Entry<String, URL> entry : typeMap.entrySet()) {
- Artifact artifact =
- ArtifactTypeManager.addArtifact(CoreArtifactTypes.OseeTypeDefinition, COMMON, entry.getKey());
- artifact.setSoleAttributeValue(CoreAttributeTypes.Active, true);
- InputStream inputStream = null;
- try {
- inputStream = new BufferedInputStream(entry.getValue().openStream());
- artifact.setSoleAttributeFromStream(CoreAttributeTypes.UriGeneralStringData, inputStream);
- } catch (IOException ex) {
- throw new OseeCoreException(ex, "Unable to find OSEE type file for [%s:%s]", entry.getKey(),
- entry.getValue());
- } finally {
- Lib.close(inputStream);
- }
- transaction1.addArtifact(artifact);
- }
- transaction1.execute();
+ List<OrcsTypeSheet> sheets = types.getOseeTypeExtensions();
+ OrcsTypesData typesData = new OrcsTypesData();
+ typesData.getSheets().addAll(sheets);
+ ArtifactTypeManager.importOrcsTypes(typesData);
SkynetTransaction transaction = TransactionManager.createTransaction(COMMON, "Add Common Branch");
diff --git a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/OseeTypesSetup.java b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/OseeTypesSetup.java
index 4ab9c1a6451..897000d14c7 100644
--- a/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/OseeTypesSetup.java
+++ b/plugins/org.eclipse.osee.framework.database.init/src/org/eclipse/osee/framework/database/init/internal/OseeTypesSetup.java
@@ -11,6 +11,7 @@
package org.eclipse.osee.framework.database.init.internal;
+import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
@@ -18,14 +19,13 @@ import java.io.Writer;
import java.net.URI;
import java.net.URL;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
+import java.util.LinkedList;
+import java.util.List;
import java.util.logging.Level;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.osee.framework.core.data.OrcsTypeSheet;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -39,7 +39,7 @@ import org.osgi.framework.Bundle;
* This class provides necessary functionality for branches to be loaded with SkynetDbTypes through their extension
* points. Creation, adding skynet types and initializing a new branch should be done through
* BranchManager.createRootBranch.
- *
+ *
* @author Andrew M. Finkbeiner
* @author Donald G. Dunne
* @see BranchManager#createTopLevelBranch(String, String, String, Collection, boolean)
@@ -62,7 +62,7 @@ public class OseeTypesSetup {
public void execute(Collection<String> uniqueIdsToImport) throws OseeCoreException {
File combinedFile = null;
try {
- Map<String, URL> itemsToProcess = getOseeTypeExtensionsById(uniqueIdsToImport);
+ List<OrcsTypeSheet> itemsToProcess = getOseeTypeExtensionsById(uniqueIdsToImport);
combinedFile = createCombinedFile(itemsToProcess);
processOseeTypeData(combinedFile.toURI());
// Only delete file if no problems processing
@@ -73,30 +73,38 @@ public class OseeTypesSetup {
}
}
- public Map<String, URL> getOseeTypeExtensions() {
- Map<String, URL> oseeTypes = new HashMap<>();
+ public List<OrcsTypeSheet> getOseeTypeExtensions() {
+ List<OrcsTypeSheet> oseeTypes = new LinkedList<>();
for (IConfigurationElement element : ExtensionPoints.getExtensionElements(OSEE_TYPES_EXTENSION_ID, "OseeTypes")) {
+ OrcsTypeSheet sheet = new OrcsTypeSheet();
String resourceName = element.getAttribute("resource");
Bundle bundle = Platform.getBundle(element.getContributor().getName());
URL url = bundle.getEntry(resourceName);
- oseeTypes.put(element.getDeclaringExtension().getUniqueIdentifier(), url);
+ sheet.setName(element.getDeclaringExtension().getUniqueIdentifier());
+ sheet.setGuid(element.getAttribute("guid"));
+ sheet.setId(element.getAttribute("id"));
+ try {
+ sheet.setTypesSheet(Lib.inputStreamToString(new BufferedInputStream(url.openStream())));
+ oseeTypes.add(sheet);
+ } catch (IOException ex) {
+ OseeCoreException.wrapAndThrow(ex);
+ }
}
return oseeTypes;
}
- public File createCombinedFile(Map<String, URL> urls) throws IOException {
+ public File createCombinedFile(List<OrcsTypeSheet> sheets) throws IOException {
String userHome = System.getProperty("user.home");
File file = new File(userHome, "osee.types." + Lib.getDateTimeString() + ".osee");
Writer writer = null;
try {
writer = new FileWriter(file);
- for (Entry<String, URL> entry : urls.entrySet()) {
- URL url = entry.getValue();
- String oseeTypeFragment = Lib.inputStreamToString(url.openStream());
+ for (OrcsTypeSheet sheet : sheets) {
+ String oseeTypeFragment = sheet.getTypesSheet();
oseeTypeFragment = oseeTypeFragment.replaceAll("import\\s+\"", "// import \"");
writer.write("\n");
writer.write("////////////// ");
- writer.write(entry.getKey());
+ writer.write(sheet.getName());
writer.write("\n");
writer.write("\n");
writer.write(oseeTypeFragment);
@@ -109,20 +117,15 @@ public class OseeTypesSetup {
return file;
}
- private Map<String, URL> getOseeTypeExtensionsById(Collection<String> uniqueIdsToImport) {
- Map<String, URL> items = new LinkedHashMap<>();
- Map<String, URL> extensions = getOseeTypeExtensions();
- for (String idsToImport : uniqueIdsToImport) {
- URL urlEntry = extensions.get(idsToImport);
- if (urlEntry == null) {
- OseeLog.logf(DatabaseInitActivator.class, Level.SEVERE, "ExtensionUniqueId [%s] was not found",
- idsToImport);
- } else {
- items.put(idsToImport, urlEntry);
+ private List<OrcsTypeSheet> getOseeTypeExtensionsById(Collection<String> uniqueIdsToImport) {
+ List<OrcsTypeSheet> items = new LinkedList<>();
+ for (OrcsTypeSheet sheet : getOseeTypeExtensions()) {
+ if (uniqueIdsToImport.contains(sheet.getName())) {
+ items.add(sheet);
}
}
OseeLog.logf(DatabaseInitActivator.class, Level.INFO, "Importing:\n\t%s",
- items.keySet().toString().replaceAll(",", ",\n\t"));
+ items.toString().replaceAll(",", ",\n\t"));
return items;
}
diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
index ce281d881bb..2e55f69a9fb 100644
--- a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
+++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/util/Lib.java
@@ -67,6 +67,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import org.eclipse.osee.framework.jdk.core.text.change.ChangeSet;
+import org.eclipse.osee.framework.jdk.core.type.Named;
import org.eclipse.osee.framework.jdk.core.util.io.IOInputThread;
import org.eclipse.osee.framework.jdk.core.util.io.IOOutputThread;
import org.eclipse.osee.framework.jdk.core.util.io.InputBufferThread;
@@ -1763,4 +1764,12 @@ public final class Lib {
return isWriteable;
}
+ public static Collection<String> getNames(Collection<? extends Named> objects) {
+ Collection<String> names = new LinkedList<>();
+ for (Object obj : objects) {
+ names.add(((Named) obj).getName());
+ }
+ return names;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml b/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml
index e006c709c9c..6cfbb264690 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml
+++ b/plugins/org.eclipse.osee.framework.skynet.core/plugin.xml
@@ -34,6 +34,8 @@
name="OseeTypes_Framework"
point="org.eclipse.osee.framework.skynet.core.OseeTypes">
<OseeTypes
+ guid="AQjoNk+tfwaBTmnl1IQA"
+ id="518481167"
resource="support/OseeTypes_Framework.osee">
</OseeTypes>
</extension>
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/schema/OseeTypes.exsd b/plugins/org.eclipse.osee.framework.skynet.core/schema/OseeTypes.exsd
index dcaec91f57e..3ae55ee60bf 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/schema/OseeTypes.exsd
+++ b/plugins/org.eclipse.osee.framework.skynet.core/schema/OseeTypes.exsd
@@ -18,7 +18,6 @@
</annotation>
<complexType>
<sequence>
- <element ref="ExcelFile" minOccurs="0" maxOccurs="1"/>
<element ref="OseeTypes"/>
</sequence>
<attribute name="point" type="string" use="required">
@@ -48,9 +47,9 @@
</complexType>
</element>
- <element name="ExcelFile">
+ <element name="OseeTypes">
<complexType>
- <attribute name="file" type="string" use="required">
+ <attribute name="resource" type="string" use="required">
<annotation>
<documentation>
@@ -60,19 +59,18 @@
</appInfo>
</annotation>
</attribute>
- </complexType>
- </element>
-
- <element name="OseeTypes">
- <complexType>
- <attribute name="resource" type="string" use="required">
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="guid" type="string">
<annotation>
<documentation>
</documentation>
- <appInfo>
- <meta.attribute kind="resource"/>
- </appInfo>
</annotation>
</attribute>
</complexType>
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
index 72fcbeeaac0..a0463f8b000 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactTypeManager.java
@@ -25,6 +25,7 @@ import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IArtifactToken;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.OrcsTypesData;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.exception.OseeTypeDoesNotExist;
@@ -255,4 +256,11 @@ public class ArtifactTypeManager {
return userCreationoAllowed;
}
+ public static void importOrcsTypes(OrcsTypesData typesData) {
+ OseeClient oseeClient = ServiceUtil.getOseeClient();
+ TypesEndpoint typesEndpoint = oseeClient.getTypesEndpoint();
+ typesEndpoint.importOrcsTypes(typesData);
+ typesEndpoint.dbInit();
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java
index 4f4fcdf4176..8a3e3d2b832 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin.test/src/org/eclipse/osee/orcs/account/admin/integration/OrcsAccountStorageTest.java
@@ -97,7 +97,7 @@ public class OrcsAccountStorageTest {
@Test
public void testGetAllAccounts() {
ResultSet<Account> result = storage.getAllAccounts();
- assertEquals(10, result.size());
+ assertEquals(24, result.size());
}
@Test
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/.project b/plugins/org.eclipse.osee.orcs.account.admin/.project
index 322c9e73939..35d217dc72c 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/.project
+++ b/plugins/org.eclipse.osee.orcs.account.admin/.project
@@ -6,6 +6,11 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
@@ -29,5 +34,6 @@
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
index 6f7f499be6a..27034a79250 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.account.admin/META-INF/MANIFEST.MF
@@ -28,5 +28,6 @@ Import-Package: com.google.common.base;version="15.0.0",
org.eclipse.osee.orcs.data,
org.eclipse.osee.orcs.search,
org.eclipse.osee.orcs.transaction,
- org.eclipse.osee.orcs.utility
+ org.eclipse.osee.orcs.utility,
+ org.osgi.service.event;version="1.3.1"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/oauth.dbinit.types.xml b/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/oauth.dbinit.types.xml
new file mode 100644
index 00000000000..80fa9bcb1ba
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/OSGI-INF/oauth.dbinit.types.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true">
+ <implementation class="org.eclipse.osee.orcs.account.admin.internal.oauth.OAuthDbInit"/>
+ <service>
+ <provide interface="org.osgi.service.event.EventHandler"/>
+ </service>
+ <property name="event.topics" type="String" value="orcs/dbinit/importTypes"/>
+ <reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
+ <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorage.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorage.java
index 560be3fffa1..ca2bfe9262c 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorage.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorage.java
@@ -173,7 +173,7 @@ public class ClientStorage {
return newQuery().andUuid(OAUTH_TYPES.getUuid()).andTypeEquals(OAUTH_TYPES.getArtifactType()).getResults();
}
- public void storeTypes(InputSupplier<? extends InputStream> resource) {
+ public ArtifactId storeTypes(InputSupplier<? extends InputStream> resource) {
TransactionBuilder tx = newTransaction(null, "Initialize OAuth Type Definitions");
ArtifactId artifactId = tx.createArtifact(OAUTH_TYPES);
InputStream stream = null;
@@ -188,6 +188,7 @@ public class ClientStorage {
tx.commit();
reloadTypes();
+ return artifactId;
}
private void reloadTypes() {
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java
index 0eb05163ab5..c4e42bb181f 100644
--- a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/ClientStorageProvider.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.account.admin.internal.oauth;
+import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import com.google.common.io.InputSupplier;
import com.google.gson.GsonBuilder;
import java.io.BufferedInputStream;
@@ -19,10 +20,16 @@ import java.net.URL;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import org.eclipse.osee.framework.core.data.BranchId;
+import org.eclipse.osee.framework.core.data.OrcsTypesData;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.CoreTupleTypes;
+import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.LazyObject;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.transaction.TransactionBuilder;
/**
* @author Roberto E. Escobar
@@ -53,8 +60,17 @@ public class ClientStorageProvider extends LazyObject<ClientStorage> {
ClientStorage clientStorage = new ClientStorage(logger, builder, orcsApi, storageBranch);
if (!clientStorage.typesExist()) {
- clientStorage.storeTypes(newTypesSupplier());
+ InputSupplier<InputStream> newTypesSupplier = newTypesSupplier();
+ ArtifactReadable typeArt = (ArtifactReadable) clientStorage.storeTypes(newTypesSupplier);
+
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(COMMON.getId(),
+ SystemUser.OseeSystem, "Add OseeTypeDef OAuth Tuple to Common Branch");
+ tx.addTuple2(CoreTupleTypes.OseeTypeDef, OrcsTypesData.OSEE_TYPE_VERSION,
+ typeArt.getAttributes(CoreAttributeTypes.UriGeneralStringData).iterator().next());
+
+ tx.commit();
}
+
return clientStorage;
}
diff --git a/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthDbInit.java b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthDbInit.java
new file mode 100644
index 00000000000..4decc4f86f2
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.account.admin/src/org/eclipse/osee/orcs/account/admin/internal/oauth/OAuthDbInit.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.orcs.account.admin.internal.oauth;
+
+import org.eclipse.osee.logger.Log;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.OrcsTopicEvents;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * Handler for {@link OrcsTopicEvents.DBINIT_IMPORT_TYPES}
+ *
+ * @author Donald G. Dunne
+ */
+public class OAuthDbInit implements EventHandler {
+
+ private static Log logger;
+ private static OrcsApi orcsApi;
+
+ public void setLogger(Log logger) {
+ OAuthDbInit.logger = logger;
+ }
+
+ public void setOrcsApi(OrcsApi orcsApi) {
+ OAuthDbInit.orcsApi = orcsApi;
+ }
+
+ @Override
+ public void handleEvent(Event event) {
+ ClientStorageProvider provider = new ClientStorageProvider();
+ provider.setLogger(logger);
+ provider.setOrcsApi(orcsApi);
+ provider.createLoaderTask().run();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
index 9eb1972fab4..202cb57500f 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/transaction/TransactionBuilderImpl.java
@@ -29,6 +29,7 @@ import org.eclipse.osee.framework.core.data.Tuple3Type;
import org.eclipse.osee.framework.core.data.Tuple4Type;
import org.eclipse.osee.framework.core.data.TupleTypeId;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.jdk.core.type.Id;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
import org.eclipse.osee.orcs.KeyValueOps;
@@ -400,10 +401,10 @@ public class TransactionBuilderImpl implements TransactionBuilder {
if (element1 instanceof String) {
e1 = insertValue((String) element1);
} else {
- if (element1 instanceof ArtifactId) {
- e1 = ((ArtifactId) element1).getUuid();
+ if (element1 instanceof Id) {
+ e1 = ((Id) element1).getId();
} else if (element1 instanceof AttributeId) {
- e1 = new Long(((AttributeId) element1).getLocalId());
+ e1 = Long.valueOf(((AttributeId) element1).getLocalId());
} else {
e1 = (Long) element1;
}
@@ -411,10 +412,10 @@ public class TransactionBuilderImpl implements TransactionBuilder {
if (element2 instanceof String) {
e2 = insertValue((String) element2);
} else {
- if (element2 instanceof ArtifactId) {
- e2 = ((ArtifactId) element2).getUuid();
+ if (element1 instanceof ArtifactId) {
+ e2 = ((Id) element2).getId();
} else if (element2 instanceof AttributeId) {
- e2 = new Long(((AttributeId) element2).getLocalId());
+ e2 = Long.valueOf(((AttributeId) element2).getLocalId());
} else {
e2 = (Long) element2;
}
diff --git a/plugins/org.eclipse.osee.orcs.db.mock/data/README.txt b/plugins/org.eclipse.osee.orcs.db.mock/data/README.txt
new file mode 100644
index 00000000000..748a2a4b5b8
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.db.mock/data/README.txt
@@ -0,0 +1,13 @@
+When database schema, types or dbinit change, the files in this data directory may need to be updated.
+To do so:
+
+1) Delete C:/Users/<account>/hsql and C:/Users/<account>/attr
+2) Do a normal AtsClient_Integration_TestSuite, stop before ClientResourceTest
+3) Zip up hsql dir to hsql.zip and copy to this directory
+4) Zip up attr to binary_data.zip and copy to this directory
+5) Re-run OrcsIntegrationTestSuite and fix any errors
+
+Note: These database files are written out to users home directory in a dir named after test
+
+All canned-db test bundles should be updated with the same zip files, there are
+- search for hsql.db for all locations
diff --git a/plugins/org.eclipse.osee.orcs.db.mock/data/binary_data.zip b/plugins/org.eclipse.osee.orcs.db.mock/data/binary_data.zip
index bcce683698e..fa798cb3b4e 100644
--- a/plugins/org.eclipse.osee.orcs.db.mock/data/binary_data.zip
+++ b/plugins/org.eclipse.osee.orcs.db.mock/data/binary_data.zip
Binary files differ
diff --git a/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip b/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
index 28497263d59..9102f85784e 100644
--- a/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
+++ b/plugins/org.eclipse.osee.orcs.db.mock/data/hsql.zip
Binary files differ
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java
index afd585aee4f..c54180c18e8 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java
@@ -42,47 +42,47 @@ public class IntegrationUtil {
public static void verifyData(ArtifactData data, Object... values) {
int index = 0;
- assertEquals(data.getLocalId(), values[index++]);
- assertEquals(data.getGuid(), values[index++]);
- assertEquals(data.getModType(), values[index++]);
- assertEquals(data.getTypeUuid(), values[index++]);
+ assertEquals(values[index++], data.getLocalId());
+ assertEquals(values[index++], data.getGuid());
+ assertEquals(values[index++], data.getModType());
+ assertEquals(values[index++], data.getTypeUuid());
verifyData(data.getVersion(), index, values);
}
public static void verifyData(AttributeData data, Object... values) throws OseeCoreException {
int index = 0;
- assertEquals(data.getLocalId(), values[index++]);
- assertEquals(data.getArtifactId(), values[index++]);
- assertEquals(data.getModType(), values[index++]);
- assertEquals(data.getTypeUuid(), values[index++]);
+ assertEquals(values[index++], data.getLocalId());
+ assertEquals(values[index++], data.getArtifactId());
+ assertEquals(values[index++], data.getModType());
+ assertEquals(values[index++], data.getTypeUuid());
index = verifyData(data.getVersion(), index, values);
Object[] proxied = data.getDataProxy().getData();
- assertEquals(proxied[0], values[index++]); // value
- assertEquals(proxied[1], values[index++]); // uri
+ assertEquals(values[index++], proxied[0]); // value
+ assertEquals(values[index++], proxied[1]); // uri
}
public static void verifyData(RelationData data, Object... values) {
int index = 0;
- assertEquals(data.getLocalId(), values[index++]);
+ assertEquals(values[index++], data.getLocalId());
- assertEquals(data.getArtIdA(), values[index++]);
- assertEquals(data.getArtIdB(), values[index++]);
- assertEquals(data.getRationale(), values[index++]);
+ assertEquals(values[index++], data.getArtIdA());
+ assertEquals(values[index++], data.getArtIdB());
+ assertEquals(values[index++], data.getRationale());
- assertEquals(data.getModType(), values[index++]);
- assertEquals(data.getTypeUuid(), values[index++]);
+ assertEquals(values[index++], data.getModType());
+ assertEquals(values[index++], data.getTypeUuid());
verifyData(data.getVersion(), index, values);
}
public static int verifyData(VersionData version, int index, Object... values) {
- assertEquals(version.getBranchId(), values[index++]);
- assertEquals(version.getTransactionId(), values[index++]);
- assertEquals(version.getStripeId(), values[index++]);
- assertEquals(version.getGammaId(), values[index++]);
+ assertEquals(values[index++], version.getBranchId());
+ assertEquals(values[index++], version.getTransactionId());
+ assertEquals(values[index++], version.getStripeId());
+ assertEquals(values[index++], version.getGammaId());
return index;
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java
index d892c056ddc..398472382aa 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Iterator;
import org.eclipse.osee.executor.admin.HasCancellation;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.LoadLevel;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
@@ -60,7 +61,6 @@ public class LoaderTest {
public TestRule db = integrationRule(this);
// @formatter:off
-// @OsgiService private JdbcClient jdbcClient;
@OsgiService private OrcsDataStore dataStore;
@Mock private LoadDataHandler builder;
@Captor private ArgumentCaptor<LoadDescription> descriptorCaptor;
@@ -75,6 +75,12 @@ public class LoaderTest {
private HasCancellation cancellation;
private DataLoaderFactory loaderFactory;
+ private final int OseeTypesFrameworkId = 518481167;
+ private final String OseeTypesFrameworkGuid = "AQjoNk+tfwaBTmnl1IQA";
+ private final int OseeTypesDemoId = 466104557;
+ private final String OseeTypesDemoGuid = "AQjoNnwNdyjicTck2UwA";
+ private final int UserGroupsId = CoreArtifactTokens.UserGroups.getUuid().intValue();
+ private final String UserGroupsGuid = CoreArtifactTokens.UserGroups.getGuid();
@Before
public void setUp() throws OseeCoreException {
@@ -88,22 +94,28 @@ public class LoaderTest {
String sessionId = GUID.create();
when(session.getGuid()).thenReturn(sessionId);
- when(artTypes.getByUuid(OseeTypeDefinition.getGuid())).thenReturn(OseeTypeDefinition);
- when(artTypes.getByUuid(Folder.getGuid())).thenReturn(Folder);
+ when(artTypes.getByUuid(OseeTypeDefinition.getId())).thenReturn(OseeTypeDefinition);
+ when(artTypes.getByUuid(Folder.getId())).thenReturn(Folder);
- when(attrTypes.getByUuid(Name.getGuid())).thenReturn(Name);
- when(attrTypes.getByUuid(UriGeneralStringData.getGuid())).thenReturn(UriGeneralStringData);
- when(attrTypes.getByUuid(Active.getGuid())).thenReturn(Active);
+ when(attrTypes.getByUuid(Name.getId())).thenReturn(Name);
+ when(attrTypes.getByUuid(UriGeneralStringData.getId())).thenReturn(UriGeneralStringData);
+ when(attrTypes.getByUuid(Active.getId())).thenReturn(Active);
when(attrTypes.getAttributeProviderId(Name)).thenReturn("DefaultAttributeDataProvider");
when(attrTypes.getAttributeProviderId(UriGeneralStringData)).thenReturn("DefaultAttributeDataProvider");
when(attrTypes.getAttributeProviderId(Active)).thenReturn("DefaultAttributeDataProvider");
+
}
@org.junit.Test
public void testLoad() throws OseeCoreException {
- DataLoader loader = loaderFactory.newDataLoaderFromIds(session, COMMON_ID, 5, 6, 7);
+ DataLoader loader =
+ loaderFactory.newDataLoaderFromIds(session, COMMON_ID, OseeTypesFrameworkId, OseeTypesDemoId, UserGroupsId);
loader.withLoadLevel(LoadLevel.ALL);
+ verifyArtsAttrAndRelData(loader);
+ }
+
+ private void verifyArtsAttrAndRelData(DataLoader loader) {
loader.load(cancellation, builder);
@@ -116,44 +128,61 @@ public class LoaderTest {
verify(builder, times(3)).onData(artifactCaptor.capture());
verify(builder, times(7)).onData(attributeCaptor.capture());
- verify(builder, times(3)).onData(relationCaptor.capture());
+ verify(builder, times(6)).onData(relationCaptor.capture());
sort(artifactCaptor.getAllValues());
Iterator<ArtifactData> arts = artifactCaptor.getAllValues().iterator();
- // @formatter:off
- verifyData(arts.next(), 5, "AkA10I4aUSDLuFNIaegA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 15L);
- verifyData(arts.next(), 6, "AkA10LiAPEZLR4+jdFQA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 16L);
- verifyData(arts.next(), 7, "AkA2AcT6AXe6ivMFRhAA", NEW, Folder.getGuid(), 570L,6, -1, 43L);
- // @formatter:on
+ verifyArts(arts);
sort(attributeCaptor.getAllValues());
Iterator<AttributeData> attrs = attributeCaptor.getAllValues().iterator();
// @formatter:off
- verifyData(attrs.next(), 9, 5, NEW, Name.getGuid(), 570L,5, -1, 5L, "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
- verifyData(attrs.next(), 10, 5, NEW, UriGeneralStringData.getGuid(), 570L,5, -1, 6L, "", "attr://6/AkA10I4aUSDLuFNIaegA.zip");
- verifyData(attrs.next(), 11, 5, NEW, Active.getGuid(), 570L,5, -1, 7L, "true", "");
-
- verifyData(attrs.next(), 12, 6, NEW, Name.getGuid(), 570L,5, -1, 8L, "org.eclipse.osee.coverage.OseeTypes_Coverage", "");
- verifyData(attrs.next(), 13, 6, NEW, UriGeneralStringData.getGuid(), 570L,5, -1, 9L, "", "attr://9/AkA10LiAPEZLR4+jdFQA.zip");
- verifyData(attrs.next(), 14, 6, NEW, Active.getGuid(), 570L,5, -1, 10L, "true", "");
- verifyData(attrs.next(), 17, 7, NEW, Name.getGuid(), 570L,6, -1, 33L, "User Groups", "");
+ verifyData(attrs.next(), 4, OseeTypesFrameworkId, NEW, Active.getId(), 570L,5, -1, 13L, "true", "");
+ verifyData(attrs.next(), 5, OseeTypesFrameworkId, NEW, Name.getId(), 570L,5, -1, 14L, "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
+ verifyData(attrs.next(), 6, OseeTypesFrameworkId, NEW, UriGeneralStringData.getId(), 570L,5, -1, 15L, "", "attr://15/"+OseeTypesFrameworkGuid+".zip");
+
+ verifyData(attrs.next(), 10, OseeTypesDemoId, NEW, Active.getId(), 570L,5, -1, 19L, "true", "");
+ verifyData(attrs.next(), 11, OseeTypesDemoId, NEW, Name.getId(), 570L,5, -1, 20L, "org.eclipse.osee.ats.client.demo.OseeTypes_Demo", "");
+ verifyData(attrs.next(), 12, OseeTypesDemoId, NEW, UriGeneralStringData.getId(), 570L,5, -1, 21L, "", "attr://21/"+OseeTypesDemoGuid+".zip");
+
+ verifyData(attrs.next(), 20, UserGroupsId, NEW, Name.getId(), 570L, 7, -1, 46L, "User Groups", "");
// @formatter:on
sort(relationCaptor.getAllValues());
Iterator<RelationData> rels = relationCaptor.getAllValues().iterator();
+ verifyRels(rels);
+ }
+
+ private void verifyRels(Iterator<RelationData> rels) {
+ verifyData(rels.next(), 1, UserGroupsId, 48656, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 7, -1,
+ 43L);
+ verifyData(rels.next(), 2, 197818, UserGroupsId, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 7, -1,
+ 39L);
+ verifyData(rels.next(), 3, UserGroupsId, 52247, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 7, -1,
+ 40L);
+ verifyData(rels.next(), 9, UserGroupsId, 8033605, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 10, -1,
+ 111L);
+ verifyData(rels.next(), 10, UserGroupsId, 136750, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 10, -1,
+ 109L);
+ verifyData(rels.next(), 11, UserGroupsId, 5367074, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 10, -1,
+ 110L);
+ }
+
+ private void verifyArts(Iterator<ArtifactData> arts) {
// @formatter:off
- verifyData(rels.next(), 1, 7, 8, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 53L);
- verifyData(rels.next(), 2, 1, 7, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 52L);
- verifyData(rels.next(), 3, 7, 15, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 54L);
+ verifyData(arts.next(), UserGroupsId, UserGroupsGuid, NEW, Folder.getId(), 570L, 7, -1, 71L);
+ verifyData(arts.next(), OseeTypesDemoId, OseeTypesDemoGuid, NEW, OseeTypeDefinition.getId(), 570L, 5, -1, 10L);
+ verifyData(arts.next(), OseeTypesFrameworkId, OseeTypesFrameworkGuid, NEW, OseeTypeDefinition.getId(), 570L, 5, -1, 8L);
// @formatter:on
}
@org.junit.Test
public void testLoadByTypes() throws OseeCoreException {
- DataLoader loader = loaderFactory.newDataLoaderFromIds(session, COMMON_ID, 5, 6, 7);
+ DataLoader loader =
+ loaderFactory.newDataLoaderFromIds(session, COMMON_ID, OseeTypesFrameworkId, OseeTypesDemoId, UserGroupsId);
loader.withLoadLevel(LoadLevel.ALL);
loader.withAttributeTypes(Name);
@@ -170,42 +199,35 @@ public class LoaderTest {
verify(builder, times(3)).onData(artifactCaptor.capture());
verify(builder, times(3)).onData(attributeCaptor.capture());
- verify(builder, times(3)).onData(relationCaptor.capture());
+ verify(builder, times(6)).onData(relationCaptor.capture());
sort(artifactCaptor.getAllValues());
Iterator<ArtifactData> arts = artifactCaptor.getAllValues().iterator();
- // @formatter:off
- verifyData(arts.next(), 5, "AkA10I4aUSDLuFNIaegA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 15L);
- verifyData(arts.next(), 6, "AkA10LiAPEZLR4+jdFQA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 16L);
- verifyData(arts.next(), 7, "AkA2AcT6AXe6ivMFRhAA", NEW, Folder.getGuid(), 570L,6, -1, 43L);
- // @formatter:on
+ verifyArts(arts);
sort(attributeCaptor.getAllValues());
Iterator<AttributeData> attrs = attributeCaptor.getAllValues().iterator();
// @formatter:off
- verifyData(attrs.next(), 9, 5, NEW, Name.getGuid(), 570L,5, -1, 5L, "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
- verifyData(attrs.next(), 12, 6, NEW, Name.getGuid(), 570L,5, -1, 8L, "org.eclipse.osee.coverage.OseeTypes_Coverage", "");
- verifyData(attrs.next(), 17, 7, NEW, Name.getGuid(), 570L,6, -1, 33L, "User Groups", "");
+ verifyData(attrs.next(), 5, OseeTypesFrameworkId, NEW, Name.getId(), 570L,5, -1, 14L, "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
+ verifyData(attrs.next(), 11, OseeTypesDemoId, NEW, Name.getId(), 570L,5, -1, 20L, "org.eclipse.osee.ats.client.demo.OseeTypes_Demo", "");
+ verifyData(attrs.next(), 20, UserGroupsId, NEW, Name.getId(), 570L, 7, -1, 46L, "User Groups", "");
// @formatter:on
sort(relationCaptor.getAllValues());
Iterator<RelationData> rels = relationCaptor.getAllValues().iterator();
- // @formatter:off
- verifyData(rels.next(), 1, 7, 8, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 53L);
- verifyData(rels.next(), 2, 1, 7, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 52L);
- verifyData(rels.next(), 3, 7, 15, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 54L);
- // @formatter:on
+ verifyRels(rels);
}
@org.junit.Test
public void testLoadByIds() throws OseeCoreException {
- DataLoader loader = loaderFactory.newDataLoaderFromIds(session, COMMON_ID, 5, 6, 7);
+ DataLoader loader =
+ loaderFactory.newDataLoaderFromIds(session, COMMON_ID, OseeTypesFrameworkId, OseeTypesDemoId, UserGroupsId);
loader.withLoadLevel(LoadLevel.ALL);
- loader.withAttributeIds(11, 14);
+ loader.withAttributeIds(4, 10);
loader.withRelationIds(2, 3);
loader.load(cancellation, builder);
@@ -224,78 +246,32 @@ public class LoaderTest {
sort(artifactCaptor.getAllValues());
Iterator<ArtifactData> arts = artifactCaptor.getAllValues().iterator();
- // @formatter:off
- verifyData(arts.next(), 5, "AkA10I4aUSDLuFNIaegA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 15L);
- verifyData(arts.next(), 6, "AkA10LiAPEZLR4+jdFQA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 16L);
- verifyData(arts.next(), 7, "AkA2AcT6AXe6ivMFRhAA", NEW, Folder.getGuid(), 570L,6, -1, 43L);
- // @formatter:on
+ verifyArts(arts);
sort(attributeCaptor.getAllValues());
Iterator<AttributeData> attrs = attributeCaptor.getAllValues().iterator();
// @formatter:off
- verifyData(attrs.next(), 11, 5, NEW, Active.getGuid(), 570L,5, -1, 7L, "true", "");
- verifyData(attrs.next(), 14, 6, NEW, Active.getGuid(), 570L,5, -1, 10L, "true", "");
+ verifyData(attrs.next(), 4, OseeTypesFrameworkId, NEW, Active.getId(), 570L,5, -1, 13L, "true", "");
+ verifyData(attrs.next(), 10, OseeTypesDemoId, NEW, Active.getId(), 570L,5, -1, 19L, "true", "");
// @formatter:on
sort(relationCaptor.getAllValues());
Iterator<RelationData> rels = relationCaptor.getAllValues().iterator();
// @formatter:off
- verifyData(rels.next(), 2, 1, 7, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 52L);
- verifyData(rels.next(), 3, 7, 15, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 54L);
+ verifyData(rels.next(), 2, 197818, UserGroupsId, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 7, -1,
+ 39L);
+ verifyData(rels.next(), 3, UserGroupsId, 52247, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L, 7, -1,
+ 40L);
// @formatter:on
}
@org.junit.Test
public void testLoadByGuids() throws OseeCoreException {
- String[] ids = new String[] {"AkA10I4aUSDLuFNIaegA", "AkA10LiAPEZLR4+jdFQA", "AkA2AcT6AXe6ivMFRhAA"};
+ String[] ids = new String[] {OseeTypesFrameworkGuid, OseeTypesDemoGuid, UserGroupsGuid};
DataLoader loader = loaderFactory.newDataLoaderFromGuids(session, COMMON_ID, ids);
loader.withLoadLevel(LoadLevel.ALL);
-
- loader.load(cancellation, builder);
-
- verify(builder).onLoadStart();
- verify(builder).onLoadDescription(descriptorCaptor.capture());
- verify(builder).onLoadEnd();
-
- LoadDescription descriptor = descriptorCaptor.getValue();
- assertEquals(COMMON_ID, descriptor.getBranchId());
-
- verify(builder, times(3)).onData(artifactCaptor.capture());
- verify(builder, times(7)).onData(attributeCaptor.capture());
- verify(builder, times(3)).onData(relationCaptor.capture());
-
- sort(artifactCaptor.getAllValues());
- Iterator<ArtifactData> arts = artifactCaptor.getAllValues().iterator();
-
- // @formatter:off
- verifyData(arts.next(), 5, "AkA10I4aUSDLuFNIaegA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 15L);
- verifyData(arts.next(), 6, "AkA10LiAPEZLR4+jdFQA", NEW, OseeTypeDefinition.getGuid(), 570L,5, -1, 16L);
- verifyData(arts.next(), 7, "AkA2AcT6AXe6ivMFRhAA", NEW, Folder.getGuid(), 570L,6, -1, 43L);
- // @formatter:on
-
- sort(attributeCaptor.getAllValues());
- Iterator<AttributeData> attrs = attributeCaptor.getAllValues().iterator();
-
- // @formatter:off
- verifyData(attrs.next(), 9, 5, NEW, Name.getGuid(), 570L,5, -1, 5L, "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "");
- verifyData(attrs.next(), 10, 5, NEW, UriGeneralStringData.getGuid(), 570L,5, -1, 6L, "", "attr://6/AkA10I4aUSDLuFNIaegA.zip");
- verifyData(attrs.next(), 11, 5, NEW, Active.getGuid(), 570L,5, -1, 7L, "true", "");
-
- verifyData(attrs.next(), 12, 6, NEW, Name.getGuid(), 570L,5, -1, 8L, "org.eclipse.osee.coverage.OseeTypes_Coverage", "");
- verifyData(attrs.next(), 13, 6, NEW, UriGeneralStringData.getGuid(), 570L,5, -1, 9L, "", "attr://9/AkA10LiAPEZLR4+jdFQA.zip");
- verifyData(attrs.next(), 14, 6, NEW, Active.getGuid(), 570L,5, -1, 10L, "true", "");
- verifyData(attrs.next(), 17, 7, NEW, Name.getGuid(), 570L,6, -1, 33L, "User Groups", "");
- // @formatter:on
-
- sort(relationCaptor.getAllValues());
- Iterator<RelationData> rels = relationCaptor.getAllValues().iterator();
-
- // @formatter:off
- verifyData(rels.next(), 1, 7, 8, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 53L);
- verifyData(rels.next(), 2, 1, 7, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 52L);
- verifyData(rels.next(), 3, 7, 15, "", NEW, Default_Hierarchical__Parent.getGuid(), 570L,6, -1, 54L);
- // @formatter:on
+ verifyArtsAttrAndRelData(loader);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java
index 69f525d4ad1..8cdfba35d09 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/callable/OrcsTypeLoaderCallable.java
@@ -10,15 +10,15 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.callable;
-import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON_ID;
+import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.util.Collection;
import java.util.LinkedHashSet;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.data.OrcsTypesData;
+import org.eclipse.osee.framework.core.enums.CoreTupleTypes;
import org.eclipse.osee.framework.core.enums.TxChange;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;
@@ -38,8 +38,13 @@ import org.eclipse.osee.orcs.OrcsSession;
*/
public class OrcsTypeLoaderCallable extends AbstractDatastoreCallable<IResource> {
+ /**
+ * e2 stores
+ */
private static final String LOAD_OSEE_TYPE_DEF_URIS =
- "select attr.uri from osee_branch br, osee_txs txs1, osee_artifact art, osee_attribute attr, osee_txs txs2 where br.branch_id = ? and txs1.branch_id = br.branch_id and txs1.tx_current = ? and txs1.gamma_id = art.gamma_id and txs2.branch_id = br.branch_id and txs2.tx_current = ? and txs2.gamma_id = attr.gamma_id and art.art_type_id = ? and art.art_id = attr.art_id and attr.attr_type_id = ?";
+ "select uri from osee_tuple2 t2, osee_txs txs1, osee_attribute attr, osee_txs txs2 where tuple_type = ? and " //
+ + "t2.gamma_id = txs1.gamma_id and txs1.branch_id = ? and txs1.tx_current = ? and e1 = ? and e2 = attr.attr_id and " //
+ + "attr.gamma_id = txs2.gamma_id and txs2.branch_id = txs1.branch_id and txs2.tx_current = ?";
private final IResourceManager resourceManager;
@@ -61,15 +66,13 @@ public class OrcsTypeLoaderCallable extends AbstractDatastoreCallable<IResource>
private Collection<String> findOseeTypeData() throws OseeCoreException {
Collection<String> paths = new LinkedHashSet<>();
- Long artifactTypeId = CoreArtifactTypes.OseeTypeDefinition.getGuid();
- Long attributeTypeId = CoreAttributeTypes.UriGeneralStringData.getGuid();
-
JdbcStatement chStmt = null;
try {
chStmt = getJdbcClient().getStatement();
- chStmt.runPreparedQuery(LOAD_OSEE_TYPE_DEF_URIS, COMMON_ID, TxChange.CURRENT.getValue(),
- TxChange.CURRENT.getValue(), artifactTypeId, attributeTypeId);
+ chStmt.runPreparedQuery(LOAD_OSEE_TYPE_DEF_URIS, CoreTupleTypes.OseeTypeDef, COMMON,
+ TxChange.CURRENT.getValue(), OrcsTypesData.OSEE_TYPE_VERSION, TxChange.CURRENT.getValue());
+
while (chStmt.next()) {
String uri = chStmt.getString("uri");
paths.add(uri);
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
index 12630b822f1..2f6e2c655aa 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/OseeClient.java
@@ -55,4 +55,9 @@ public interface OseeClient {
OrcsWriterEndpoint getOrcsWriterEndpoint();
ApplicabilityEndpoint getApplicabilityEndpoint(BranchId branch);
+
+ boolean isLocalHost();
+
+ String getBaseUri();
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
index 575c90861ad..daa0d728436 100644
--- a/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest.client/src/org/eclipse/osee/orcs/rest/client/internal/OseeClientImpl.java
@@ -207,4 +207,15 @@ public class OseeClientImpl implements OseeClient, QueryExecutor {
URI uri = UriBuilder.fromUri(baseUri).path("branch/{branch}").build(branch.getId());
return client.targetProxy(uri, ApplicabilityEndpoint.class);
}
+
+ @Override
+ public boolean isLocalHost() {
+ return baseUri.toString().contains("localhost");
+ }
+
+ @Override
+ public String getBaseUri() {
+ return baseUri.toString();
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TypesEndpoint.java b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TypesEndpoint.java
index ec12f074ae6..7c2694ba138 100644
--- a/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TypesEndpoint.java
+++ b/plugins/org.eclipse.osee.orcs.rest.model/src/org/eclipse/osee/orcs/rest/model/TypesEndpoint.java
@@ -19,6 +19,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.eclipse.osee.framework.core.data.OrcsTypesData;
/**
* @author Roberto E. Escobar
@@ -53,4 +54,16 @@ public interface TypesEndpoint {
@POST
@Path("invalidate-caches")
Response invalidateCaches();
+
+ @POST
+ @Path("import-types")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.TEXT_PLAIN)
+ Response importOrcsTypes(OrcsTypesData typesData);
+
+ @POST
+ @Path("dbinit")
+ @Produces(MediaType.TEXT_PLAIN)
+ Response dbInit();
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF
index 6d43b7ce874..f2bd98f4c74 100644
--- a/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.rest/META-INF/MANIFEST.MF
@@ -46,7 +46,8 @@ Import-Package: com.google.common.base;version="15.0.0",
org.eclipse.osee.orcs.utility,
org.eclipse.osee.orcs.writer,
org.eclipse.osee.orcs.writer.model.config,
- org.eclipse.osee.orcs.writer.model.reader
+ org.eclipse.osee.orcs.writer.model.reader,
+ org.osgi.service.event;version="1.3.1"
Osee-JaxRs-Resource: OSEE-INF/web/script/*;path=/orcs/script/ui,
OSEE-INF/web/example/*;path=/orcs/example/ui,
OSEE-INF/web/writer/*;path=/orcs/writer/ui
diff --git a/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.application.xml b/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.application.xml
index 988c454d3ba..4067d682184 100644
--- a/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.application.xml
+++ b/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/orcs.application.xml
@@ -8,4 +8,5 @@
<reference bind="setResourceManager" cardinality="1..1" interface="org.eclipse.osee.framework.resource.management.IResourceManager" name="IResourceManager" policy="static"/>
<reference bind="setActivityLog" cardinality="1..1" interface="org.eclipse.osee.activity.api.ActivityLog" name="ActivityLog" policy="static"/>
<reference bind="setJdbcService" cardinality="1..1" interface="org.eclipse.osee.jdbc.JdbcService" name="JdbcService" policy="static"/>
+ <reference bind="setEventAdmin" cardinality="1..1" interface="org.osgi.service.event.EventAdmin" name="EventAdmin" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
index da7f3235381..710cc2852ee 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
@@ -22,6 +22,7 @@ import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.rest.admin.LinkUpdateResource;
import org.eclipse.osee.orcs.rest.internal.client.ClientResource;
import org.eclipse.osee.orcs.rest.internal.writer.OrcsWriterEndpointImpl;
+import org.osgi.service.event.EventAdmin;
/**
* Get application.wadl at this context to get rest documentation
@@ -38,6 +39,7 @@ public class OrcsApplication extends Application {
private IResourceManager resourceManager;
private ActivityLog activityLog;
private JdbcService jdbcService;
+ private EventAdmin eventAdmin;
public void setOrcsApi(OrcsApi orcsApi) {
OrcsApplication.orcsApi = orcsApi;
@@ -51,6 +53,10 @@ public class OrcsApplication extends Application {
this.activityLog = activityLog;
}
+ public void setEventAdmin(EventAdmin eventAdmin) {
+ this.eventAdmin = eventAdmin;
+ }
+
public void setResourceManager(IResourceManager resourceManager) {
this.resourceManager = resourceManager;
}
@@ -69,7 +75,7 @@ public class OrcsApplication extends Application {
resources.add(new BranchEndpointImpl(orcsApi, resourceManager, activityLog));
resources.add(new OrcsWriterEndpointImpl(orcsApi));
resources.add(new TransactionEndpointImpl(orcsApi));
- resources.add(new TypesEndpointImpl(orcsApi));
+ resources.add(new TypesEndpointImpl(orcsApi, eventAdmin));
resources.add(new IndexerEndpointImpl(orcsApi));
resources.add(new ResourcesEndpointImpl(resourceManager));
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java
index fc6a148c390..b215c0c4286 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TypesEndpointImpl.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.orcs.rest.internal;
+import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import static org.eclipse.osee.orcs.rest.internal.OrcsRestUtil.executeCallable;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -19,13 +20,22 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Callable;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.StreamingOutput;
+import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.OrcsTypeSheet;
+import org.eclipse.osee.framework.core.data.OrcsTypesData;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.core.enums.CoreTupleTypes;
+import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.jdk.core.util.HexUtil;
import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.framework.jdk.core.util.Strings;
@@ -33,12 +43,17 @@ import org.eclipse.osee.framework.resource.management.IResource;
import org.eclipse.osee.jaxrs.OseeWebApplicationException;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsTypes;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.data.AttributeTypes;
import org.eclipse.osee.orcs.data.EnumEntry;
import org.eclipse.osee.orcs.data.EnumType;
import org.eclipse.osee.orcs.data.JaxEnumAttribute;
import org.eclipse.osee.orcs.data.JaxEnumEntry;
+import org.eclipse.osee.orcs.data.OrcsTopicEvents;
import org.eclipse.osee.orcs.rest.model.TypesEndpoint;
+import org.eclipse.osee.orcs.transaction.TransactionBuilder;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventAdmin;
/**
* @author Roberto E. Escobar
@@ -46,9 +61,11 @@ import org.eclipse.osee.orcs.rest.model.TypesEndpoint;
public class TypesEndpointImpl implements TypesEndpoint {
private final OrcsApi orcsApi;
+ private final EventAdmin eventAdmin;
- public TypesEndpointImpl(OrcsApi orcsApi) {
+ public TypesEndpointImpl(OrcsApi orcsApi, EventAdmin eventAdmin) {
this.orcsApi = orcsApi;
+ this.eventAdmin = eventAdmin;
}
private OrcsTypes getOrcsTypes() {
@@ -191,4 +208,42 @@ public class TypesEndpointImpl implements TypesEndpoint {
JaxEnumAttribute jaxEnumAttribute = createJaxEnumAttribute(orcsApi.getOrcsTypes().getAttributeTypes(), attrType);
return Response.ok().entity(jaxEnumAttribute.getEntries()).build();
}
+
+ @Override
+ public Response importOrcsTypes(OrcsTypesData typesData) {
+ TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(COMMON.getId(), SystemUser.OseeSystem,
+ "Add Types to Common Branch");
+ for (OrcsTypeSheet sheet : typesData.getSheets()) {
+ String guid = GUID.create();
+ if (Strings.isValid(sheet.getGuid())) {
+ guid = sheet.getGuid();
+ }
+ Long id = Lib.generateArtifactIdAsInt();
+ if (Strings.isNumeric(sheet.getId())) {
+ id = Long.valueOf(sheet.getId());
+ }
+ ArtifactId artifact = tx.createArtifact(CoreArtifactTypes.OseeTypeDefinition, sheet.getName(), guid, id);
+ tx.setSoleAttributeValue(artifact, CoreAttributeTypes.Active, true);
+ tx.setSoleAttributeFromString(artifact, CoreAttributeTypes.UriGeneralStringData, sheet.getTypesSheet());
+ }
+ tx.commit();
+
+ tx = orcsApi.getTransactionFactory().createTransaction(COMMON.getId(), SystemUser.OseeSystem,
+ "Add OseeTypeDef Tuples to Common Branch");
+ for (ArtifactReadable artifact : orcsApi.getQueryFactory().fromBranch(COMMON).andIsOfType(
+ CoreArtifactTypes.OseeTypeDefinition).getResults()) {
+ tx.addTuple2(CoreTupleTypes.OseeTypeDef, OrcsTypesData.OSEE_TYPE_VERSION,
+ artifact.getAttributes(CoreAttributeTypes.UriGeneralStringData).iterator().next());
+ }
+ tx.commit();
+ return Response.ok().entity("Success").build();
+ }
+
+ @Override
+ public Response dbInit() {
+ Event event = new Event(OrcsTopicEvents.DBINIT_IMPORT_TYPES, (Map<String, ?>) null);
+ eventAdmin.postEvent(event);
+ return Response.ok().entity("Success").build();
+ }
+
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java
index d61b7b9aa40..202aabe273d 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsAttributeLoadingTest.java
@@ -16,9 +16,7 @@ import static org.eclipse.osee.orcs.OrcsIntegrationRule.integrationRule;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
@@ -27,6 +25,7 @@ import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.db.mock.OsgiService;
import org.eclipse.osee.orcs.search.QueryBuilder;
import org.eclipse.osee.orcs.search.QueryFactory;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -50,25 +49,16 @@ public class OrcsAttributeLoadingTest {
query = orcsApi.getQueryFactory();
}
+ @SuppressWarnings("unchecked")
@Test
public void testAttributeLoading() throws Exception {
- QueryBuilder builder = query.fromBranch(COMMON_ID).andUuids(Arrays.asList(6L, 7L, 8L));
- ResultSet<ArtifactReadable> resultSet = builder.getResults();
-
- assertEquals(3, resultSet.size());
- assertEquals(3, builder.getCount());
-
- Map<Integer, ArtifactReadable> lookup = createLookup(resultSet);
- lookup.get(6);
- ArtifactReadable art7 = lookup.get(7);
- ArtifactReadable art8 = lookup.get(8);
-
- //Test loading name attributes
- assertEquals(art7.getSoleAttributeAsString(CoreAttributeTypes.Name), "User Groups");
- assertEquals(art8.getSoleAttributeAsString(CoreAttributeTypes.Name), "Everyone");
+ ArtifactReadable art =
+ query.fromBranch(COMMON_ID).andIds(CoreArtifactTokens.Everyone).getResults().getExactlyOne();
+ Assert.assertNotNull(art);
+ assertEquals("Everyone", art.getSoleAttributeAsString(CoreAttributeTypes.Name));
//Test boolean attributes
- assertEquals(art8.getSoleAttributeAsString(CoreAttributeTypes.DefaultGroup), "true");
+ assertEquals(art.getSoleAttributeAsString(CoreAttributeTypes.DefaultGroup), "true");
}
@Test
@@ -84,11 +74,4 @@ public class OrcsAttributeLoadingTest {
assertEquals(resultSet.size(), builder.getCount());
}
- private Map<Integer, ArtifactReadable> createLookup(Iterable<ArtifactReadable> arts) {
- Map<Integer, ArtifactReadable> lookup = new HashMap<>();
- for (ArtifactReadable artifact : arts) {
- lookup.put(artifact.getLocalId(), artifact);
- }
- return lookup;
- }
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchQueryTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchQueryTest.java
index 01708d167b9..3f3d1c98686 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchQueryTest.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.orcs.api;
-import static org.eclipse.osee.framework.core.enums.BranchState.CREATED;
import static org.eclipse.osee.framework.core.enums.BranchState.MODIFIED;
import static org.eclipse.osee.framework.core.enums.BranchType.BASELINE;
import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
@@ -21,7 +20,10 @@ import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_2;
import static org.eclipse.osee.orcs.OrcsIntegrationRule.integrationRule;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.osee.framework.core.data.BranchId;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TokenFactory;
@@ -39,6 +41,7 @@ import org.eclipse.osee.orcs.data.BranchReadable;
import org.eclipse.osee.orcs.db.mock.OsgiService;
import org.eclipse.osee.orcs.search.BranchQuery;
import org.eclipse.osee.orcs.search.QueryFactory;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -71,22 +74,17 @@ public class OrcsBranchQueryTest {
BranchQuery query = factory.branchQuery();
ResultSet<BranchReadable> results = query.getResults();
- assertEquals(5, results.size());
- assertEquals(5, query.getCount());
+ assertEquals(8, results.size());
+ assertEquals(8, query.getCount());
- Iterator<BranchReadable> iterator = results.iterator();
- BranchReadable branch1 = iterator.next();
- BranchReadable branch2 = iterator.next();
- BranchReadable branch3 = iterator.next();
- BranchReadable branch4 = iterator.next();
- BranchReadable branch5 = iterator.next();
-
- // actual, IOseeBranch, BranchType, BranchState, isArchived, parentId, baseTx, sourceTx, assocArtId
- assertBranch(branch1, SYSTEM_ROOT, BranchType.SYSTEM_ROOT, MODIFIED, false, -1, 1, 1, -1);
- assertBranch(branch2, SAW_Bld_1, BASELINE, MODIFIED, false, 1, 15, 3, -1);
- assertBranch(branch3, CIS_Bld_1, BASELINE, MODIFIED, false, 1, 17, 3, -1);
- assertBranch(branch4, SAW_Bld_2, BASELINE, CREATED, false, 3, 23, 22, 9);
- assertBranch(branch5, COMMON, BASELINE, MODIFIED, false, 1, 4, 3, -1);
+ List<BranchReadable> list = results.getList();
+
+ // list, IOseeBranch, BranchType, BranchState, isArchived, parentId, baseTx, sourceTx, assocArtId
+ assertBranch(list, SYSTEM_ROOT, BranchType.SYSTEM_ROOT, MODIFIED, false, -1, -1);
+ assertBranch(list, SAW_Bld_1, BASELINE, MODIFIED, false, 1, -1);
+ assertBranch(list, CIS_Bld_1, BASELINE, MODIFIED, false, 1, -1);
+ assertBranch(list, SAW_Bld_2, BASELINE, MODIFIED, false, 3, 11);
+ assertBranch(list, COMMON, BASELINE, MODIFIED, false, 1, -1);
}
@Test
@@ -162,10 +160,9 @@ public class OrcsBranchQueryTest {
@Test
public void testGetByState() throws OseeCoreException {
BranchQuery query = factory.branchQuery();
- query.andStateIs(CREATED);
+ query.andStateIs(MODIFIED);
- assertEquals(SAW_Bld_2, query.getResults().getExactlyOne());
- assertEquals(1, query.getCount());
+ assertEquals(7, query.getCount());
}
@Test
@@ -173,26 +170,22 @@ public class OrcsBranchQueryTest {
BranchQuery query = factory.branchQuery();
query.andIsChildOf(SAW_Bld_1);
- assertEquals(SAW_Bld_2, query.getResults().getExactlyOne());
- assertEquals(1, query.getCount());
+ ResultSet<BranchReadable> children = query.getResults();
+ assertEquals(4, query.getCount());
+ assertEquals(SAW_Bld_2, children.iterator().next());
query = factory.branchQuery();
query.andIsChildOf(SYSTEM_ROOT);
ResultSet<BranchReadable> results = query.getResults();
- assertEquals(4, results.size());
- assertEquals(4, query.getCount());
+ assertEquals(7, results.size());
+ assertEquals(7, query.getCount());
- Iterator<BranchReadable> iterator = results.iterator();
- BranchReadable branch1 = iterator.next();
- BranchReadable branch2 = iterator.next();
- BranchReadable branch3 = iterator.next();
- BranchReadable branch4 = iterator.next();
+ List<BranchReadable> list = results.getList();
- assertEquals(SAW_Bld_1, branch1);
- assertEquals(CIS_Bld_1, branch2);
- assertEquals(SAW_Bld_2, branch3);
- assertEquals(COMMON, branch4);
+ for (IOseeBranch branch : Arrays.asList(SAW_Bld_1, CIS_Bld_1, SAW_Bld_2, COMMON)) {
+ assertTrue("Missing expected branch " + branch, list.contains(branch));
+ }
}
@Test
@@ -291,6 +284,7 @@ public class OrcsBranchQueryTest {
return getBranchOps().createWorkingBranch(uuid, author, parent, null).call();
}
+ @SuppressWarnings("unchecked")
private ArtifactReadable getSystemUser() throws OseeCoreException {
return factory.fromBranch(CoreBranches.COMMON).andIds(SystemUser.OseeSystem).getResults().getExactlyOne();
}
@@ -299,13 +293,19 @@ public class OrcsBranchQueryTest {
return orcsApi.getBranchOps();
}
- private static void assertBranch(BranchReadable actual, IOseeBranch token, BranchType type, BranchState state, boolean isArchived, int parent, int baseTx, int sourceTx, int assocArtId) {
- assertEquals(token, actual);
- assertBranch(actual, token.getName(), token.getGuid(), type, state, isArchived, parent, baseTx, sourceTx,
- assocArtId);
+ private static void assertBranch(List<BranchReadable> list, IOseeBranch token, BranchType type, BranchState state, boolean isArchived, int parent, int assocArtId) {
+ BranchReadable found = null;
+ for (BranchReadable branch : list) {
+ if (branch.getId().equals(token.getId())) {
+ found = branch;
+ break;
+ }
+ }
+ Assert.assertNotNull(found);
+ assertBranch(found, token.getName(), token.getGuid(), type, state, isArchived, parent, assocArtId);
}
- private static void assertBranch(BranchReadable actual, String name, Long localId, BranchType type, BranchState state, boolean isArchived, int parent, int baseTx, int sourceTx, int assocArtId) {
+ private static void assertBranch(BranchReadable actual, String name, Long localId, BranchType type, BranchState state, boolean isArchived, int parent, int assocArtId) {
assertEquals(name, actual.getName());
assertEquals(localId, actual.getUuid());
@@ -313,8 +313,6 @@ public class OrcsBranchQueryTest {
assertEquals(state, actual.getBranchState());
assertEquals(isArchived, actual.getArchiveState().isArchived());
assertEquals(parent, actual.getParentBranch());
- assertEquals(baseTx, actual.getBaseTransaction());
- assertEquals(sourceTx, actual.getSourceTransaction());
assertEquals(assocArtId, actual.getAssociatedArtifactId());
}
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java
index a1c57004ee9..67a71278d1f 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsBranchTest.java
@@ -75,8 +75,8 @@ public class OrcsBranchTest {
@Test
public void testCreateBranch() throws Exception {
- int SOURCE_TX_ID = 7; // Chosen starting transaction on Common Branch
- int CHANGED_TX_ID = 8; // Transaction containing tested change
+ int SOURCE_TX_ID = 8; // Chosen starting transaction on Common Branch
+ int CHANGED_TX_ID = 9; // Transaction containing tested change
// set up the initial branch
IOseeBranch branch = TokenFactory.createBranch("PriorBranch");
@@ -89,19 +89,19 @@ public class OrcsBranchTest {
assertNotNull(callable);
BranchReadable priorBranch = callable.call();
- // in the database, on the common branch, the users are all created in transaction 8
+ // in the database, on the common branch, the users are all created in transaction 9
// the common branch will have one user named Joe Smith
int coreResult = query.fromBranch(CoreBranches.COMMON).andNameEquals(ARTIFACT_NAME).getResults().size();
assertEquals(1, coreResult);
- // we copied the branch at transaction 7, so, on the copied branch there will not be any
+ // we copied the branch at transaction 8, so, on the copied branch there will not be any
// user Joe Smith
int priorResult = query.fromBranch(priorBranch).andNameEquals(ARTIFACT_NAME).getResults().size();
assertEquals(0, priorResult);
- // finally, we copy another branch at transaction id 8, this is the transaction that added the
+ // finally, we copy another branch at transaction id 9, this is the transaction that added the
// user Joe Smith, so if the code is correct, and the copy includes the final
// transaction, then this will produce the same result as the query of the common branch
// create the branch with the copied transaction
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
index 572e3e6f89f..41adbcc353c 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsQueryTest.java
@@ -19,6 +19,8 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.Ordering;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -29,6 +31,7 @@ import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TokenFactory;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
@@ -38,6 +41,7 @@ import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.type.Named;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
import org.eclipse.osee.orcs.OrcsApi;
import org.eclipse.osee.orcs.OrcsBranch;
import org.eclipse.osee.orcs.data.ArtifactReadable;
@@ -87,9 +91,9 @@ public class OrcsQueryTest {
@Test
public void testAllArtifactsFromBranch() throws OseeCoreException {
QueryBuilder builder = factory.fromBranch(COMMON_ID);
- assertEquals(26, builder.getCount());
+ assertEquals(252, builder.getCount());
- assertEquals(26, builder.getResults().size());
+ assertEquals(252, builder.getResults().size());
}
@Test
@@ -103,32 +107,32 @@ public class OrcsQueryTest {
public void testAttributeNotExists() {
QueryBuilder builder = factory.fromBranch(COMMON_ID);
builder.andNotExists(CoreAttributeTypes.Afha);
- assertEquals(26, builder.getCount());
+ assertTrue(builder.getCount() >= 252);
}
@Test
public void testQueryByIds() throws OseeCoreException {
- QueryBuilder builder = factory.fromBranch(COMMON_ID).andGuid("AkA2AmNuEDDL4VolM9AA");
+ QueryBuilder builder = factory.fromBranch(COMMON_ID).andGuid(CoreArtifactTokens.UserGroups.getGuid());
assertEquals(1, builder.getCount());
ArtifactReadable artifact = builder.getResults().getExactlyOne();
- assertEquals("AkA2AmNuEDDL4VolM9AA", artifact.getGuid());
+ assertEquals(CoreArtifactTokens.UserGroups.getGuid(), artifact.getGuid());
}
@Test
public void testQueryArtifactType() throws OseeCoreException {
QueryBuilder builder = factory.fromBranch(COMMON_ID).andIsOfType(CoreArtifactTypes.Folder);
- assertEquals(2, builder.getCount());
+ assertTrue(builder.getCount() >= 6);
ResultSet<ArtifactReadable> artifacts = builder.getResults();
- assertEquals(2, artifacts.size());
+ assertTrue(artifacts.size() >= 6);
checkContainsTypes(artifacts, CoreArtifactTypes.Folder);
- Iterator<ArtifactReadable> iterator = sort(artifacts);
- assertEquals("Document Templates", iterator.next().getName());
- assertEquals("User Groups", iterator.next().getName());
+ Collection<String> names = Lib.getNames(artifacts.getList());
+ assertTrue(names.contains("Document Templates"));
+ assertTrue(names.contains("User Groups"));
if (includeMatchLocationTests) {
ResultSet<Match<ArtifactReadable, AttributeReadable<?>>> matches = builder.getMatches();
@@ -164,21 +168,26 @@ public class OrcsQueryTest {
QueryBuilder builder = factory.fromBranch(COMMON_ID);
builder.andTypeEquals(CoreArtifactTypes.OseeTypeDefinition, CoreArtifactTypes.Folder);
- assertEquals(6, builder.getCount());
+ assertTrue(builder.getCount() >= 14);
ResultSet<ArtifactReadable> artifacts = builder.getResults();
- assertEquals(6, artifacts.size());
+ assertTrue(artifacts.size() >= 14);
checkContainsTypes(artifacts, CoreArtifactTypes.OseeTypeDefinition, CoreArtifactTypes.Folder);
- Iterator<ArtifactReadable> iterator = sort(artifacts);
- assertEquals("Document Templates", iterator.next().getName());
- assertEquals("User Groups", iterator.next().getName());
-
- assertEquals("org.eclipse.osee.client.demo.OseeTypes_ClientDemo", iterator.next().getName());
- assertEquals("org.eclipse.osee.coverage.OseeTypes_Coverage", iterator.next().getName());
- assertEquals("org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", iterator.next().getName());
- assertEquals("org.eclipse.osee.ote.define.OseeTypesOTE", iterator.next().getName());
+ Set<String> names = new HashSet<>();
+ for (ArtifactReadable art : artifacts) {
+ names.add(art.getName());
+ }
+ assertTrue("Missing \"Document Templates\"", names.contains("Document Templates"));
+ assertTrue("Missing \"User Groups\"", names.contains("User Groups"));
+
+ assertTrue("Missing \"org.eclipse.osee.client.demo.OseeTypes_ClientDemo\"",
+ names.contains("org.eclipse.osee.client.demo.OseeTypes_ClientDemo"));
+ assertTrue("Missing \"org.eclipse.osee.framework.skynet.core.OseeTypes_Framework\"",
+ names.contains("org.eclipse.osee.framework.skynet.core.OseeTypes_Framework"));
+ assertTrue("Missing \"org.eclipse.osee.ote.define.OseeTypesOTE\"",
+ names.contains("org.eclipse.osee.ote.define.OseeTypesOTE"));
}
@Test
@@ -243,38 +252,20 @@ public class OrcsQueryTest {
List<IAttributeType> attributeTypes = Arrays.asList(CoreAttributeTypes.ContentUrl, CoreAttributeTypes.Name);
builder.andNotExists(attributeTypes);
- assertEquals(26, builder.getCount());
+ assertTrue(builder.getCount() >= 252);
ResultSet<ArtifactReadable> artifacts = builder.getResults();
- assertEquals(26, artifacts.size());
+ assertTrue(artifacts.size() >= 252);
- Iterator<ArtifactReadable> iterator = sort(artifacts);
- assertEquals("Alex Kay", iterator.next().getName());
- assertEquals("Anonymous", iterator.next().getName());
- assertEquals("Boot Strap", iterator.next().getName());
- assertEquals("Default Hierarchy Root", iterator.next().getName());
- assertEquals("Document Templates", iterator.next().getName());
- assertEquals("Everyone", iterator.next().getName());
- assertEquals("Framework Access Model", iterator.next().getName());
- assertEquals("Global Preferences", iterator.next().getName());
- assertEquals("Inactive Steve", iterator.next().getName());
- assertEquals("Jason Michael", iterator.next().getName());
- assertEquals("Joe Smith", iterator.next().getName());
- assertEquals("Kay Jones", iterator.next().getName());
- assertEquals("OSEE System", iterator.next().getName());
- assertEquals("OseeAdmin", iterator.next().getName());
- assertEquals("PREVIEW_ALL", iterator.next().getName());
- assertEquals("PREVIEW_ALL_RECURSE", iterator.next().getName());
- assertEquals("Root Artifact", iterator.next().getName());
- assertEquals("UnAssigned", iterator.next().getName());
- assertEquals("User Groups", iterator.next().getName());
- assertEquals("Word Edit Template", iterator.next().getName());
- assertEquals("Word Edit Template", iterator.next().getName());
- assertEquals("XViewer Global Customization", iterator.next().getName());
-
- assertEquals("org.eclipse.osee.client.demo.OseeTypes_ClientDemo", iterator.next().getName());
- assertEquals("org.eclipse.osee.coverage.OseeTypes_Coverage", iterator.next().getName());
- assertEquals("org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", iterator.next().getName());
- assertEquals("org.eclipse.osee.ote.define.OseeTypesOTE", iterator.next().getName());
+ Collection<String> names = Lib.getNames(artifacts.getList());
+
+ for (String name : Arrays.asList("Alex Kay", "Anonymous", "Boot Strap", "Default Hierarchy Root",
+ "Document Templates", "Everyone", "Framework Access Model", "Global Preferences", "Inactive Steve",
+ "Jason Michael", "Joe Smith", "Kay Jones", "OSEE System", "OseeAdmin", "PREVIEW_ALL", "PREVIEW_ALL_RECURSE",
+ "Root Artifact", "UnAssigned", "User Groups", "Word Edit Template", "Word Edit Template",
+ "XViewer Global Customization", "org.eclipse.osee.client.demo.OseeTypes_ClientDemo",
+ "org.eclipse.osee.framework.skynet.core.OseeTypes_Framework", "org.eclipse.osee.ote.define.OseeTypesOTE")) {
+ assertTrue("Missing expected artifact named [" + name + "]", names.contains(name));
+ }
}
@Test
@@ -409,8 +400,8 @@ public class OrcsQueryTest {
@Test
public void testFollowRelationType1() throws Exception {
QueryBuilder builder = factory.fromBranch(SAW_Bld_1) //
- .andIsOfType(CoreArtifactTypes.RootArtifact)//
- .followRelation(CoreRelationTypes.Default_Hierarchical__Child);
+ .andIsOfType(CoreArtifactTypes.RootArtifact)//
+ .followRelation(CoreRelationTypes.Default_Hierarchical__Child);
ResultSet<ArtifactReadable> results = builder.getResults();
assertEquals(8, results.size());
@@ -429,9 +420,9 @@ public class OrcsQueryTest {
@Test
public void testFollowRelationType2() throws Exception {
QueryBuilder builder = factory.fromBranch(SAW_Bld_1) //
- .andIsOfType(CoreArtifactTypes.RootArtifact)//
- .followRelation(CoreRelationTypes.Default_Hierarchical__Child)//
- .andIsOfType(CoreArtifactTypes.Component);
+ .andIsOfType(CoreArtifactTypes.RootArtifact)//
+ .followRelation(CoreRelationTypes.Default_Hierarchical__Child)//
+ .andIsOfType(CoreArtifactTypes.Component);
ResultSet<ArtifactReadable> results = builder.getResults();
assertEquals(1, results.size());
@@ -442,9 +433,9 @@ public class OrcsQueryTest {
@Test
public void testFollowRelationType3() throws Exception {
QueryBuilder builder = factory.fromBranch(SAW_Bld_1) //
- .and(CoreAttributeTypes.Name, "collaboration", QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.CASE__IGNORE)//
- .followRelation(CoreRelationTypes.Default_Hierarchical__Child)//
- .and(CoreAttributeTypes.Name, "object", QueryOption.CONTAINS_MATCH_OPTIONS);
+ .and(CoreAttributeTypes.Name, "collaboration", QueryOption.TOKEN_MATCH_ORDER__ANY, QueryOption.CASE__IGNORE)//
+ .followRelation(CoreRelationTypes.Default_Hierarchical__Child)//
+ .and(CoreAttributeTypes.Name, "object", QueryOption.CONTAINS_MATCH_OPTIONS);
ResultSet<ArtifactReadable> results = builder.getResults();
assertEquals(1, results.size());
@@ -455,10 +446,10 @@ public class OrcsQueryTest {
@Test
public void testFollowRelationTypeHistorical() throws Exception {
QueryBuilder query = factory.fromBranch(SAW_Bld_2) //
- .andNameEquals("Robot API") //
- .andIsOfType(CoreArtifactTypes.SoftwareRequirement)//
- .followRelation(CoreRelationTypes.Default_Hierarchical__Child)//
- .and(CoreAttributeTypes.Name, "Robot", QueryOption.CONTAINS_MATCH_OPTIONS);
+ .andNameEquals("Robot API") //
+ .andIsOfType(CoreArtifactTypes.SoftwareRequirement)//
+ .followRelation(CoreRelationTypes.Default_Hierarchical__Child)//
+ .and(CoreAttributeTypes.Name, "Robot", QueryOption.CONTAINS_MATCH_OPTIONS);
ResultSet<ArtifactReadable> results = query.getResults();
assertEquals(2, results.size());
@@ -497,8 +488,8 @@ public class OrcsQueryTest {
public void testRelatedTo() {
// do a query on branch
ArtifactReadable robotApi = factory.fromBranch(SAW_Bld_2) //
- .andNameEquals("Robot API") //
- .andIsOfType(CoreArtifactTypes.SoftwareRequirement).getResults().getExactlyOne();
+ .andNameEquals("Robot API") //
+ .andIsOfType(CoreArtifactTypes.SoftwareRequirement).getResults().getExactlyOne();
// create a tx on branch
ArtifactReadable author =
@@ -509,7 +500,7 @@ public class OrcsQueryTest {
// do another query on branch
ArtifactReadable robotInt = factory.fromBranch(SAW_Bld_2) //
- .andNameEquals("Robot Interfaces").getResults().getExactlyOne();
+ .andNameEquals("Robot Interfaces").getResults().getExactlyOne();
// see if artifact from query 1 is related to artifact from query 2
Assert.assertTrue(robotApi.areRelated(CoreRelationTypes.Default_Hierarchical__Child, robotInt));
@@ -519,8 +510,8 @@ public class OrcsQueryTest {
public void testMultipleTxs() {
// do a query on branch
ArtifactReadable robotApi = factory.fromBranch(SAW_Bld_2) //
- .andNameEquals("Robot API") //
- .andIsOfType(CoreArtifactTypes.SoftwareRequirement).getResults().getExactlyOne();
+ .andNameEquals("Robot API") //
+ .andIsOfType(CoreArtifactTypes.SoftwareRequirement).getResults().getExactlyOne();
ArtifactReadable author =
factory.fromBranch(COMMON_ID).andIds(SystemUser.OseeSystem).getResults().getExactlyOne();
@@ -537,10 +528,10 @@ public class OrcsQueryTest {
tx2.commit();
factory.fromBranch(SAW_Bld_2) //
- .andNameEquals("Robot Interfaces").getResults().getExactlyOne();
+ .andNameEquals("Robot Interfaces").getResults().getExactlyOne();
ArtifactReadable folderArt = factory.fromBranch(SAW_Bld_2) //
- .andIds(folder).getResults().getExactlyOne();
+ .andIds(folder).getResults().getExactlyOne();
// robotApi should be related to folder
Assert.assertTrue(robotApi.areRelated(CoreRelationTypes.Default_Hierarchical__Child, folderArt));
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java
index e5a245e98da..9e416fa2d65 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsRelationLoadingTest.java
@@ -14,9 +14,10 @@ import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_1;
import static org.eclipse.osee.orcs.OrcsIntegrationRule.integrationRule;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
@@ -33,7 +34,7 @@ import org.junit.rules.TestRule;
/**
* Test Case for {@link OrcsApi}
- *
+ *
* @author Andrew M. Finkbeiner
*/
public class OrcsRelationLoadingTest {
@@ -51,17 +52,19 @@ public class OrcsRelationLoadingTest {
checkRelationsForSawBranch(orcsApi, queryFactory);
}
+ @SuppressWarnings("unchecked")
private void checkRelationsForCommonBranch(OrcsApi oseeApi, QueryFactory queryFactory) throws OseeCoreException {
- QueryBuilder builder = queryFactory.fromBranch(CoreBranches.COMMON).andUuids(Arrays.asList(6L, 7L, 8L));
- ResultSet<ArtifactReadable> resultSet = builder.getResults();
-
- assertEquals(3, resultSet.size());
- assertEquals(3, builder.getCount());
- Map<Integer, ArtifactReadable> lookup = createLookup(resultSet);
- ArtifactReadable art6 = lookup.get(6);
- ArtifactReadable art7 = lookup.get(7);
- ArtifactReadable art8 = lookup.get(8);
+ ArtifactReadable art6 =
+ queryFactory.fromBranch(CoreBranches.COMMON).andIsOfType(CoreArtifactTypes.OseeTypeDefinition).andNameEquals(
+ "org.eclipse.osee.ats.client.demo.OseeTypes_Demo").getResults().getAtMostOneOrNull();
+ assertNotNull(art6);
+ ArtifactReadable art7 = queryFactory.fromBranch(CoreBranches.COMMON).andIds(
+ CoreArtifactTokens.UserGroups).getResults().getAtMostOneOrNull();
+ assertNotNull(art7);
+ ArtifactReadable art8 = queryFactory.fromBranch(CoreBranches.COMMON).andIds(
+ CoreArtifactTokens.Everyone).getResults().getAtMostOneOrNull();
+ assertNotNull(art8);
//art 6 has no relations
assertEquals(0, art6.getExistingRelationTypes().size());
@@ -71,7 +74,7 @@ public class OrcsRelationLoadingTest {
// 3 219 7 15 54
// 2 219 1 7 52
assertEquals(1, art7.getExistingRelationTypes().size());
- assertEquals(2, art7.getRelated(CoreRelationTypes.Default_Hierarchical__Child).size());
+ assertEquals(5, art7.getRelated(CoreRelationTypes.Default_Hierarchical__Child).size());
assertEquals(1, art7.getRelated(CoreRelationTypes.Default_Hierarchical__Parent).size());
//art8 has
@@ -84,7 +87,7 @@ public class OrcsRelationLoadingTest {
// 1 219 7 8 53
assertEquals(2, art8.getExistingRelationTypes().size());
assertEquals(1, art8.getRelated(CoreRelationTypes.Default_Hierarchical__Parent).size());
- assertEquals(5, art8.getRelated(CoreRelationTypes.Users_User).size());
+ assertEquals(19, art8.getRelated(CoreRelationTypes.Users_User).size());
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsScriptTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsScriptTest.java
index 49c89c73bca..09365963b40 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsScriptTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsScriptTest.java
@@ -70,101 +70,159 @@ public class OrcsScriptTest {
add(data, "start from branch 570 collect branches {*}", //
"{\n" + //
- " 'script' : 'start from branch 570 collect branches {*};',\n" + //
- " 'results' : [ {\n" + //
- " 'branches' : [ {\n" + //
- " 'archived' : 'UNARCHIVED',\n" + //
- " 'assoc-id' : -1,\n" + //
- " 'baseline-tx-id' : 4,\n" + //
- " 'id' : 570,\n" + //
- " 'inherits-access-control' : 0,\n" + //
- " 'name' : 'Common',\n" + //
- " 'parent-id' : 1,\n" + //
- " 'parent-tx-id' : 3,\n" + //
- " 'state' : 'MODIFIED',\n" + //
- " 'type' : 'BASELINE'\n" + //
- " } ]\n" + //
- " } ]\n" + //
- "}");
+ " 'script' : 'start from branch 570 collect branches {*};',\n" + //
+ " 'results' : [ {\n" + //
+ " 'branches' : [ {\n" + //
+ " 'archived' : 'UNARCHIVED',\n" + //
+ " 'assoc-id' : -1,\n" + //
+ " 'baseline-tx-id' : 4,\n" + //
+ " 'id' : 570,\n" + //
+ " 'inherits-access-control' : 0,\n" + //
+ " 'name' : 'Common',\n" + //
+ " 'parent-id' : 1,\n" + //
+ " 'parent-tx-id' : 3,\n" + //
+ " 'state' : 'MODIFIED',\n" + //
+ " 'type' : 'BASELINE'\n" + //
+ " } ]\n" + //
+ " } ]\n" + //
+ "}");
add(data, "start from branch where state = modified collect branches {name};", //
"{\n" + //
- " 'script' : 'start from branch where state = modified collect branches {name};',\n" + //
- " 'results' : [ {\n" + //
- " 'branches' : [ {\n" + //
- " 'name' : 'System Root Branch'\n" + //
- " }, {\n" + //
- " 'name' : 'SAW_Bld_1'\n" + //
- " }, {\n" + //
- " 'name' : 'CIS_Bld_1'\n" + //
- " }, {\n" + //
- " 'name' : 'Common'\n" + //
- " } ]\n" + //
- " } ]\n" + //
- "}");
+ " 'script' : 'start from branch where state = modified collect branches {name};',\n" + //
+ " 'results' : [ {\n" + //
+ " 'branches' : [ {\n" + //
+ " 'name' : 'System Root Branch'\n" + //
+ " }, {\n" + //
+ " 'name' : 'SAW_Bld_1'\n" + //
+ " }, {\n" + //
+ " 'name' : 'CIS_Bld_1'\n" + //
+ " }, {\n" + //
+ " 'name' : 'SAW_Bld_2'\n" + //
+ " }, {\n" + //
+ " 'name' : 'Common'\n" + //
+ " }, {\n" + //
+ " 'name' : 'ATS9 - SAW (uncommitted) More Reqt Changes for...'\n" + //
+ " }, {\n" + //
+ " 'name' : 'ATS20 - SAW (uncommitted-conflicted) More Requi...'\n" + //
+ " } ]\n" + //
+ " } ]\n" + //
+ "}");
add(data,
"start from branch 570 find artifacts where art-type = 'Folder' collect artifacts {id, attributes { value } };", //
"{\n" + //
- " 'script' : 'start from branch 570 find artifacts where art-type = 'Folder' collect artifacts {id, attributes { value } };',\n" + //
- " 'results' : [ {\n" + //
- " 'artifacts' : [ {\n" + //
- " 'id' : 7,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'User Groups'\n" + //
- " }\n" + //
- " }\n" + //
- " }, {\n" + //
- " 'id' : 22,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'Document Templates'\n" + //
- " }\n" + //
- " }\n" + //
- " } ]\n" + //
- " } ]\n" + //
- "}");
+ " 'script' : 'start from branch 570 find artifacts where art-type = 'Folder' collect artifacts {id, attributes { value } };',\n" + //
+ " 'results' : [ {\n" + //
+ " 'artifacts' : [ {\n" + //
+ " 'id' : 80920,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'User Groups'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 113036,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Config'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 114713,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Action Tracking System'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 200005,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Document Templates'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 284655,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Work Definitions'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 6915493,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Agile'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 7968155,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Countries'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 545949432,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Sprints'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " }, {\n" + //
+ " 'id' : 849027577,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Feature Groups'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " } ]\n" + //
+ " } ]\n" + //
+ "}");
add(data,
"start from branch 'SAW_Bld_1' find artifacts where attribute type = 'Name' match-order 'Read-only Robots' collect artifacts as 'Requirement' { id, attributes { value } };", //
"{\n" + //
- " 'script' : 'start from branch 'SAW_Bld_1' find artifacts where attribute type = 'Name' match-order 'Read-only Robots' collect artifacts as 'Requirement' { id, attributes { value } };',\n" + //
- " 'results' : [ {\n" + //
- " 'Requirement' : [ {\n" + //
- " 'id' : 81,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'Read-only Robots'\n" + //
- " },\n" + //
- " 'Word Template Content' : {\n" + //
- " 'value' : '<w:p wsp:rsidR=\\'006A3C0C\\' wsp:rsidRDefault=\\'006A3C0C\\' wsp:rsidP=\\'00E54E52\\'><w:r wsp:rsidRPr=\\'00EB2959\\'><w:t>Individual and collaborative robots can be “read-only” (i.e., provide only state information) or “read-write” (i.e., provide state inform</w:t></w:r><w:r><w:t>ation and allow state changes).</w:t></w:r></w:p>'\n" + //
- " },\n" + //
- " 'Paragraph Number' : {\n" + //
- " 'value' : '1.1.4'\n" + //
- " },\n" + //
- " 'Partition' : {\n" + //
- " 'value' : 'Unspecified'\n" + //
- " },\n" + //
- " 'Subsystem' : {\n" + //
- " 'value' : 'Unspecified'\n" + //
- " },\n" + //
- " 'Qualification Method' : {\n" + //
- " 'value' : 'Unspecified'\n" + //
- " },\n" + //
- " 'Development Assurance Level' : {\n" + //
- " 'value' : 'E'\n" + //
- " },\n" + //
- " 'Technical Performance Parameter' : {\n" + //
- " 'value' : 'false'\n" + //
- " },\n" + //
- " 'CSCI' : {\n" + //
- " 'value' : 'Unspecified'\n" + //
- " }\n" + //
- " }\n" + //
- " } ]\n" + //
- " } ]\n" + //
- "}");
+ " 'script' : 'start from branch 'SAW_Bld_1' find artifacts where attribute type = 'Name' match-order 'Read-only Robots' collect artifacts as 'Requirement' { id, attributes { value } };',\n" + //
+ " 'results' : [ {\n" + //
+ " 'Requirement' : [ {\n" + //
+ " 'id' : 200077,\n" + //
+ " 'attributes' : {\n" + //
+ " 'Name' : {\n" + //
+ " 'value' : 'Read-only Robots'\n" + //
+ " },\n" + //
+ " 'Word Template Content' : {\n" + //
+ " 'value' : '<w:p wsp:rsidR=\\'006A3C0C\\' wsp:rsidRDefault=\\'006A3C0C\\' wsp:rsidP=\\'00E54E52\\'><w:r wsp:rsidRPr=\\'00EB2959\\'><w:t>Individual and collaborative robots can be “read-only” (i.e., provide only state information) or “read-write” (i.e., provide state inform</w:t></w:r><w:r><w:t>ation and allow state changes).</w:t></w:r></w:p>'\n" + //
+ " },\n" + //
+ " 'Paragraph Number' : {\n" + //
+ " 'value' : '1.1.4'\n" + //
+ " },\n" + //
+ " 'Partition' : {\n" + //
+ " 'value' : 'Unspecified'\n" + //
+ " },\n" + //
+ " 'Subsystem' : {\n" + //
+ " 'value' : 'Unspecified'\n" + //
+ " },\n" + //
+ " 'Qualification Method' : {\n" + //
+ " 'value' : 'Unspecified'\n" + //
+ " },\n" + //
+ " 'Technical Performance Parameter' : {\n" + //
+ " 'value' : 'false'\n" + //
+ " },\n" + //
+ " 'CSCI' : {\n" + //
+ " 'value' : 'Unspecified'\n" + //
+ " },\n" + //
+ " 'Software Control Category' : {\n" + //
+ " 'value' : 'Unspecified'\n" + //
+ " },\n" + //
+ " 'IDAL' : {\n" + //
+ " 'value' : 'Unspecified'\n" + //
+ " }\n" + //
+ " }\n" + //
+ " } ]\n" + //
+ " } ]\n" + //
+ "}");
return data;
}
diff --git a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTxQueryTest.java b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTxQueryTest.java
index 8d67e86c65f..81e70af491b 100644
--- a/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTxQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.test/src/org/eclipse/osee/orcs/api/OrcsTxQueryTest.java
@@ -16,14 +16,18 @@ import static org.eclipse.osee.framework.core.enums.TransactionDetailsType.Basel
import static org.eclipse.osee.framework.core.enums.TransactionDetailsType.NonBaselined;
import static org.eclipse.osee.orcs.OrcsIntegrationRule.integrationRule;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.osee.framework.core.data.ArtifactId;
import org.eclipse.osee.framework.core.enums.CoreBranches;
+import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.core.enums.TransactionDetailsType;
import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
@@ -36,6 +40,7 @@ import org.eclipse.osee.orcs.search.Operator;
import org.eclipse.osee.orcs.search.QueryBuilder;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.search.TransactionQuery;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -58,6 +63,11 @@ public class OrcsTxQueryTest {
private final static DateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
private QueryFactory factory;
+ private final int OseeSystemId = SystemUser.OseeSystem.getId().intValue();
+ private final int JoeSmithId = 61106791;
+ private final int CommonBranchHeadTransaction = 117;
+ private final String CommonBranchTransComment = "Create new Agile Feature Group";
+ private final int NumberCommonTransactions = 77;
@Before
public void setup() {
@@ -69,36 +79,11 @@ public class OrcsTxQueryTest {
TransactionQuery query = factory.transactionQuery();
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(24, results.size());
- assertEquals(24, query.getCount());
+ assertEquals(CommonBranchHeadTransaction, results.size());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 2, NonBaselined, "2013-05-06 14:18:05.205", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 3, NonBaselined, "2013-05-06 14:18:05.393", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 5, NonBaselined, "2013-05-06 14:18:05.487", "Add Types to Common Branch", 570, 0, 0);
- assertTx(it.next(), 6, NonBaselined, "2013-05-06 14:18:06.454", "Add Common Branch", 570, 0, 0);
- assertTx(it.next(), 7, NonBaselined, "2013-05-06 14:18:06.517", "Add Framework Access Model", 570, 0, 0);
- assertTx(it.next(), 8, NonBaselined, "2013-05-06 14:18:06.720", "Add Dev Users", 570, 0, 0);
- assertTx(it.next(), 9, NonBaselined, "2013-05-06 14:18:06.798", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 10, NonBaselined, "2013-05-06 14:18:06.860", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 11, NonBaselined, "2013-05-06 14:18:06.954", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 12, NonBaselined, "2013-05-06 14:18:07.032", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 13, NonBaselined, "2013-05-06 14:18:07.110", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 14, NonBaselined, "2013-05-06 14:18:07.204", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 16, NonBaselined, "2013-05-06 14:18:07.360", "AddSawBranch", 3, 0, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 18, NonBaselined, "2013-05-06 14:18:07.630", "AddCisBranch", 4, 0, 0);
- assertTx(it.next(), 19, NonBaselined, "2013-05-06 14:18:07.911", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 20, NonBaselined, "2013-05-06 14:18:08.775", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
- //@formatter:on
+ List<TransactionReadable> transactions = results.getList();
+ assertTx(transactions, 4, Baselined, "Branch Creation for Common", 570, OseeSystemId, 0);
+ assertTx(transactions, 5, NonBaselined, "Add Types to Common Branch", 570, OseeSystemId, 0);
}
@Test
@@ -108,11 +93,10 @@ public class OrcsTxQueryTest {
ResultSet<TransactionReadable> results = query.getResults();
assertEquals(2, results.size());
- assertEquals(2, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- assertTx(it.next(), 3, NonBaselined, "2013-05-06 14:18:05.393", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
+ List<TransactionReadable> transactions = results.getList();
+ assertTxExists(transactions, 3);
+ assertTxExists(transactions, 23);
Iterator<Integer> ids = query.getResultsAsIds().iterator();
assertEquals(Integer.valueOf(3), ids.next());
@@ -122,13 +106,13 @@ public class OrcsTxQueryTest {
@Test
public void testGetByCommentEquals() throws OseeCoreException {
TransactionQuery query = factory.transactionQuery();
- query.andCommentEquals("ClientUser");
+ query.andCommentEquals("Branch Creation for SAW_Bld_1");
TransactionReadable actual = query.getResults().getExactlyOne();
assertEquals(1, query.getCount());
- assertTx(actual, 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
- assertEquals(Integer.valueOf(24), query.getResultsAsIds().getExactlyOne());
+ assertTx(Arrays.asList(actual), 26, Baselined, "Branch Creation for SAW_Bld_1", 3, OseeSystemId, 0);
+ assertEquals(Integer.valueOf(26), query.getResultsAsIds().getExactlyOne());
}
@Test
@@ -140,19 +124,6 @@ public class OrcsTxQueryTest {
assertEquals(4, results.size());
assertEquals(4, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- //@formatter:on
-
- Iterator<Integer> ids = query.getResultsAsIds().iterator();
- assertEquals(Integer.valueOf(4), ids.next());
- assertEquals(Integer.valueOf(15), ids.next());
- assertEquals(Integer.valueOf(17), ids.next());
- assertEquals(Integer.valueOf(23), ids.next());
}
@Test
@@ -162,24 +133,15 @@ public class OrcsTxQueryTest {
query.andIs(Baselined);
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(5, results.size());
- assertEquals(5, query.getCount());
-
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- //@formatter:on
+ assertEquals(8, results.size());
+ assertEquals(8, query.getCount());
- Iterator<Integer> ids = query.getResultsAsIds().iterator();
- assertEquals(Integer.valueOf(1), ids.next());
- assertEquals(Integer.valueOf(4), ids.next());
- assertEquals(Integer.valueOf(15), ids.next());
- assertEquals(Integer.valueOf(17), ids.next());
- assertEquals(Integer.valueOf(23), ids.next());
+ List<TransactionReadable> transactions = results.getList();
+ assertTx(transactions, 1, Baselined, "System Root Branch Creation", 1, OseeSystemId, 0);
+ assertTx(transactions, 4, Baselined, "Branch Creation for Common", 570, OseeSystemId, 0);
+ assertTx(transactions, 26, Baselined, "Branch Creation for SAW_Bld_1", 3, OseeSystemId, 0);
+ assertTx(transactions, 28, Baselined, "Branch Creation for CIS_Bld_1", 4, OseeSystemId, 0);
+ assertTx(transactions, 66, Baselined, "Branch Creation for SAW_Bld_2", 5, JoeSmithId, 0);
}
@Test
@@ -188,20 +150,13 @@ public class OrcsTxQueryTest {
query.andBranchIds(5, 4);
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(3, results.size());
- assertEquals(3, query.getCount());
+ assertEquals(4, results.size());
+ assertEquals(4, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 18, NonBaselined, "2013-05-06 14:18:07.630", "AddCisBranch", 4, 0, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- //@formatter:on
+ List<TransactionReadable> transactions = results.getList();
+ assertTx(transactions, 28, Baselined, "Branch Creation for CIS_Bld_1", 4, OseeSystemId, 0);
+ assertTx(transactions, 66, Baselined, "Branch Creation for SAW_Bld_2", 5, JoeSmithId, 0);
- Iterator<Integer> ids = query.getResultsAsIds().iterator();
- assertEquals(Integer.valueOf(17), ids.next());
- assertEquals(Integer.valueOf(18), ids.next());
- assertEquals(Integer.valueOf(23), ids.next());
}
@Test
@@ -213,27 +168,18 @@ public class OrcsTxQueryTest {
assertEquals(8, results.size());
assertEquals(8, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
+ List<TransactionReadable> transactions = results.getList();
//@formatter:off
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 16, NonBaselined, "2013-05-06 14:18:07.360", "AddSawBranch", 3, 0, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 18, NonBaselined, "2013-05-06 14:18:07.630", "AddCisBranch", 4, 0, 0);
- assertTx(it.next(), 19, NonBaselined, "2013-05-06 14:18:07.911", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 20, NonBaselined, "2013-05-06 14:18:08.775", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0, 0);
+ assertTx(transactions, 26, Baselined, "Branch Creation for SAW_Bld_1", 3, OseeSystemId, 0);
+ assertTx(transactions, 27, NonBaselined, "DemoDatabaseConfig", 3, OseeSystemId, 0);
+ assertTx(transactions, 28, Baselined, "Branch Creation for CIS_Bld_1", 4, OseeSystemId, 0);
+ assertTx(transactions, 29, NonBaselined, "DemoDatabaseConfig", 4,OseeSystemId, 0);
+ assertTx(transactions, 62, NonBaselined, "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, JoeSmithId, 0);
+ assertTx(transactions, 63, NonBaselined, "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, JoeSmithId, 0);
+ assertTx(transactions, 64, NonBaselined, "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, JoeSmithId, 0);
+ assertTx(transactions, 65, NonBaselined, "Populate Demo DB - Create Traceability", 3, JoeSmithId, 0);
//@formatter:on
- Iterator<Integer> ids = query.getResultsAsIds().iterator();
- assertEquals(Integer.valueOf(15), ids.next());
- assertEquals(Integer.valueOf(16), ids.next());
- assertEquals(Integer.valueOf(17), ids.next());
- assertEquals(Integer.valueOf(18), ids.next());
- assertEquals(Integer.valueOf(19), ids.next());
- assertEquals(Integer.valueOf(20), ids.next());
- assertEquals(Integer.valueOf(21), ids.next());
- assertEquals(Integer.valueOf(22), ids.next());
}
@Test
@@ -244,9 +190,9 @@ public class OrcsTxQueryTest {
assertEquals(2, results.size());
assertEquals(2, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 2, NonBaselined, "2013-05-06 14:18:05.205", "AddCommonBranchForClientDemo", 1, 0, 0);
+ List<TransactionReadable> transactions = results.getList();
+ assertTxExists(transactions, 1);
+ assertTxExists(transactions, 2);
query = factory.transactionQuery();
query.andTxId(Operator.LESS_THAN, 2);
@@ -254,8 +200,8 @@ public class OrcsTxQueryTest {
assertEquals(1, results.size());
assertEquals(1, query.getCount());
- it = results.iterator();
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
+ transactions = results.getList();
+ assertTxExists(transactions, 1);
}
@Test
@@ -263,28 +209,23 @@ public class OrcsTxQueryTest {
TransactionQuery query = factory.transactionQuery();
query.andTxId(Operator.GREATER_THAN_EQ, 21);
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(4, results.size());
- assertEquals(4, query.getCount());
+ assertEquals(CommonBranchHeadTransaction - 21 + 1, results.size());
- Iterator<TransactionReadable> it = results.iterator();
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163",
- "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0,
- 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
+ List<TransactionReadable> transactions = results.getList();
+ for (int x = 21; x <= CommonBranchHeadTransaction; x++) {
+ assertNotNull(getTransaction(transactions, x));
+ }
query = factory.transactionQuery();
query.andTxId(Operator.GREATER_THAN, 21);
results = query.getResults();
- assertEquals(3, results.size());
- assertEquals(3, query.getCount());
+ assertEquals(CommonBranchHeadTransaction - 21, results.size());
- it = results.iterator();
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0,
- 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
+ transactions = results.getList();
+ Assert.assertNull(getTransaction(transactions, 21));
+ for (int x = 22; x <= CommonBranchHeadTransaction; x++) {
+ assertNotNull(getTransaction(transactions, x));
+ }
}
@@ -292,46 +233,20 @@ public class OrcsTxQueryTest {
public void testGetEQIdOperators() throws OseeCoreException {
TransactionQuery query = factory.transactionQuery();
query.andTxId(Operator.EQUAL, 21);
+ query.andBranch(CoreBranches.COMMON);
ResultSet<TransactionReadable> results = query.getResults();
assertEquals(1, results.size());
- assertEquals(1, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163",
- "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
+ List<TransactionReadable> transactions = results.getList();
+ assertTxExists(transactions, 21);
query = factory.transactionQuery();
query.andTxId(Operator.NOT_EQUAL, 10);
+ query.andBranch(CoreBranches.COMMON);
results = query.getResults();
- assertEquals(23, results.size());
- assertEquals(23, query.getCount());
- it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 2, NonBaselined, "2013-05-06 14:18:05.205", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 3, NonBaselined, "2013-05-06 14:18:05.393", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 5, NonBaselined, "2013-05-06 14:18:05.487", "Add Types to Common Branch", 570, 0, 0);
- assertTx(it.next(), 6, NonBaselined, "2013-05-06 14:18:06.454", "Add Common Branch", 570, 0, 0);
- assertTx(it.next(), 7, NonBaselined, "2013-05-06 14:18:06.517", "Add Framework Access Model", 570, 0, 0);
- assertTx(it.next(), 8, NonBaselined, "2013-05-06 14:18:06.720", "Add Dev Users", 570, 0, 0);
- assertTx(it.next(), 9, NonBaselined, "2013-05-06 14:18:06.798", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 11, NonBaselined, "2013-05-06 14:18:06.954", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 12, NonBaselined, "2013-05-06 14:18:07.032", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 13, NonBaselined, "2013-05-06 14:18:07.110", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 14, NonBaselined, "2013-05-06 14:18:07.204", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 16, NonBaselined, "2013-05-06 14:18:07.360", "AddSawBranch", 3, 0, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 18, NonBaselined, "2013-05-06 14:18:07.630", "AddCisBranch", 4, 0, 0);
- assertTx(it.next(), 19, NonBaselined, "2013-05-06 14:18:07.911", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 20, NonBaselined, "2013-05-06 14:18:08.775", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
- //@formatter:on
+ transactions = results.getList();
+ assertEquals(NumberCommonTransactions - 1, results.size());
}
@Test
@@ -342,9 +257,8 @@ public class OrcsTxQueryTest {
assertEquals(1, results.size());
assertEquals(1, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0,
- 0);
+ List<TransactionReadable> transactions = results.getList();
+ assertTxExists(transactions, 22);
query = factory.transactionQuery();
query.andTxId(Operator.GREATER_THAN_EQ, 21, Operator.LESS_THAN_EQ, 23);
@@ -352,137 +266,85 @@ public class OrcsTxQueryTest {
assertEquals(3, results.size());
assertEquals(3, query.getCount());
- it = results.iterator();
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163",
- "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0,
- 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
+ transactions = results.getList();
+ assertTxExists(transactions, 21);
+ assertTxExists(transactions, 22);
+ assertTxExists(transactions, 23);
}
@Test
public void testGetDateOperator() throws Exception {
TransactionQuery query = factory.transactionQuery();
- Timestamp date = Timestamp.valueOf("2013-05-06 14:18:11.570");
+ query.andTxId(65);
+ Timestamp date = new Timestamp(query.getResults().getAtMostOneOrNull().getDate().getTime());
+
+ query = factory.transactionQuery();
query.andDate(Operator.GREATER_THAN, date);
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(2, results.size());
- assertEquals(2, query.getCount());
-
- Iterator<TransactionReadable> it = results.iterator();
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
+ assertEquals(CommonBranchHeadTransaction - 65, results.size());
query = factory.transactionQuery();
query.andDate(Operator.LESS_THAN, date);
results = query.getResults();
- assertEquals(22, results.size());
- assertEquals(22, query.getCount());
+ assertEquals(64, results.size());
- it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 2, NonBaselined, "2013-05-06 14:18:05.205", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 3, NonBaselined, "2013-05-06 14:18:05.393", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 5, NonBaselined, "2013-05-06 14:18:05.487", "Add Types to Common Branch", 570, 0, 0);
- assertTx(it.next(), 6, NonBaselined, "2013-05-06 14:18:06.454", "Add Common Branch", 570, 0, 0);
- assertTx(it.next(), 7, NonBaselined, "2013-05-06 14:18:06.517", "Add Framework Access Model", 570, 0, 0);
- assertTx(it.next(), 8, NonBaselined, "2013-05-06 14:18:06.720", "Add Dev Users", 570, 0, 0);
- assertTx(it.next(), 9, NonBaselined, "2013-05-06 14:18:06.798", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 10, NonBaselined, "2013-05-06 14:18:06.860", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 11, NonBaselined, "2013-05-06 14:18:06.954", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 12, NonBaselined, "2013-05-06 14:18:07.032", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 13, NonBaselined, "2013-05-06 14:18:07.110", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 14, NonBaselined, "2013-05-06 14:18:07.204", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 16, NonBaselined, "2013-05-06 14:18:07.360", "AddSawBranch", 3, 0, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 18, NonBaselined, "2013-05-06 14:18:07.630", "AddCisBranch", 4, 0, 0);
- assertTx(it.next(), 19, NonBaselined, "2013-05-06 14:18:07.911", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 20, NonBaselined, "2013-05-06 14:18:08.775", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0, 0);
- //@formatter:on
}
@Test
public void testGetDateRange() throws Exception {
TransactionQuery query = factory.transactionQuery();
- Timestamp date1 = Timestamp.valueOf("2013-05-06 14:18:07.110");
- Timestamp date2 = Timestamp.valueOf("2013-05-06 14:18:11.659");
+ query.andTxId(1);
+ Timestamp date1 = new Timestamp(query.getResults().getAtMostOneOrNull().getDate().getTime());
+
+ query = factory.transactionQuery();
+ query.andTxId(65);
+ Timestamp date2 = new Timestamp(query.getResults().getAtMostOneOrNull().getDate().getTime());
+
+ query = factory.transactionQuery();
query.andDate(date1, date2);
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(11, results.size());
- assertEquals(11, query.getCount());
-
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 13, NonBaselined, "2013-05-06 14:18:07.110", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 14, NonBaselined, "2013-05-06 14:18:07.204", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 16, NonBaselined, "2013-05-06 14:18:07.360", "AddSawBranch", 3, 0, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 18, NonBaselined, "2013-05-06 14:18:07.630", "AddCisBranch", 4, 0, 0);
- assertTx(it.next(), 19, NonBaselined, "2013-05-06 14:18:07.911", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 20, NonBaselined, "2013-05-06 14:18:08.775", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- //@formatter:on
+ assertEquals(65, results.size());
}
@Test
public void testGetAuthorId() throws Exception {
TransactionQuery query = factory.transactionQuery();
- query.andAuthorIds(-1);
+ query.andAuthorIds(OseeSystemId);
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(5, results.size());
- assertEquals(5, query.getCount());
+ assertEquals(72, results.size());
+ assertEquals(72, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- //@formatter:on
+ List<TransactionReadable> transactions = results.getList();
+ assertTx(transactions, 28, Baselined, "Branch Creation for CIS_Bld_1", 4, OseeSystemId, 0);
query = factory.transactionQuery();
- query.andAuthorIds(-1, 17);
+ query.andAuthorIds(OseeSystemId, JoeSmithId);
results = query.getResults();
- assertEquals(6, results.size());
- assertEquals(6, query.getCount());
+ assertEquals(117, results.size());
+ assertEquals(117, query.getCount());
- it = results.iterator();
+ transactions = results.getList();
//@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
+ assertTx(transactions, 28, Baselined, "Branch Creation for CIS_Bld_1", 4, OseeSystemId, 0);
+ assertTx(transactions, 62, NonBaselined, "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, JoeSmithId, 0);
+ assertTx(transactions, CommonBranchHeadTransaction, NonBaselined, CommonBranchTransComment, 570, OseeSystemId, 0);
//@formatter:on
query = factory.transactionQuery();
ArrayList<Integer> list = new ArrayList<>(2);
- list.add(-1);
- list.add(17);
+ list.add(OseeSystemId);
+ list.add(JoeSmithId);
query.andAuthorIds(list);
results = query.getResults();
- assertEquals(6, results.size());
- assertEquals(6, query.getCount());
+ assertEquals(117, results.size());
+ assertEquals(117, query.getCount());
- it = results.iterator();
+ transactions = results.getList();
//@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
+ assertTx(transactions, 28, Baselined, "Branch Creation for CIS_Bld_1", 4, OseeSystemId, 0);
+ assertTx(transactions, 62, NonBaselined, "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, JoeSmithId, 0);
+ assertTx(transactions, CommonBranchHeadTransaction, NonBaselined, CommonBranchTransComment, 570, OseeSystemId, 0);
//@formatter:on
}
@@ -492,39 +354,17 @@ public class OrcsTxQueryTest {
TransactionQuery query = factory.transactionQuery();
query.andNullCommitId();
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(24, query.getCount());
- assertEquals(24, results.size());
+ assertEquals(116, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 1, Baselined, "2013-05-06 14:18:02.530", "System Root Branch Creation", 1, -1, 0);
- assertTx(it.next(), 2, NonBaselined, "2013-05-06 14:18:05.205", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 3, NonBaselined, "2013-05-06 14:18:05.393", "AddCommonBranchForClientDemo", 1, 0, 0);
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 5, NonBaselined, "2013-05-06 14:18:05.487", "Add Types to Common Branch", 570, 0, 0);
- assertTx(it.next(), 6, NonBaselined, "2013-05-06 14:18:06.454", "Add Common Branch", 570, 0, 0);
- assertTx(it.next(), 7, NonBaselined, "2013-05-06 14:18:06.517", "Add Framework Access Model", 570, 0, 0);
- assertTx(it.next(), 8, NonBaselined, "2013-05-06 14:18:06.720", "Add Dev Users", 570, 0, 0);
- assertTx(it.next(), 9, NonBaselined, "2013-05-06 14:18:06.798", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 10, NonBaselined, "2013-05-06 14:18:06.860", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 11, NonBaselined, "2013-05-06 14:18:06.954", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 12, NonBaselined, "2013-05-06 14:18:07.032", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 13, NonBaselined, "2013-05-06 14:18:07.110", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 14, NonBaselined, "2013-05-06 14:18:07.204", "SimpleTemplateProviderTask", 570, 0, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 16, NonBaselined, "2013-05-06 14:18:07.360", "AddSawBranch", 3, 0, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 18, NonBaselined, "2013-05-06 14:18:07.630", "AddCisBranch", 4, 0, 0);
- assertTx(it.next(), 19, NonBaselined, "2013-05-06 14:18:07.911", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 20, NonBaselined, "2013-05-06 14:18:08.775", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 21, NonBaselined, "2013-05-06 14:18:10.163", "ArtifactImportOperationFactory: Artifact Import Wizard transaction", 3, 0, 0);
- assertTx(it.next(), 22, NonBaselined, "2013-05-06 14:18:11.564", "Populate Demo DB - Create Traceability", 3, 0, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
- //@formatter:on
+ List<TransactionReadable> transactions = results.getList();
+ assertTxExists(transactions, 1);
+ assertTxExists(transactions, 2);
+ assertTxExists(transactions, 3);
+ assertTxExists(transactions, 4);
+ assertTxExists(transactions, 5);
query = factory.transactionQuery();
- query.andCommitIds(-1, 1);
+ query.andCommitIds(OseeSystemId, 1);
results = query.getResults();
assertEquals(0, results.size());
assertEquals(0, query.getCount());
@@ -542,7 +382,7 @@ public class OrcsTxQueryTest {
* null not allowed in multiple argument case -- throws OseeArgumentException
*/
query = factory.transactionQuery();
- query.andCommitIds(null, -1, 1);
+ query.andCommitIds(null, OseeSystemId, 1);
results = query.getResults();
}
@@ -553,12 +393,9 @@ public class OrcsTxQueryTest {
query.andIsHead(1);
ResultSet<TransactionReadable> results = query.getResults();
assertEquals(1, query.getCount());
- assertEquals(1, results.size());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 3, NonBaselined, "2013-05-06 14:18:05.393", "AddCommonBranchForClientDemo", 1, 0, 0);
- //@formatter:on
+ List<TransactionReadable> transactions = results.getList();
+ assertTxExists(transactions, 3);
}
@Test
@@ -570,10 +407,8 @@ public class OrcsTxQueryTest {
assertEquals(1, query.getCount());
assertEquals(1, results.size());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
- //@formatter:on
+ List<TransactionReadable> transactions = results.getList();
+ assertTx(transactions, CommonBranchHeadTransaction, NonBaselined, CommonBranchTransComment, 570, OseeSystemId, 0);
}
@Test
@@ -581,82 +416,81 @@ public class OrcsTxQueryTest {
QueryFactory branchFactory = orcsApi.getQueryFactory();
QueryBuilder branchQuery = branchFactory.fromBranch(CoreBranches.COMMON);
/*********************************************************
- * Only valid user is 17
+ * Only valid user is Joe Smith
*/
- branchQuery.andUuids(Arrays.asList(17L));
+ branchQuery.andUuids(Arrays.asList(Long.valueOf(JoeSmithId)));
ResultSet<ArtifactReadable> userIds = branchQuery.getResults();
Iterator<ArtifactReadable> itUsers = userIds.iterator();
- ArtifactId user17 = itUsers.next();
+ ArtifactId joeArt = itUsers.next();
TransactionQuery query = factory.transactionQuery();
- query.andAuthorLocalIds(user17);
- ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(1, query.getCount());
- assertEquals(1, results.size());
-
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
- //@formatter:on
+ query.andAuthorLocalIds(joeArt);
+ assertEquals(45, query.getCount());
/**********************************************************
* Only valid user is 17. Verify the multiple entry by entering the same user twice
*/
query = factory.transactionQuery();
- query.andAuthorLocalIds(user17, user17);
- results = query.getResults();
- assertEquals(1, query.getCount());
- assertEquals(1, results.size());
+ query.andAuthorLocalIds(joeArt, joeArt);
+ assertEquals(45, query.getCount());
- it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 24, NonBaselined, "2013-05-06 14:18:18.542", "ClientUser", 570, 17, 0);
- //@formatter:on
}
@Test
public void testMultifield() throws Exception {
TransactionQuery query = factory.transactionQuery();
- query.andAuthorIds(-1);
+ query.andAuthorIds(OseeSystemId);
query.andIs(Baselined);
query.andCommentPattern("Branch Creation for.*");
ResultSet<TransactionReadable> results = query.getResults();
- assertEquals(4, results.size());
- assertEquals(4, query.getCount());
+ assertEquals(3, results.size());
+ assertEquals(3, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- //@formatter:off
- assertTx(it.next(), 4, Baselined, "2013-05-06 14:18:05.424", "Branch Creation for Common", 570, -1, 0);
- assertTx(it.next(), 15, Baselined, "2013-05-06 14:18:07.235", "Branch Creation for SAW_Bld_1", 3, -1, 0);
- assertTx(it.next(), 17, Baselined, "2013-05-06 14:18:07.516", "Branch Creation for CIS_Bld_1", 4, -1, 0);
- assertTx(it.next(), 23, Baselined, "2013-05-06 14:18:11.659", "Branch Creation for SAW_Bld_2", 5, -1, 0);
- //@formatter:on
+ for (TransactionReadable trans : query.getResults()) {
+ assertTrue(trans.getComment().startsWith("Branch Creation for"));
+ }
}
@Test
public void testGetPriorTx() throws OseeCoreException {
TransactionQuery query = factory.transactionQuery();
- query.andIsPriorTx(24);
+ query.andIsPriorTx(CommonBranchHeadTransaction);
ResultSet<TransactionReadable> results = query.getResults();
assertEquals(1, results.size());
assertEquals(1, query.getCount());
- Iterator<TransactionReadable> it = results.iterator();
- assertTx(it.next(), 14, NonBaselined, "2013-05-06 14:18:07.204", "SimpleTemplateProviderTask", 570, 0, 0);
+ List<TransactionReadable> transactions = results.getList();
+ assertTxExists(transactions, CommonBranchHeadTransaction - 1);
Iterator<Integer> ids = query.getResultsAsIds().iterator();
- assertEquals(Integer.valueOf(14), ids.next());
+ assertEquals(Integer.valueOf(CommonBranchHeadTransaction - 1), ids.next());
}
- private static void assertTx(TransactionReadable actual, Integer localId, TransactionDetailsType type, String date, String comment, long branchUuid, int authorId, int commitId) {
- assertEquals(localId, actual.getLocalId());
- assertEquals(type, actual.getTxType());
- assertEquals(date, DATE_FORMATTER.format(actual.getDate()));
- assertEquals(comment, actual.getComment());
+ private static void assertTx(List<TransactionReadable> transactions, Integer localId, TransactionDetailsType type, String comment, long branchUuid, int authorId, int commitId) {
+ TransactionReadable transaction = getTransaction(transactions, localId);
+ assertEquals(localId, transaction.getLocalId());
+ assertEquals(type, transaction.getTxType());
+ assertNotNull(DATE_FORMATTER.format(transaction.getDate()));
+ assertEquals(comment, transaction.getComment());
+
+ assertEquals(authorId, transaction.getAuthorId());
+ assertEquals((Long) branchUuid, transaction.getBranchId());
+ assertEquals(commitId, transaction.getCommit());
+ }
+
+ private void assertTxExists(List<TransactionReadable> transactions, int localId) {
+ assertTrue(getTransaction(transactions, localId) != null);
+ }
- assertEquals(authorId, actual.getAuthorId());
- assertEquals((Long) branchUuid, actual.getBranchId());
- assertEquals(commitId, actual.getCommit());
+ private static TransactionReadable getTransaction(List<TransactionReadable> transactions, Integer localId) {
+ TransactionReadable transaction = null;
+ for (TransactionReadable tx : transactions) {
+ if (tx.getLocalId().equals(localId)) {
+ transaction = tx;
+ break;
+ }
+ }
+ return transaction;
}
}
diff --git a/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/OrcsTopicEvents.java b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/OrcsTopicEvents.java
new file mode 100644
index 00000000000..9d890fb47ae
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs/src/org/eclipse/osee/orcs/data/OrcsTopicEvents.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2016 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.orcs.data;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class OrcsTopicEvents {
+
+ public static String DBINIT_IMPORT_TYPES = "orcs/dbinit/importTypes";
+
+ private OrcsTopicEvents() {
+ //
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF
index 52b32b5e040..a08ea4ab47b 100644
--- a/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Import-Package: javax.ws.rs.core;version="2.0.0",
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.jaxrs,
org.eclipse.osee.jaxrs.client,
org.eclipse.osee.orcs.rest.client,
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/README_BEFORE_RUNNING_TESTS.txt b/plugins/org.eclipse.osee.x.server.integration.tests/README_BEFORE_RUNNING_TESTS.txt
new file mode 100644
index 00000000000..f3108551ca7
--- /dev/null
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/README_BEFORE_RUNNING_TESTS.txt
@@ -0,0 +1,10 @@
+DO NOT RUN THIS SUITE AS JUNIT PLUGIN TEST (it will connect to Production DB)
+
+Integration test suite run with Application Server
+Data gets written to target directory from org.eclipse.osee.x.server.p2/demo via the pom.xml
+
+To run locally:
+1) unzip org.eclipse.osee.x.server.p2/demo/hsql.zip to your home dir
+2) unzip org.eclipse.osee.x.server.p2/demo/binary_data.zip to your home dir
+3) Launch local hsql application server
+4) Run Server Integration Test Suite as JUnit Test
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/AccountClientTest.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/AccountClientTest.java
index 43aeed08755..c338cb5254e 100644
--- a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/AccountClientTest.java
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/AccountClientTest.java
@@ -22,8 +22,10 @@ import org.eclipse.osee.account.rest.model.AccountDetailsData;
import org.eclipse.osee.account.rest.model.AccountInfoData;
import org.eclipse.osee.account.rest.model.AccountInput;
import org.eclipse.osee.account.rest.model.AccountPreferencesData;
+import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
import org.eclipse.osee.x.server.integration.tests.util.IntegrationUtil;
+import org.junit.After;
import org.junit.Before;
import org.junit.FixMethodOrder;
import org.junit.Rule;
@@ -52,9 +54,18 @@ public class AccountClientTest {
private String guid;
private Map<String, String> prefs;
+ @After
+ public void cleanUp() {
+ client = IntegrationUtil.createAccountClient();
+ client.deleteAccount(accountId);
+ }
+
@Before
public void setUp() {
client = IntegrationUtil.createAccountClient();
+ if (!client.isLocalHost()) {
+ throw new OseeStateException("This test should be run with local test server, not %s", client.getBaseUri());
+ }
String methodName = testName.getMethodName();
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java
index c352fda29b7..1cb0b420970 100644
--- a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java
+++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java
@@ -21,14 +21,17 @@ import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON;
import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_1;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.io.StringWriter;
import java.util.Collection;
import java.util.Properties;
import javax.ws.rs.core.MediaType;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTokens;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
import org.eclipse.osee.framework.core.enums.QueryOption;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
import org.eclipse.osee.orcs.rest.client.OseeClient;
import org.eclipse.osee.orcs.rest.model.IdeClientEndpoint;
import org.eclipse.osee.orcs.rest.model.IdeVersion;
@@ -48,6 +51,10 @@ public class OseeClientQueryTest {
@BeforeClass
public static void testSetup() throws OseeCoreException {
createClient = IntegrationUtil.createClient();
+ if (!createClient.isLocalHost()) {
+ throw new OseeStateException("This test should be run with local test server, not %s",
+ createClient.getBaseUri());
+ }
// Establish initial connection to the db using this random query
createClient.createQueryBuilder(COMMON).andIds(SystemUser.OseeSystem).getSearchResult(RequestType.IDS);
@@ -88,14 +95,17 @@ public class OseeClientQueryTest {
@Test
public void searchForArtifactByLocalId() throws OseeCoreException {
final int EXPECTED_RESULTS = 1;
- SearchResult results = createClient.createQueryBuilder(COMMON).andLocalId(9).getSearchResult(RequestType.IDS);
+ SearchResult results = createClient.createQueryBuilder(COMMON).andLocalId(
+ CoreArtifactTokens.UserGroups.getId().intValue()).getSearchResult(RequestType.IDS);
assertEquals(EXPECTED_RESULTS, results.getTotal());
}
@Test
public void searchForArtifactByLocalIds() throws OseeCoreException {
final int EXPECTED_RESULTS = 2;
- SearchResult results = createClient.createQueryBuilder(COMMON).andLocalId(19, 9).getSearchResult(RequestType.IDS);
+ SearchResult results =
+ createClient.createQueryBuilder(COMMON).andLocalId(CoreArtifactTokens.UserGroups.getId().intValue(),
+ CoreArtifactTokens.Everyone.getId().intValue()).getSearchResult(RequestType.IDS);
assertEquals(EXPECTED_RESULTS, results.getTotal());
}
@@ -109,7 +119,7 @@ public class OseeClientQueryTest {
@Test
public void searchForArtifactWithActionInName() throws OseeCoreException {
- final int EXPECTED_RESULTS = 43;
+ final int EXPECTED_RESULTS = 45;
SearchResult results = createClient.createQueryBuilder(COMMON).and(CoreAttributeTypes.Name, "SAW",
QueryOption.CASE__IGNORE, QueryOption.TOKEN_MATCH_ORDER__MATCH, QueryOption.TOKEN_DELIMITER__ANY,
QueryOption.TOKEN_COUNT__IGNORE).getSearchResult(RequestType.IDS);
@@ -172,60 +182,20 @@ public class OseeClientQueryTest {
assertEquals(true, !supportedVersions.isEmpty());
}
+ /**
+ * This test simply ensures that the client endpoint to run Orcs Script works. OrcsScriptTest is the more exhaustive
+ * test of Orcs Script.
+ */
@Test
public void orcsScript() {
String script =
"start from branch 570 find artifacts where art-type = 'Folder' collect artifacts {id, attributes { value } };";
- String expected = "{\n" + //
- " 'parameters' : {\n" + //
- " 'output.debug' : 'false'\n" + //
- " },\n" + //
- " 'script' : 'start from branch 570 find artifacts where art-type = 'Folder' collect artifacts {id, attributes { value } };',\n" + //
- " 'results' : [ {\n" + //
- " 'artifacts' : [ {\n" + //
- " 'id' : 8,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'User Groups'\n" + //
- " }\n" + //
- " }\n" + //
- " }, {\n" + //
- " 'id' : 26,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'Document Templates'\n" + //
- " }\n" + //
- " }\n" + //
- " }, {\n" + //
- " 'id' : 31,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'Action Tracking System'\n" + //
- " }\n" + //
- " }\n" + //
- " }, {\n" + //
- " 'id' : 34,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'Config'\n" + //
- " }\n" + //
- " }\n" + //
- " }, {\n" + //
- " 'id' : 35,\n" + //
- " 'attributes' : {\n" + //
- " 'Name' : {\n" + //
- " 'value' : 'Work Definitions'\n" + //
- " }\n" + //
- " }\n" + //
- " } ]\n" + //
- " } ]\n" + //
- "}";
StringWriter writer = new StringWriter();
Properties properties = new Properties();
createClient.executeScript(script, properties, false, MediaType.APPLICATION_JSON_TYPE, writer);
- assertEquals(expected, normalize(writer.toString()));
+ assertTrue(normalize(writer.toString()).contains("'value' : 'User Groups'"));
}
private String normalize(String value) {
diff --git a/plugins/org.eclipse.osee.x.server.p2/demo/README.txt b/plugins/org.eclipse.osee.x.server.p2/demo/README.txt
new file mode 100644
index 00000000000..8c1a198fa9d
--- /dev/null
+++ b/plugins/org.eclipse.osee.x.server.p2/demo/README.txt
@@ -0,0 +1,11 @@
+When database schema, types or dbinit change, the files in this data directory may need to be updated.
+To do so:
+
+1) Delete C:/Users/<account>/hsql and C:/Users/<account>/attr
+2) Do a normal AtsClient_Integration_TestSuite, stop before ClientResourceTest
+3) Zip up hsql dir to hsql.zip and copy to this directory
+4) Zip up attr to binary_data.zip and copy to this directory
+5) Follow instructions in org.eclpise.osee.x.server.integration.test/README
+
+All canned-db test bundles should be updated with the same zip files, there are
+- search for hsql.db for all locations
diff --git a/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip b/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip
index c3081b136c1..fa798cb3b4e 100644
--- a/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip
+++ b/plugins/org.eclipse.osee.x.server.p2/demo/binary_data.zip
Binary files differ
diff --git a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
index d611f199fd2..9102f85784e 100644
--- a/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
+++ b/plugins/org.eclipse.osee.x.server.p2/demo/hsql.zip
Binary files differ

Back to the top