From 12007578f4faee4f61d7a80bff9f3a9f12a493bc Mon Sep 17 00:00:00 2001 From: Paul Brodner Date: Thu, 28 Mar 2019 12:53:13 +0000 Subject: [PATCH] search-1128: starting InsighEngine with SSL enabled --- .../insightEngine/jdbc/JDBCDriverTest.java | 54 +++++++++++++++++++ .../src/test/resources/default.properties | 9 +++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 e2e-test/src/test/java/org/alfresco/service/search/e2e/insightEngine/jdbc/JDBCDriverTest.java diff --git a/e2e-test/src/test/java/org/alfresco/service/search/e2e/insightEngine/jdbc/JDBCDriverTest.java b/e2e-test/src/test/java/org/alfresco/service/search/e2e/insightEngine/jdbc/JDBCDriverTest.java new file mode 100644 index 000000000..2919273af --- /dev/null +++ b/e2e-test/src/test/java/org/alfresco/service/search/e2e/insightEngine/jdbc/JDBCDriverTest.java @@ -0,0 +1,54 @@ +package org.alfresco.service.search.e2e.insightEngine.jdbc; + +import java.sql.SQLException; +import java.util.List; + +import org.alfresco.utility.network.ServerHealth; +import org.alfresco.utility.network.db.DatabaseOperationImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import static org.testng.Assert.*; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * This class is connecting via JDBC Driver (see default.properties) + * + * example: + * db.url= jdbc:alfresco://${alfresco.server}:${alfresco.port}?collection=alfresco + * + * I am using the TAS DatabaseOperationImpl service to connect + * + * @author Paul Brodner + * + */ +@ContextConfiguration("classpath:alfresco-search-e2e-context.xml") +public class JDBCDriverTest extends AbstractTestNGSpringContextTests { + + @Autowired + protected ServerHealth serverHealth; + + @Autowired + DatabaseOperationImpl jdbcOperation; + + @BeforeClass(alwaysRun = true) + public void checkServerHealth() throws Exception { + serverHealth.assertServerIsOnline(); + } + + /** + * In order to work start ACS + InsightEngine service + * @throws SQLException + */ + @Test + public void iCanConnectWithJDBCDriver() throws SQLException { + assertTrue(jdbcOperation.connect(), "I can connect via JDBC Driver"); + } + + @Test(dependsOnMethods="iCanConnectWithJDBCDriver") + public void iCanQueryTheTotalNumberOfDocumentsFromAlfresco() { + List results = jdbcOperation.executeQuery("select cm_name from alfresco where cm_Name = 'presentation*'"); + assertEquals(results.size(), 3); + } +} diff --git a/e2e-test/src/test/resources/default.properties b/e2e-test/src/test/resources/default.properties index 018c738e3..82e2c2e03 100644 --- a/e2e-test/src/test/resources/default.properties +++ b/e2e-test/src/test/resources/default.properties @@ -31,4 +31,11 @@ jmx.useJolokiaAgent=false # The location of the reports path reports.path=./target/reports -serverHealth.showTenants=false \ No newline at end of file +serverHealth.showTenants=false + +# JDBC Connection Strings +# for SSL use alfresco.port.jdbc=7070 (see docker-compose.ssl.yml) +alfresco.port.jdbc=${alfresco.port} +db.url = jdbc:alfresco://${alfresco.server}:${alfresco.port.jdbc}?collection=alfresco +db.username = ${admin.user} +db.password = ${admin.password} \ No newline at end of file