Skip to content

Commit

Permalink
Release 1.3.0. Updated to newest julielab parent pom and Java 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
khituras committed Mar 28, 2019
1 parent 548473e commit 3a5d98b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
12 changes: 4 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>costosys</artifactId>
<version>1.2.5-SNAPSHOT</version>
<version>1.3.0</version>
<name>Corpus Storage System</name>
<description>A utility for managing documents stored in a PostgreSQL database. The documents are imported into a
PostgreSQL DB as full texts with the goal to be able to retrieve the documents by their PubMedID efficiently.
Expand All @@ -13,8 +13,6 @@
<build>
<plugins>
<plugin>
<!-- NOTE: We don't need a groupId specification because the group is
org.apache.maven.plugins ...which is assumed by default. -->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
Expand All @@ -26,14 +24,12 @@
<mainClass>de.julielab.xmlData.cli.CLI</mainClass>
</manifest>
</archive>
<!-- <appendAssemblyId>false</appendAssemblyId> -->
<!-- <finalName>medline-manager</finalName> -->
</configuration>
<executions>
<execution>
<phase>package</phase> <!-- append to the packaging phase. -->
<phase>package</phase>
<goals>
<goal>single</goal> <!-- goals == mojos -->
<goal>single</goal>
</goals>
</execution>
</executions>
Expand Down Expand Up @@ -182,7 +178,7 @@
<parent>
<groupId>de.julielab</groupId>
<artifactId>julielab-parent</artifactId>
<version>2.2.0</version>
<version>2.4.0</version>
</parent>
<organization>
<name>JULIE Lab, Germany</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/julielab/xmlData/cli/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static void logMessage(String msg) {
LOG.info(msg);
}

