Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2014-11-26 18:43:10 -0500
committerAngel Avila2014-11-26 18:43:10 -0500
commit58aee3b10ceeadbe21c1ba539d0b7e5bbbde776a (patch)
treef5e139923f1a21bfea4994553374d823512fb3f4 /plugins/org.eclipse.osee.orcs.db.test
parent6407bc44a88f6b410f560916358bdf2a90606b8b (diff)
downloadorg.eclipse.osee-58aee3b10ceeadbe21c1ba539d0b7e5bbbde776a.tar.gz
org.eclipse.osee-58aee3b10ceeadbe21c1ba539d0b7e5bbbde776a.tar.xz
org.eclipse.osee-58aee3b10ceeadbe21c1ba539d0b7e5bbbde776a.zip
feature[ats_ATS139503]: Use JdbcService in ORCS
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.db.test')
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/OrcsDbTestSuite.launch7
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/pom.xml5
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/IntegrationUtil.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/LoaderTest.java5
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/OseeInfoDataAccessorTest.java52
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java1
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java14
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/proxy/VarCharDataProxyTest.java16
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/QueryTestSuite.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/consumer/IndexingTaskDatabaseTxCallableTest.java (renamed from plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/indexer/IndexingTaskDatabaseTxCallableTest.java)77
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/MockJoinAccessor.java12
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/TransactionJoinQueryTest.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java20
14 files changed, 81 insertions, 138 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.db.test/META-INF/MANIFEST.MF
index 7e2d6e839e..8e967f5252 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.db.test/META-INF/MANIFEST.MF
@@ -9,8 +9,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
- org.eclipse.osee.framework.database,
- org.eclipse.osee.framework.database.core,
org.eclipse.osee.framework.resource.management,
org.eclipse.osee.framework.resource.management.exception,
org.eclipse.osee.framework.resource.management.util,
diff --git a/plugins/org.eclipse.osee.orcs.db.test/OrcsDbTestSuite.launch b/plugins/org.eclipse.osee.orcs.db.test/OrcsDbTestSuite.launch
index df480bb4b2..86cf1e7286 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/OrcsDbTestSuite.launch
+++ b/plugins/org.eclipse.osee.orcs.db.test/OrcsDbTestSuite.launch
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
<setAttribute key="additional_plugins">
-<setEntry value="org.eclipse.equinox.ds:1.4.100.v20130515-2026:default:true"/>
-<setEntry value="org.eclipse.osee.hsqldb:0.11.1.qualifier:default:false"/>
-<setEntry value="org.eclipse.osee.orcs.db.mock:0.11.1.qualifier:default:true"/>
+<setEntry value="org.eclipse.equinox.cm:1.0.400.v20130327-1442:default:true"/>
+<setEntry value="org.eclipse.equinox.ds:1.4.101.v20130813-1853:default:true"/>
+<setEntry value="org.eclipse.osee.hsqldb:0.19.0.v201411122326-RC:default:false"/>
+<setEntry value="org.eclipse.osee.orcs.db.mock:0.20.0.qualifier:default:true"/>
<setEntry value="org.hsqldb:2.2.9.qualifier:default:false"/>
<setEntry value="org.mockito:1.9.0.qualifier:default:false"/>
</setAttribute>
diff --git a/plugins/org.eclipse.osee.orcs.db.test/pom.xml b/plugins/org.eclipse.osee.orcs.db.test/pom.xml
index 2683f614cd..ef7fa7f15a 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/pom.xml
+++ b/plugins/org.eclipse.osee.orcs.db.test/pom.xml
@@ -51,11 +51,6 @@
</dependency>
<dependency>
<type>eclipse-plugin</type>
- <artifactId>org.eclipse.osee.hsqldb</artifactId>
- <version>0.0.0</version>
- </dependency>
- <dependency>
- <type>eclipse-plugin</type>
<artifactId>org.eclipse.osee.framework.logging</artifactId>
<version>0.0.0</version>
</dependency>
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 9009006568..afd585aee4 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
@@ -32,8 +32,8 @@ public class IntegrationUtil {
private static final Comparator<OrcsData> SORT_BY_LOCAL_ID = new IdComparator();
- public static TestRule integrationRule(Object testObject, String dbId) {
- return RuleChain.outerRule(new OseeDatabase(dbId)).around(new OsgiRule(testObject));
+ public static TestRule integrationRule(Object testObject) {
+ return RuleChain.outerRule(new OseeDatabase("orcs.jdbc.service")).around(new OsgiRule(testObject));
}
public static void sort(List<? extends OrcsData> data) {
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 dc75d0eb9a..b0f9e1a71d 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
@@ -28,7 +28,6 @@ import java.util.Iterator;
import org.eclipse.osee.executor.admin.HasCancellation;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.LoadLevel;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.orcs.OrcsSession;
@@ -58,10 +57,10 @@ import org.mockito.MockitoAnnotations;
public class LoaderTest {
@Rule
- public TestRule db = integrationRule(this, "osee.demo.hsql");
+ public TestRule db = integrationRule(this);
// @formatter:off
- @OsgiService private IOseeDatabaseService dbService;
+// @OsgiService private JdbcClient jdbcClient;
@OsgiService private OrcsDataStore dataStore;
@Mock private LoadDataHandler builder;
@Captor private ArgumentCaptor<LoadDescription> descriptorCaptor;
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/OseeInfoDataAccessorTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/OseeInfoDataAccessorTest.java
index 632d2aba01..fe0760d8ce 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/OseeInfoDataAccessorTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/OseeInfoDataAccessorTest.java
@@ -12,11 +12,11 @@ package org.eclipse.osee.orcs.db.intergration;
import static org.eclipse.osee.orcs.db.intergration.IntegrationUtil.integrationRule;
import java.sql.DatabaseMetaData;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.OseeConnection;
-import org.eclipse.osee.framework.database.core.SupportedDatabase;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.type.OseeStateException;
+import org.eclipse.osee.jdbc.JdbcConnection;
+import org.eclipse.osee.jdbc.JdbcDbType;
+import org.eclipse.osee.jdbc.JdbcService;
import org.eclipse.osee.orcs.core.ds.DataStoreConstants;
import org.eclipse.osee.orcs.db.internal.SqlProvider;
import org.eclipse.osee.orcs.db.internal.accessor.OseeInfoDataAccessor;
@@ -35,17 +35,17 @@ import org.junit.rules.TestRule;
public class OseeInfoDataAccessorTest {
@Rule
- public TestRule db = integrationRule(this, "osee.demo.hsql");
+ public TestRule db = integrationRule(this);
//@formatter:off
- @OsgiService private IOseeDatabaseService dbService;
+ @OsgiService private JdbcService jdbcService;
//@formatter:on
@org.junit.Test
public void testGetSetValue() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
String value = accessor.getValue("test.data");
Assert.assertEquals("", value);
@@ -61,7 +61,7 @@ public class OseeInfoDataAccessorTest {
public void testSetBinaryDataPath() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
accessor.putValue(ResourceConstants.BINARY_DATA_PATH, "dummy");
}
@@ -70,7 +70,7 @@ public class OseeInfoDataAccessorTest {
public void testGetBinaryDataPath() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
String original = accessor.getValue(ResourceConstants.BINARY_DATA_PATH);
Assert.assertEquals(System.getProperty(ResourceConstants.BINARY_DATA_PATH), original);
@@ -88,7 +88,7 @@ public class OseeInfoDataAccessorTest {
public void testSetDatabaseHintsSupported() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
accessor.putValue(SqlProvider.SQL_DATABASE_HINTS_SUPPORTED_KEY, "dummy");
}
@@ -97,15 +97,15 @@ public class OseeInfoDataAccessorTest {
public void testGetDatabaseHintsSupported() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
String original = accessor.getValue(SqlProvider.SQL_DATABASE_HINTS_SUPPORTED_KEY);
boolean expected = false;
- OseeConnection connection = dbService.getConnection();
+ JdbcConnection connection = jdbcService.getClient().getConnection();
try {
DatabaseMetaData metaData = connection.getMetaData();
- expected = SupportedDatabase.isDatabaseType(metaData, SupportedDatabase.oracle);
+ expected = JdbcDbType.isDatabaseType(metaData, JdbcDbType.oracle);
} finally {
connection.close();
}
@@ -116,7 +116,7 @@ public class OseeInfoDataAccessorTest {
public void testSetSQLRecursiveKeyword() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
accessor.putValue(SqlProvider.SQL_RECURSIVE_WITH_KEY, "dummy");
}
@@ -125,15 +125,15 @@ public class OseeInfoDataAccessorTest {
public void testGetSQLRecursiveKeyword() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
String original = accessor.getValue(SqlProvider.SQL_RECURSIVE_WITH_KEY);
String expected = "";
- OseeConnection connection = dbService.getConnection();
+ JdbcConnection connection = jdbcService.getClient().getConnection();
try {
DatabaseMetaData metaData = connection.getMetaData();
- if (!SupportedDatabase.isDatabaseType(metaData, SupportedDatabase.oracle)) {
+ if (!JdbcDbType.isDatabaseType(metaData, JdbcDbType.oracle)) {
expected = "RECURSIVE";
}
} finally {
@@ -146,7 +146,7 @@ public class OseeInfoDataAccessorTest {
public void testSetSQLRegExpPattern() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
accessor.putValue(SqlProvider.SQL_REG_EXP_PATTERN_KEY, "dummy");
}
@@ -155,20 +155,20 @@ public class OseeInfoDataAccessorTest {
public void testGetSQLRegExpPattern() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
String original = accessor.getValue(SqlProvider.SQL_REG_EXP_PATTERN_KEY);
String expected = "";
- OseeConnection connection = dbService.getConnection();
+ JdbcConnection connection = jdbcService.getClient().getConnection();
try {
DatabaseMetaData metaData = connection.getMetaData();
- SupportedDatabase db = SupportedDatabase.getDatabaseType(metaData);
- if (SupportedDatabase.oracle == db) {
+ JdbcDbType db = JdbcDbType.getDatabaseType(metaData);
+ if (JdbcDbType.oracle == db) {
expected = "REGEXP_LIKE (%s, %s)";
- } else if (SupportedDatabase.hsql == db || SupportedDatabase.postgresql == db) {
+ } else if (JdbcDbType.hsql == db || JdbcDbType.postgresql == db) {
expected = "REGEXP_MATCHES (%s, %s)";
- } else if (SupportedDatabase.mysql == db) {
+ } else if (JdbcDbType.mysql == db) {
expected = "(%s REGEXP %s)";
}
} finally {
@@ -181,7 +181,7 @@ public class OseeInfoDataAccessorTest {
public void testSetCheckTagQueueOnStartupAllowed() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
accessor.putValue(DataStoreConstants.DATASTORE_INDEX_ON_START_UP, "dummy");
}
@@ -190,7 +190,7 @@ public class OseeInfoDataAccessorTest {
public void testGetCheckTagQueueOnStartupAllowed() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
String original = accessor.getValue(DataStoreConstants.DATASTORE_INDEX_ON_START_UP);
Assert.assertEquals(System.getProperty(DataStoreConstants.DATASTORE_INDEX_ON_START_UP, "false"), original);
@@ -208,7 +208,7 @@ public class OseeInfoDataAccessorTest {
public void testGetKeys() throws OseeCoreException {
OseeInfoDataAccessor accessor = new OseeInfoDataAccessor();
accessor.setLogger(new MockLog());
- accessor.setDatabaseService(dbService);
+ accessor.setJdbcService(jdbcService);
Assert.assertTrue(!accessor.getKeys().isEmpty());
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java
index 5db6473ea4..0e01df089f 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataFactoryImplTest.java
@@ -239,6 +239,7 @@ public class DataFactoryImplTest {
assertEquals("", objData[2]);
}
+ @SuppressWarnings("unchecked")
@Test
public void testCreateRelationData() throws OseeCoreException {
IRelationType relationType = mock(IRelationType.class);
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java
index ea16098df7..24f9075b92 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/loader/DataLoaderFactoryImplTest.java
@@ -31,10 +31,10 @@ import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.enums.DeletionFlag;
import org.eclipse.osee.framework.core.enums.LoadLevel;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.GUID;
+import org.eclipse.osee.jdbc.JdbcClient;
+import org.eclipse.osee.jdbc.JdbcStatement;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.DataLoader;
@@ -73,8 +73,8 @@ public class DataLoaderFactoryImplTest {
//@formatter:off
@Mock private Log logger;
- @Mock private IOseeDatabaseService dbService;
- @Mock private IOseeStatement chStmt;
+ @Mock private JdbcClient jdbcClient;
+ @Mock private JdbcStatement chStmt;
@Mock private IdentityManager identityService;
@Mock private SqlProvider sqlProvider;
@@ -108,7 +108,7 @@ public class DataLoaderFactoryImplTest {
String sessionId = GUID.create();
when(session.getGuid()).thenReturn(sessionId);
- LoaderModule module = new LoaderModule(logger, dbService, identityService, sqlProvider, null, joinFactory);
+ LoaderModule module = new LoaderModule(logger, jdbcClient, identityService, sqlProvider, null, joinFactory);
SqlObjectLoader loader = module.createSqlObjectLoader(rowDataFactory, null);
spyLoader = spy(loader);
@@ -116,8 +116,8 @@ public class DataLoaderFactoryImplTest {
when(sqlProvider.getSql(OseeSql.QUERY_BUILDER)).thenReturn("/*+ ordered */");
- when(dbService.getStatement()).thenReturn(chStmt);
- when(dbService.runPreparedQueryFetchObject(eq(-1), Matchers.anyString(), eq(BRANCH.getUuid()))).thenReturn(
+ when(jdbcClient.getStatement()).thenReturn(chStmt);
+ when(jdbcClient.runPreparedQueryFetchObject(eq(-1), Matchers.anyString(), eq(BRANCH.getUuid()))).thenReturn(
EXPECTED_HEAD_TX_ID);
when(joinFactory.createArtifactJoinQuery()).thenAnswer(new Answer<ArtifactJoinQuery>() {
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/proxy/VarCharDataProxyTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/proxy/VarCharDataProxyTest.java
index 264e0458ed..af919cd8ee 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/proxy/VarCharDataProxyTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/proxy/VarCharDataProxyTest.java
@@ -10,11 +10,11 @@
*******************************************************************************/
package org.eclipse.osee.orcs.db.internal.proxy;
-import static org.eclipse.osee.framework.database.IOseeDatabaseService.MAX_VARCHAR_LENGTH;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.jdbc.JdbcConstants;
import org.eclipse.osee.orcs.db.mocks.MockDataHandler;
import org.eclipse.osee.orcs.db.mocks.MockLog;
import org.eclipse.osee.orcs.db.mocks.MockResourceNameResolver;
@@ -59,10 +59,10 @@ public class VarCharDataProxyTest {
@Test
public void testSetGetData() throws Exception {
- String longData = Utility.generateData(MAX_VARCHAR_LENGTH + 1);
+ String longData = Utility.generateData(JdbcConstants.JDBC__MAX_VARCHAR_LENGTH + 1);
byte[] zippedData = Utility.asZipped(longData, "myTest.txt");
- String shortStringData = Utility.generateData(MAX_VARCHAR_LENGTH);
+ String shortStringData = Utility.generateData(JdbcConstants.JDBC__MAX_VARCHAR_LENGTH);
MockDataHandler handler = new MockDataHandler();
handler.setContent(zippedData);
@@ -98,7 +98,7 @@ public class VarCharDataProxyTest {
@Test
public void testSetValue() throws Exception {
- String longData = Utility.generateData(MAX_VARCHAR_LENGTH + 1);
+ String longData = Utility.generateData(JdbcConstants.JDBC__MAX_VARCHAR_LENGTH + 1);
byte[] zippedData = Utility.asZipped(longData, "myTest.txt");
MockDataHandler handler = new MockDataHandler();
@@ -127,10 +127,10 @@ public class VarCharDataProxyTest {
@Test
public void testPersist() throws Exception {
- String longData = Utility.generateData(MAX_VARCHAR_LENGTH + 1);
+ String longData = Utility.generateData(JdbcConstants.JDBC__MAX_VARCHAR_LENGTH + 1);
byte[] zippedData = Utility.asZipped(longData, "myTest.txt");
- String shortData = Utility.generateData(MAX_VARCHAR_LENGTH);
+ String shortData = Utility.generateData(JdbcConstants.JDBC__MAX_VARCHAR_LENGTH);
MockDataHandler handler = new MockDataHandler();
handler.setContent(zippedData);
@@ -180,7 +180,7 @@ public class VarCharDataProxyTest {
@Test(expected = OseeCoreException.class)
public void testPersistResolverException() throws Exception {
- String longData = Utility.generateData(MAX_VARCHAR_LENGTH + 1);
+ String longData = Utility.generateData(JdbcConstants.JDBC__MAX_VARCHAR_LENGTH + 1);
byte[] zippedData = Utility.asZipped(longData, "myTest.txt");
MockDataHandler handler = new MockDataHandler();
@@ -204,7 +204,7 @@ public class VarCharDataProxyTest {
@Test
public void testPurge() throws Exception {
- String longData = Utility.generateData(MAX_VARCHAR_LENGTH + 1);
+ String longData = Utility.generateData(JdbcConstants.JDBC__MAX_VARCHAR_LENGTH + 1);
byte[] zippedData = Utility.asZipped(longData, "myTest.txt");
MockDataHandler handler = new MockDataHandler();
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/QueryTestSuite.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/QueryTestSuite.java
index bc1d00f534..e7ae8f2b38 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/QueryTestSuite.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/QueryTestSuite.java
@@ -12,7 +12,7 @@ package org.eclipse.osee.orcs.db.internal.search;
import org.eclipse.osee.orcs.db.internal.search.engines.EnginesTestSuite;
import org.eclipse.osee.orcs.db.internal.search.handlers.HandlersTestSuite;
-import org.eclipse.osee.orcs.db.internal.search.indexer.IndexingTaskDatabaseTxCallableTest;
+import org.eclipse.osee.orcs.db.internal.search.indexer.callable.consumer.IndexingTaskDatabaseTxCallableTest;
import org.eclipse.osee.orcs.db.internal.search.language.LanguageTestSuite;
import org.eclipse.osee.orcs.db.internal.search.tagger.TaggerTestSuite;
import org.eclipse.osee.orcs.db.internal.search.util.UtilityTestSuite;
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/indexer/IndexingTaskDatabaseTxCallableTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/consumer/IndexingTaskDatabaseTxCallableTest.java
index 856e5080bd..46114ff194 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/indexer/IndexingTaskDatabaseTxCallableTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/indexer/callable/consumer/IndexingTaskDatabaseTxCallableTest.java
@@ -8,7 +8,7 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.orcs.db.internal.search.indexer;
+package org.eclipse.osee.orcs.db.internal.search.indexer.callable.consumer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -17,16 +17,15 @@ import static org.mockito.MockitoAnnotations.initMocks;
import java.sql.DatabaseMetaData;
import java.util.ArrayList;
import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.jdbc.JdbcClient;
+import org.eclipse.osee.jdbc.JdbcConnection;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.IndexedResource;
import org.eclipse.osee.orcs.core.ds.OrcsDataHandler;
import org.eclipse.osee.orcs.data.AttributeTypes;
-import org.eclipse.osee.orcs.db.internal.callable.AbstractDatastoreTxCallable;
-import org.eclipse.osee.orcs.db.internal.search.indexer.callable.consumer.IndexingTaskDatabaseTxCallable;
+import org.eclipse.osee.orcs.db.internal.search.indexer.IndexedResourceLoader;
import org.eclipse.osee.orcs.db.internal.search.tagger.TagCollector;
import org.eclipse.osee.orcs.db.internal.search.tagger.Tagger;
import org.eclipse.osee.orcs.db.internal.search.tagger.TaggingEngine;
@@ -45,7 +44,7 @@ public class IndexingTaskDatabaseTxCallableTest {
// @formatter:off
@Mock private Log logger;
@Mock private OrcsSession session;
- @Mock private IOseeDatabaseService dbService;
+ @Mock private JdbcClient jdbcClient;
@Mock private IndexerCollectorAdapter collector;
@Mock private AttributeTypes types;
@Mock private IndexedResource resource1;
@@ -53,62 +52,10 @@ public class IndexingTaskDatabaseTxCallableTest {
@Mock private TaggingEngine engine;
@Mock private DatabaseMetaData metaData;
@Mock private Tagger tagger;
+ @Mock private JdbcConnection connection;
// @formatter:on
- private class MockConnection extends OseeConnection {
-
- public MockConnection() {
- super();
- }
-
- @Override
- public void close() throws OseeCoreException {
- //
- };
-
- @Override
- public boolean isClosed() throws OseeCoreException {
- return true;
- }
-
- @Override
- public boolean isStale() {
- return false;
- };
-
- @Override
- public DatabaseMetaData getMetaData() throws OseeCoreException {
- return metaData;
- };
-
- @Override
- protected void setAutoCommit(boolean autoCommit) throws OseeCoreException {
- //
- };
-
- @Override
- protected boolean getAutoCommit() throws OseeCoreException {
- return true;
- };
-
- @Override
- protected void commit() throws OseeCoreException {
- //
- };
-
- @Override
- protected void rollback() throws OseeCoreException {
- //
- };
-
- @Override
- protected void destroy() throws OseeCoreException {
- //
- };
-
- }
- private MockConnection connection;
- private AbstractDatastoreTxCallable<Long> txCallable;
+ private IndexingTaskDatabaseTxCallable txCallable;
@Before
public void setUp() {
@@ -120,9 +67,8 @@ public class IndexingTaskDatabaseTxCallableTest {
handler.onData(resource2);
}
};
- connection = new MockConnection();
txCallable =
- new IndexingTaskDatabaseTxCallable(logger, session, dbService, loader, engine, collector, -1, false, 10000,
+ new IndexingTaskDatabaseTxCallable(logger, session, jdbcClient, loader, engine, collector, -1, false, 10000,
types);
}
@@ -138,16 +84,19 @@ public class IndexingTaskDatabaseTxCallableTest {
when(engine.hasTagger("")).thenReturn(false);
when(engine.hasTagger("Tag")).thenReturn(true);
when(engine.getTagger("Tag")).thenReturn(tagger);
- when(dbService.getConnection()).thenReturn(connection);
+
when(metaData.getDatabaseProductName()).thenReturn("h2");
when(types.getByUuid(CoreAttributeTypes.Name.getGuid())).thenReturn(CoreAttributeTypes.Name);
when(types.getByUuid(CoreAttributeTypes.QualificationMethod.getGuid())).thenReturn(
CoreAttributeTypes.QualificationMethod);
when(types.getTaggerId(CoreAttributeTypes.Name)).thenReturn("Tag");
when(types.getTaggerId(CoreAttributeTypes.QualificationMethod)).thenReturn(null);
- txCallable.call();
+
+ txCallable.handleTxWork(connection);
+
verify(logger, times(1)).error("Field has invalid tagger[%s] provider and cannot be tagged - [Gamma: %s]", null,
2L);
verify(tagger, times(1)).tagIt(Matchers.eq(resource1), Matchers.any(TagCollector.class));
}
+
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/MockJoinAccessor.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/MockJoinAccessor.java
index 597748a98c..c375ae7c34 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/MockJoinAccessor.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/MockJoinAccessor.java
@@ -12,8 +12,8 @@ package org.eclipse.osee.orcs.db.internal.sql.join;
import java.util.Collection;
import java.util.List;
-import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.jdbc.JdbcConnection;
import org.eclipse.osee.orcs.db.internal.sql.join.DatabaseJoinAccessor.JoinItem;
/**
@@ -21,13 +21,13 @@ import org.eclipse.osee.orcs.db.internal.sql.join.DatabaseJoinAccessor.JoinItem;
*/
public class MockJoinAccessor implements IJoinAccessor {
- private OseeConnection connection;
+ private JdbcConnection connection;
private JoinItem joinItem;
private int queryId;
private List<Object[]> dataList;
@Override
- public void store(OseeConnection connection, JoinItem joinItem, int queryId, List<Object[]> dataList, Long issuedAt, Long expiresIn) throws OseeCoreException {
+ public void store(JdbcConnection connection, JoinItem joinItem, int queryId, List<Object[]> dataList, Long issuedAt, Long expiresIn) throws OseeCoreException {
this.connection = connection;
this.joinItem = joinItem;
this.queryId = queryId;
@@ -35,7 +35,7 @@ public class MockJoinAccessor implements IJoinAccessor {
}
@Override
- public int delete(OseeConnection connection, JoinItem joinItem, int queryId) {
+ public int delete(JdbcConnection connection, JoinItem joinItem, int queryId) {
this.connection = connection;
this.joinItem = joinItem;
this.queryId = queryId;
@@ -43,7 +43,7 @@ public class MockJoinAccessor implements IJoinAccessor {
}
@Override
- public Collection<Integer> getAllQueryIds(OseeConnection connection, JoinItem joinItem) {
+ public Collection<Integer> getAllQueryIds(JdbcConnection connection, JoinItem joinItem) {
this.connection = connection;
this.joinItem = joinItem;
return null;
@@ -56,7 +56,7 @@ public class MockJoinAccessor implements IJoinAccessor {
queryId = -1;
}
- public OseeConnection getConnection() {
+ public JdbcConnection getConnection() {
return connection;
}
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/TransactionJoinQueryTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/TransactionJoinQueryTest.java
index 73fc0c4ccf..3b2ef26f75 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/TransactionJoinQueryTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/sql/join/TransactionJoinQueryTest.java
@@ -11,8 +11,8 @@
package org.eclipse.osee.orcs.db.internal.sql.join;
import java.util.List;
-import org.eclipse.osee.framework.database.core.SQL3DataType;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.jdbc.SQL3DataType;
import org.junit.Assert;
import org.junit.Test;
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java
index 8350db194e..4b814942c4 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/transaction/TransactionWriterTest.java
@@ -22,10 +22,10 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
-import org.eclipse.osee.framework.database.IOseeDatabaseService;
-import org.eclipse.osee.framework.database.core.IOseeStatement;
-import org.eclipse.osee.framework.database.core.OseeConnection;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.jdbc.JdbcClient;
+import org.eclipse.osee.jdbc.JdbcConnection;
+import org.eclipse.osee.jdbc.JdbcStatement;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.core.ds.OrcsChangeSet;
import org.eclipse.osee.orcs.data.TransactionReadable;
@@ -63,11 +63,11 @@ public class TransactionWriterTest {
//@formatter:off
@Mock private Log logger;
- @Mock private IOseeDatabaseService dbService;
+ @Mock private JdbcClient jdbcClient;
@Mock private TxSqlBuilder builder;
- @Mock private OseeConnection connection;
+ @Mock private JdbcConnection connection;
@Mock private TransactionReadable tx;
@Mock private DaoToSql dao1;
@Mock private DaoToSql dao2;
@@ -75,7 +75,7 @@ public class TransactionWriterTest {
@Mock private IdJoinQuery join1;
@Mock private IdJoinQuery join2;
- @Mock private IOseeStatement chStmt;
+ @Mock private JdbcStatement chStmt;
@Captor private ArgumentCaptor<List<Object[]>> paramCaptor;
@Mock private OrcsChangeSet changeSet;
//@formatter:on
@@ -87,7 +87,7 @@ public class TransactionWriterTest {
public void setUp() throws OseeCoreException {
MockitoAnnotations.initMocks(this);
- writer = new TransactionWriter(logger, dbService, builder);
+ writer = new TransactionWriter(logger, jdbcClient, builder);
stores = Arrays.asList(dao1, dao2);
@@ -108,7 +108,7 @@ public class TransactionWriterTest {
return values;
}
});
- when(dbService.getStatement(connection)).thenReturn(chStmt);
+ when(jdbcClient.getStatement(connection)).thenReturn(chStmt);
when(chStmt.next()).thenReturn(true).thenReturn(true).thenReturn(false);
when(chStmt.getInt("transaction_id")).thenReturn(TX_1).thenReturn(TX_2);
@@ -134,7 +134,7 @@ public class TransactionWriterTest {
@Test
public void testWrite() throws OseeCoreException {
- InOrder inOrder = inOrder(builder, tx, join1, join2, dao1, dao2, dbService, chStmt);
+ InOrder inOrder = inOrder(builder, tx, join1, join2, dao1, dao2, jdbcClient, chStmt);
writer.write(connection, tx, changeSet);
@@ -159,7 +159,7 @@ public class TransactionWriterTest {
inOrder.verify(builder).getInsertData(SqlOrderEnum.TXS_DETAIL);
inOrder.verify(builder).getInsertData(SqlOrderEnum.TXS);
- inOrder.verify(dbService).runBatchUpdate(eq(connection), eq(TransactionWriter.UPDATE_TXS_NOT_CURRENT),
+ inOrder.verify(jdbcClient).runBatchUpdate(eq(connection), eq(TransactionWriter.UPDATE_TXS_NOT_CURRENT),
paramCaptor.capture());
inOrder.verify(builder).clear();

Back to the top