diff options
author | Roberto E. Escobar | 2013-06-14 21:10:46 +0000 |
---|---|---|
committer | Roberto E. Escobar | 2013-08-19 22:20:40 +0000 |
commit | 592bc26a8b16a8f275bdaede87c0785a1a40db0a (patch) | |
tree | b2290c27b6d7480c15cf11a95573b469a787610f /plugins/org.eclipse.osee.x.server.integration.tests | |
parent | 61c2f8ca577661dcbc75874186970f064002b5f4 (diff) | |
download | org.eclipse.osee-592bc26a8b16a8f275bdaede87c0785a1a40db0a.tar.gz org.eclipse.osee-592bc26a8b16a8f275bdaede87c0785a1a40db0a.tar.xz org.eclipse.osee-592bc26a8b16a8f275bdaede87c0785a1a40db0a.zip |
feature[ats_LN54H]: Add Orcs Rest Query performance tests
Change-Id: I8809f1f5ac453ce21b75f813e772132926fe5978
Diffstat (limited to 'plugins/org.eclipse.osee.x.server.integration.tests')
10 files changed, 709 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/.classpath b/plugins/org.eclipse.osee.x.server.integration.tests/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/.project b/plugins/org.eclipse.osee.x.server.integration.tests/.project new file mode 100644 index 00000000000..d020ef9b574 --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.osee.x.server.integration.tests</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..acc6c80ac92 --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: OSEE X Server Integration Tests +Bundle-SymbolicName: org.eclipse.osee.x.server.integration.tests +Bundle-Version: 0.13.0.qualifier +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Vendor: Eclipse Open System Engineering Environment +Require-Bundle: org.junit;bundle-version="4.11.0", + org.eclipse.osee.orcs.rest.model, + org.eclipse.osee.orcs.rest.client, + org.databene.contiperf +Import-Package: org.eclipse.osee.framework.core.data, + org.eclipse.osee.framework.core.enums, + org.eclipse.osee.framework.core.exception diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/build.properties b/plugins/org.eclipse.osee.x.server.integration.tests/build.properties new file mode 100644 index 00000000000..41d2206e995 --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + logback-test.xml,\ + osee-application-server.xml diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/logback-test.xml b/plugins/org.eclipse.osee.x.server.integration.tests/logback-test.xml new file mode 100644 index 00000000000..925057f12cc --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/logback-test.xml @@ -0,0 +1,29 @@ +<configuration debug="true"> + <!-- See documentation at http://logback.qos.ch/manual/joran.html --> + + <!-- To select this configuration add -Dlogback.configurationFile=logback-test.xml --> + <!-- Set attribute debug="true" to configuration xml element to trace logback configuration --> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder + by default --> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + </pattern> + </encoder> + </appender> + + <!-- Configure OSEE log messages --> + <!-- <logger name="org.eclipse.osee.orcs.db" level="TRACE" /> --> + <!-- <logger name="org.eclipse.osee.database" level="TRACE" /> --> + <!-- <logger name="org.eclipse.osee.orcs.core" level="TRACE" /> --> + <logger name="org.eclipse.osee" level="WARN" /> + <!-- <logger name="org.eclipse.osee.framework.core.server" level="INFO" />--> + + <!-- Vaadin Servlet URL Requests --> + <!-- <logger name="org.eclipse.osee.vaadin" level="TRACE" /> --> + + <root level="WARN"> + <appender-ref ref="STDOUT" /> + </root> +</configuration>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/osee-application-server.xml b/plugins/org.eclipse.osee.x.server.integration.tests/osee-application-server.xml new file mode 100644 index 00000000000..7c3d53f7b6f --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/osee-application-server.xml @@ -0,0 +1,166 @@ +<?xml version="1.0"?> +<project name="Test OSEE Application Server Launcher" default="run" basedir="."> + + <!-- + ${extraVMargs} + + $xserver-db-home + $xserver-db-name=psql.osee.eclipse.org \ + $xserver-db-username=osee.eclipse \ + $xserver-db-password=osee.eclipse \ + $xserver-db-address=127.0.0.1 \ + $xserver-db-port=1623 \ + $xserver-db-web-port=1623 \ + $xserver-db-type=H2,PGSQL \ + + ${xserver-authentication} + ${xserver-data} + ${xserver-home} + ${xserver-port} + ${xserver-telnet-port} + ${xserver-log-config} + --> + + <target name="init"> + <echo message="extraVMargs: [${extraVMargs}]" /> + + <for param="argline" delimiter=" -D" list="${extraVMargs}" trim="true"> + <sequential> + <propertyregex property="argName" override="true" input="@{argline}" regexp="(.*?)=" select="\1" casesensitive="false" /> + <propertyregex property="argValue" override="true" input="@{argline}" regexp="=(.*)" select="\1" casesensitive="false" /> + <echo message="Found arg - [${argName}]=[${argValue}]" /> + <property name="${argName}" value="${argValue}" /> + </sequential> + </for> + + <property name="osee.app.server.connectionFile" value="${xserver-data}/test.osee.performance.db.connection.xml" /> + <property name="osee.app.server.connectionId" value="hsql" /> + <property name="osee.application.server.data" value="${xserver-project}/target/server/demo/binary_data" /> + + <echo message="Server Connection File: [${osee.app.server.connectionFile}]" /> + <echo message="Server Data Directory: [${osee.application.server.data}]" /> + + <echo message="Osee Application Server Home: [${xserver-home}]" /> + <echo message="Osee Application Server Port: [${xserver-port}]" /> + <echo message="Osee Application Server Telnet Port: [${xserver-telnet-port}]" /> + <echo message="Osee Application Server Db Type: [${xserver-db-type}]" /> + </target> + + <target name="writeHsqlConnectionFile" depends="init"> + <writeConnectionFile dbType="hsql" dbHome="${xserver-db-home}" dbPrefix="jdbc:hsqldb:hsql" dbDriver="hsql.db.connection" dbName="${xserver-db-name}" dbUser="${xserver-db-username}" dbPasswd="${xserver-db-password}" dbAddress="${xserver-db-address}" dbPort="${xserver-db-port}" connectionFilePath="${osee.app.server.connectionFile}" connectionid="${osee.app.server.connectionId}" /> + </target> + + <target name="run" depends="init,writeHsqlConnectionFile,startServer" /> + + <target name="startServer"> + <pathconvert property="launcherJarPath" setonempty="false"> + <path> + <fileset dir="${xserver-home}/plugins"> + <include name="org.eclipse.equinox.launcher_*.jar" /> + </fileset> + </path> + </pathconvert> + + <mkdir dir="${xserver-data}" /> + + <forget> + <echo message="Launching Osee Application Server..." /> + <!-- Test Should Complete in 30 mins (timeout vale) - currently, they only take ~13 mins --> + <java taskname="int-test-server" failonerror="true" maxmemory="1024m" timeout="1800000" jar="${launcherJarPath}" fork="true"> + <classpath> + <fileset dir="${xserver-home}/plugins" includes="org.eclipse.equinox.launcher_*.jar" /> + <pathelement location="${xserver-home}/plugins" /> + </classpath> + <sysproperty key="osee.log.default" value="INFO" /> + <sysproperty key="osee.check.tag.queue.on.startup" value="false" /> + <sysproperty key="osgi.noShutdown" value="true" /> + <sysproperty key="org.osgi.service.http.port" value="${xserver-port}" /> + <sysproperty key="osee.db.connection.id" value="${osee.app.server.connectionId}" /> + <sysproperty key="osee.connection.info.uri" value="${osee.app.server.connectionFile}" /> + <sysproperty key="osee.application.server.data" value="${osee.application.server.data}" /> + <sysproperty key="osee.authentication.protocol" value="${xserver-authentication}" /> + <sysproperty key="osee.db.embedded.server" value="${xserver-db-address}:${xserver-db-port}" /> + <sysproperty key="osee.db.embedded.web.server.port" value="${xserver-db-web-port}" /> + <sysproperty key="logback.configurationFile" value="${xserver-log-config}" /> + <sysproperty key="osgi.configuration.area" value="${xserver-project}/configuration" /> + + <jvmarg line="${additionalJvmArgs}" /> + <arg line=" -console ${xserver-telnet-port} -consoleLog -configuration "${xserver-home}/configuration"" /> + </java> + </forget> + + <waitfor maxwait="20" maxwaitunit="second" checkevery="100" checkeveryunit="millisecond"> + <http url="http://127.0.0.1:${xserver-port}/osee/configure/datastore/schema" /> + </waitfor> + </target> + + <target name="stopServer"> + <echo message="Osee Application Server Telnet Port: [${xserver-telnet-port}]" /> + <telnet server="localhost" port="${xserver-telnet-port}" initialCR="yes" timeout="1000"> + <read>osgi></read> + <write>close</write> + </telnet> + <sleep milliseconds="500" /> + + <!-- <echo message="Osee Application Server Port: [${xserver-port}]" /> + <post to="http://127.0.0.1:${xserver-port}/osee/console?cmd=osee&args=server_shutdown" verbose="true" wantresponse="true" property="shutdownOutput" /> + <echo message="${shutdownOutput}" /> + --> + </target> + + <macrodef name="writeConnectionFile"> + <attribute name="dbHome" /> + <attribute name="dbName" /> + <attribute name="dbUser" /> + <attribute name="dbPasswd" /> + <attribute name="dbType" /> + <attribute name="dbPrefix" /> + <attribute name="dbDriver" /> + <attribute name="dbAddress" /> + <attribute name="dbPort" /> + <attribute name="connectionId" /> + <attribute name="connectionFilePath" /> + <sequential> + <echo message="Writing [@{dbType}] Db Connection File" /> + <echo file="@{connectionFilePath}"> + <DbConnection> + <DatabaseInfo id="db.connection.info">${line.separator} + <DatabaseHome key="#DBHOME#" value="@{dbHome}" />${line.separator} + <DatabaseName key="#DBNAME#" value="@{dbName}" />${line.separator} + <DatabaseType key="#TYPE#" value="@{dbType}" />${line.separator} + <Prefix key="#PREFIX#" value="@{dbPrefix}" />${line.separator} + <UserName key="#USERNAME#" value="@{dbUser}" />${line.separator} + <Password key="#PASSWORD#" value="@{dbPasswd}" />${line.separator} + <Host key="#HOST#" value="@AvailableDbServices.hostAddress" />${line.separator} + <Port key="#PORT#" value="@AvailableDbServices.port" />${line.separator} + </DatabaseInfo>${line.separator} + ${line.separator} + <ConnectionDescription id="h2.db.connection">${line.separator} + <Driver>org.h2.Driver</Driver>${line.separator} + <Url>#PREFIX#:tcp://#HOST#:#PORT#/#DBHOME##DBNAME#;IGNORECASE=TRUE;SCHEMA_SEARCH_PATH=@{dbUser}, PUBLIC;MVCC=TRUE</Url>${line.separator} + </ConnectionDescription>${line.separator} + ${line.separator} + <ConnectionDescription id="postgresql.db.connection">${line.separator} + <Driver>org.postgresql.Driver</Driver>${line.separator} + <Url>#PREFIX#://#HOST#:#PORT#/#DBHOME##DBNAME#</Url>${line.separator} + </ConnectionDescription>${line.separator} + ${line.separator} + <ConnectionDescription id="hsql.db.connection">${line.separator} + <Driver>org.hsqldb.jdbc.JDBCDriver</Driver>${line.separator} + <Url>#PREFIX#://#HOST#:#PORT#/#DBNAME#</Url>${line.separator} + <Property key="hsqldb.tx" value="MVCC" />${line.separator} + </ConnectionDescription>${line.separator} + ${line.separator} + </echo> + + <echo file="@{connectionFilePath}" append="true"> + ${line.separator}${line.separator} + <AvailableDbServices>${line.separator} + <Server id="@{connectionId}" dbInfo="db.connection.info" connectsWith="@{dbDriver}" hostAddress="@{dbAddress}" port="@{dbPort}" />${line.separator} + </AvailableDbServices>${line.separator} + </DbConnection> + </echo> + </sequential> + </macrodef> + +</project>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/pom.xml b/plugins/org.eclipse.osee.x.server.integration.tests/pom.xml new file mode 100644 index 00000000000..2d5411439fd --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/pom.xml @@ -0,0 +1,178 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.osee</groupId> + <artifactId>org.eclipse.osee.x.server.parent</artifactId> + <version>0.13.0-SNAPSHOT</version> + <relativePath>../../plugins/org.eclipse.osee.x.server.parent</relativePath> + </parent> + + <artifactId>org.eclipse.osee.x.server.integration.tests</artifactId> + <packaging>eclipse-test-plugin</packaging> + <name>OSEE Server Integration Tests (Incubation)</name> + + <build> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <version>${tycho-version}</version> + <configuration> + <testSuite>org.eclipse.osee.x.server.integration.tests</testSuite> + <testClass>org.eclipse.osee.x.server.integration.tests.ServerIntegrationTestSuite</testClass> + <systemProperties combine.children="append"> + <osee.log.default>WARNING</osee.log.default> + <eventDebug>log</eventDebug> + <eventSystem>new</eventSystem> + <osee.is.in.db.init>true</osee.is.in.db.init> + <osee.application.server>http://localhost:${osee-server-port}</osee.application.server> + </systemProperties> + <redirectTestOutputToFile>false</redirectTestOutputToFile> + </configuration> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>osee-server-int-test-debug</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <properties> + <int-test-debug-port>9009</int-test-debug-port> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.eclipse.tycho</groupId> + <artifactId>tycho-surefire-plugin</artifactId> + <version>${tycho-version}</version> + <configuration> + <debugPort>${int-test-debug-port}</debugPort> + <!-- <systemProperties combine.children="append"> <equinox.ds.debug>true</equinox.ds.debug> + </systemProperties> --> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>osee-server-int-test-remote-server</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <properties> + <osee-server-port>8089</osee-server-port> + </properties> + </profile> + <profile> + <id>osee-server-int-test-local-server</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>${build-helper-maven-plugin-version}</version> + <executions> + <execution> + <id>reserve-ports</id> + <phase>pre-integration-test</phase> + <goals> + <goal>reserve-network-port</goal> + </goals> + <configuration> + <portNames> + <portName>osee-server-port</portName> + <portName>osee-server-db-port</portName> + <portName>osee-server-db-web-port</portName> + <portName>osee-server-telnet-port</portName> + </portNames> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <version>${maven-antrun-version}</version> + <executions> + <execution> + <id>osee-server-start</id> + <phase>pre-integration-test</phase> + <configuration> + <target> + <property name="plugin_classpath" refid="maven.plugin.classpath" /> + <taskdef resource="net/sf/antcontrib/antlib.xml"> + <classpath> + <pathelement path="${classpath}" /> + <pathelement path="${plugin_classpath}" /> + </classpath> + </taskdef> + + <property name="xserver-project" + value="${project.basedir}/../org.eclipse.osee.x.server.p2" /> + <property name="xserver-home" value="${xserver-project}/target/server" /> + <property name="xserver-port" value="${osee-server-port}" /> + <property name="xserver-telnet-port" value="${osee-server-telnet-port}" /> + <property name="xserver-authentication" value="demo" /> + <property name="xserver-data" + value="${project.build.directory}/server-data" /> + <property name="xserver-log-config" value="${project.basedir}/logback-test.xml" /> + + <property name="xserver-db-home" value="file:${xserver-project}/target/server/demo/hsql/osee.hsql.db" /> + <property name="xserver-db-name" value="osee-test-db" /> + <property name="xserver-db-username" value="public" /> + <property name="xserver-db-password" value="" /> + <property name="xserver-db-address" value="127.0.0.1" /> + <property name="xserver-db-port" value="${osee-server-db-port}" /> + <property name="xserver-db-web-port" value="${osee-server-db-web-port}" /> + <property name="xserver-db-type" value="HSQL" /> + <property name="additionalJvmArgs" value=" " /> + + <property name="xserver-log-output" value="${xserver-data}/server-output.log" /> + + <mkdir dir="${xserver-data}" /> + <ant antfile="osee-application-server.xml" target="run" + inheritRefs="true" output="${xserver-log-output}" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>osee-server-stop</id> + <phase>post-integration-test</phase> + <configuration> + <target> + <property name="plugin_classpath" refid="maven.plugin.classpath" /> + <taskdef resource="net/sf/antcontrib/antlib.xml"> + <classpath> + <pathelement path="${classpath}" /> + <pathelement path="${plugin_classpath}" /> + </classpath> + </taskdef> + <property name="xserver-port" value="${osee-server-port}" /> + <property name="xserver-telnet-port" value="${osee-server-telnet-port}" /> + + <ant antfile="osee-application-server.xml" target="stopServer" + inheritRefs="true" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/ServerIntegrationTestSuite.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/ServerIntegrationTestSuite.java new file mode 100644 index 00000000000..ad700d45b9f --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/ServerIntegrationTestSuite.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2013 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.x.server.integration.tests; + +import org.eclipse.osee.x.server.integration.tests.performance.OseeClientQueryTest; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses({OseeClientQueryTest.class}) +public class ServerIntegrationTestSuite { + // Test Suite +} diff --git a/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java new file mode 100644 index 00000000000..545a03f165b --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/IntegrationUtil.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2013 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.x.server.integration.tests.performance; + +import org.databene.contiperf.junit.ContiPerfRule; +import org.databene.contiperf.report.CSVLatencyReportModule; +import org.databene.contiperf.report.CSVSummaryReportModule; +import org.databene.contiperf.report.HtmlReportModule; +import org.eclipse.osee.orcs.rest.client.OseeClient; +import org.eclipse.osee.orcs.rest.client.OseeClientConfig; +import org.eclipse.osee.orcs.rest.client.OseeClientStandaloneSetup; +import org.junit.rules.MethodRule; + +public final class IntegrationUtil { + + private static final String OSEE_APPLICATION_SERVER = "osee.application.server"; + private static final String DEFAULT_OSEE_APPLICATION_SERVER = "http://localhost:8089"; + + private IntegrationUtil() { + // Utility class + } + + public static MethodRule createPerformanceRule() { + return new ContiPerfRule(new HtmlReportModule(), new CSVSummaryReportModule(), new CSVLatencyReportModule()); + } + + public static OseeClient createClient() { + OseeClientConfig config = createClientConfig(); + return OseeClientStandaloneSetup.createClient(config); + } + + private static OseeClientConfig createClientConfig() { + String serverAddress = System.getProperty(OSEE_APPLICATION_SERVER, DEFAULT_OSEE_APPLICATION_SERVER); + OseeClientConfig config = new OseeClientConfig(serverAddress); + return config; + } + +} 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 new file mode 100644 index 00000000000..3aba3e95855 --- /dev/null +++ b/plugins/org.eclipse.osee.x.server.integration.tests/src/org/eclipse/osee/x/server/integration/tests/performance/OseeClientQueryTest.java @@ -0,0 +1,214 @@ +/******************************************************************************* + * Copyright (c) 2013 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.x.server.integration.tests.performance; + +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.Folder; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.GeneralData; +import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.GeneralDocument; +import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.AccessContextId; +import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.Active; +import static org.eclipse.osee.framework.core.enums.CoreBranches.COMMON; +import static org.junit.Assert.assertEquals; +import org.databene.contiperf.PerfTest; +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.data.Identity; +import org.eclipse.osee.framework.core.enums.CaseType; +import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; +import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.core.enums.MatchTokenCountType; +import org.eclipse.osee.framework.core.enums.SystemUser; +import org.eclipse.osee.framework.core.enums.TokenDelimiterMatch; +import org.eclipse.osee.framework.core.enums.TokenOrderType; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.orcs.rest.client.OseeClient; +import org.eclipse.osee.orcs.rest.model.search.SearchResult; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.MethodRule; + +@PerfTest(threads = 2, invocations = 100) +public class OseeClientQueryTest { + + // Randomly selected guids/hrids + private static final String GUID1 = "ABNRvbZxXHICYklfslwA"; + private static final String GUID2 = "D2hZ1_MwKRsqTILDKawA"; + private static final String HRID1 = "6G642"; + private static final String HRID2 = "1ZDBN"; + + private static final IOseeBranch SAW_1 = new IOseeBranch() { + + @Override + public String getGuid() { + return "AyH_f2sSKy3l07fIvAAA"; + } + + @Override + public boolean matches(Identity<?>... identities) { + return false; + } + + @Override + public String getName() { + return "SAW_Bld_1"; + } + }; + + @Rule + public MethodRule performanceRule = IntegrationUtil.createPerformanceRule(); + + private static OseeClient createClient; + + @BeforeClass + public static void testSetup() throws OseeCoreException { + createClient = IntegrationUtil.createClient(); + + // Establish initial connection to the db using this random query + createClient.createQueryBuilder(COMMON).andIds(SystemUser.OseeSystem).getSearchResult(); + } + + @Test + public void searchForAttributeTypeByTokenId() throws OseeCoreException { + final int EXPECTED_RESULTS = 1; + SearchResult results = createClient.createQueryBuilder(COMMON).andIds(SystemUser.OseeSystem).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForAttributeTypeByTokenIds() throws OseeCoreException { + final int EXPECTED_RESULTS = 2; + SearchResult results = + createClient.createQueryBuilder(COMMON).andIds(SystemUser.OseeSystem, SystemUser.Guest).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByGuid() throws OseeCoreException { + final int EXPECTED_RESULTS = 1; + SearchResult results = createClient.createQueryBuilder(COMMON).andGuidsOrHrids(GUID1).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByGuids() throws OseeCoreException { + final int EXPECTED_RESULTS = 2; + SearchResult results = createClient.createQueryBuilder(COMMON).andGuidsOrHrids(GUID1, GUID2).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByGuidsExcludeCache() throws OseeCoreException { + final int EXPECTED_RESULTS = 2; + SearchResult results = + createClient.createQueryBuilder(COMMON).andGuidsOrHrids(GUID1, GUID2).excludeCache().getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByGuidsIncludeCache() throws OseeCoreException { + final int EXPECTED_RESULTS = 2; + SearchResult results = + createClient.createQueryBuilder(COMMON).andGuidsOrHrids(GUID1, GUID2).includeCache().getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByHrid() throws OseeCoreException { + final int EXPECTED_RESULTS = 1; + SearchResult results = createClient.createQueryBuilder(COMMON).andGuidsOrHrids(HRID1).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByHrids() throws OseeCoreException { + final int EXPECTED_RESULTS = 2; + SearchResult results = createClient.createQueryBuilder(COMMON).andGuidsOrHrids(HRID1, HRID2).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByLocalId() throws OseeCoreException { + final int EXPECTED_RESULTS = 1; + SearchResult results = createClient.createQueryBuilder(COMMON).andLocalId(9).getSearchResult(); + 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(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void SearchForArtifactByName() throws OseeCoreException { + final int EXPECTED_RESULTS = 1; + SearchResult results = createClient.createQueryBuilder(COMMON).andNameEquals("Joe Smith").getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForArtifactWithActionInName() throws OseeCoreException { + final int EXPECTED_RESULTS = 43; + SearchResult results = + createClient.createQueryBuilder(COMMON).and(CoreAttributeTypes.Name, "SAW", CaseType.IGNORE_CASE, + TokenOrderType.MATCH_ORDER, TokenDelimiterMatch.ANY, MatchTokenCountType.IGNORE_TOKEN_COUNT).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForArtifactType() throws OseeCoreException { + final int EXPECTED_RESULTS = 7; + SearchResult results = createClient.createQueryBuilder(SAW_1).andIsOfType(Folder).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForArtifactTypes() throws OseeCoreException { + final int EXPECTED_RESULTS = 24; + SearchResult results = + createClient.createQueryBuilder(SAW_1).andIsOfType(GeneralData, GeneralDocument, + CoreArtifactTypes.SoftwareRequirement).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForArtifactTypesIncludeTypeInheritance() throws OseeCoreException { + final int EXPECTED_RESULTS = 150; + SearchResult results = + createClient.createQueryBuilder(SAW_1).andIsOfType(GeneralData, GeneralDocument, CoreArtifactTypes.Requirement).includeTypeInheritance().getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForExistenceOfAttributeType() throws OseeCoreException { + final int EXPECTED_RESULTS = 28; + SearchResult results = createClient.createQueryBuilder(COMMON).andExists(Active).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForExistenceOfAttributeTypeIncludeDeleted() throws OseeCoreException { + final int EXPECTED_RESULTS = 28; + SearchResult results = + createClient.createQueryBuilder(COMMON).andExists(Active).includeDeleted().getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + + @Test + public void searchForExistenceOfAttributeTypes() throws OseeCoreException { + final int EXPECTED_RESULTS = 28; + SearchResult results = + createClient.createQueryBuilder(COMMON).andExists(Active, AccessContextId).getSearchResult(); + assertEquals(EXPECTED_RESULTS, results.getTotal()); + } + +} |