public static void main(String[] args) throws SQLException, TableSchemaMismatchException, ConfigurationNotFoundException, ConfigurationException, IOException, MedlineUpdateException {
public static void main(String[] args) throws Exception {
long time = System.currentTimeMillis();
String dbUrl;
String user;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public FieldConfig getActiveTableFieldConfiguration() {
* @param pid - will be saved in the subset table
* @return An ArrayList of pmids which have not yet been processed
*/
public List<Object[]> retrieveAndMark(String subsetTableName, String readerComponent, String hostName, String pid) throws TableSchemaMismatchException {
public List<Object[]> retrieveAndMark(String subsetTableName, String readerComponent, String hostName, String pid) throws TableSchemaMismatchException, TableNotFoundException {
return retrieveAndMark(subsetTableName, readerComponent, hostName, pid, RETRIEVE_MARK_LIMIT, null);
}

Expand All @@ -530,7 +530,7 @@ public List<Object[]> retrieveAndMark(String subsetTableName, String readerCompo
* @see #retrieveAndMark(String, String, String, String, int, String)
*/
public List<Object[]> retrieveAndMark(String subsetTableName, String readerComponent, String hostName, String pid,
int limit, String order) throws TableSchemaMismatchException {
int limit, String order) throws TableSchemaMismatchException, TableNotFoundException {
return retrieveAndMark(subsetTableName, activeTableSchema, readerComponent, hostName, pid, limit, order);
}

Expand Down Expand Up @@ -566,7 +566,7 @@ public List<Object[]> retrieveAndMark(String subsetTableName, String readerCompo
* @return An ArrayList of primary keys which have not yet been processed.
*/
public List<Object[]> retrieveAndMark(String subsetTableName, String schemaName, String readerComponent,
String hostName, String pid, int limit, String order) throws TableSchemaMismatchException {
String hostName, String pid, int limit, String order) throws TableSchemaMismatchException, TableNotFoundException {
checkTableDefinition(subsetTableName, schemaName);
List<Object[]> ids = new ArrayList<>(limit);
String sql = null;
Expand Down Expand Up @@ -3392,7 +3392,7 @@ public FieldConfig getFieldConfiguration(String schemaName) {
* @param tableName The table to check.
* @see #checkTableDefinition(String, String)
*/
public void checkTableDefinition(String tableName) throws TableSchemaMismatchException {
public void checkTableDefinition(String tableName) throws TableSchemaMismatchException, TableNotFoundException {
checkTableDefinition(tableName, activeTableSchema);
}

Expand All @@ -3409,10 +3409,10 @@ public void checkTableDefinition(String tableName) throws TableSchemaMismatchExc
*
* @param tableName - table to check
*/
public void checkTableDefinition(String tableName, String schemaName) throws TableSchemaMismatchException {
public void checkTableDefinition(String tableName, String schemaName) throws TableSchemaMismatchException, TableNotFoundException {
try (CoStoSysConnection connection = obtainOrReserveConnection()) {
if (!tableExists(tableName))
throw new IllegalArgumentException("The table '" + tableName + "' does not exist.");
throw new TableNotFoundException("The table '" + tableName + "' does not exist.");
FieldConfig fieldConfig = fieldConfigs.get(schemaName);

List<String> actualColumns = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,32 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.testng.AssertJUnit.assertEquals;
import static org.assertj.core.api.Assertions.*;

public class DataBaseConnectorTest {

public static PostgreSQLContainer postgres;
private static DataBaseConnector dbc;

@BeforeClass
public static void setup(){
postgres = new PostgreSQLContainer();
public static void setup() {
postgres = new PostgreSQLContainer();
postgres.start();
dbc = new DataBaseConnector(postgres.getJdbcUrl(), postgres.getUsername(), postgres.getPassword());
dbc.setActiveTableSchema("medline_2016");
}

@AfterClass
public static void shutdown(){
postgres.stop();dbc.close();
public static void shutdown() {
postgres.stop();
dbc.close();
}


Expand All @@ -45,11 +46,12 @@ public void testQueryAndExecution() {
e.printStackTrace();
}
});
boolean exists = dbc.withConnectionQueryBoolean(dbc -> dbc.tableExists("mytable"));
boolean exists = dbc.withConnectionQueryBoolean(dbc -> dbc.tableExists("mytable"));
assertThat(exists).isTrue();
}

@Test
public void testRetrieveAndMark() throws SQLException, TableSchemaMismatchException {
public void testRetrieveAndMark() throws Exception {
dbc.reserveConnection();
dbc.createTable(Constants.DEFAULT_DATA_TABLE_NAME, "Test data table");
dbc.importFromXMLFile("src/test/resources/documents/documentSet.xml.gz", Constants.DEFAULT_DATA_TABLE_NAME);
Expand Down Expand Up @@ -83,7 +85,7 @@ public void testStatus() throws SQLException, TableSchemaMismatchException, Tabl

@Test(dependsOnMethods = "testRetrieveAndMark")
public void testRandomSubset() throws SQLException {
try(CoStoSysConnection conn = dbc.reserveConnection()) {
try (CoStoSysConnection conn = dbc.reserveConnection()) {
dbc.createSubsetTable("randomsubset", Constants.DEFAULT_DATA_TABLE_NAME, "Random Test Subset");
dbc.initRandomSubset(10, "randomsubset", Constants.DEFAULT_DATA_TABLE_NAME);
ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM randomsubset");
Expand Down Expand Up @@ -112,8 +114,8 @@ public void testQuerySubset() throws SQLException {
}

@Test
public void testXmlData() throws UnsupportedEncodingException {
dbc.withConnectionExecute(c -> c.createTable("myxmltest", "xmi_text","XML Test Table"));
public void testXmlData() throws UnsupportedEncodingException {
dbc.withConnectionExecute(c -> c.createTable("myxmltest", "xmi_text", "XML Test Table"));
Map<String, Object> row = new HashMap<>();
row.put("docid", "doc1");
row.put("xmi", "some nonsense");
Expand Down

0 comments on commit 3a5d98b

Please sign in to comment.