Commit b2bd4950 authored by LAVENIER's avatar LAVENIER
Browse files

Merge branch 'develop' into feature/imagine

parents 9bfd1b85 92ed6f32
......@@ -79,7 +79,7 @@ public class LocationServiceWriteTest extends AbstractServiceTest{
// Check label with a position inside the Mediterranean sea
locationId = service.getLocationIdByLatLong(42.27f, 5.4f);
assertNotNull("Location Id could not found in Allegro DB, in the Mediterranean Sea. Bad enumeration value for RECTANGLE_STATISTIQUE_MED ?", locationId);
assertEquals(new Integer(8550), locationId); // =id of location 'M24C2'
assertEquals(new Integer(8545), locationId); // =id of location 'M24C2'
}
protected void printLocationPorts(PrintStream out, String indentation) {
......
......@@ -2,15 +2,15 @@
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.hikari.connectionTestQuery=SELECT 1 FROM STATUS WHERE ID=1
spring.datasource.hikari.initializationFailTimeout=-1
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.database-platform=org.hibernate.spatial.dialect.postgis.PostgisDialect
spring.jpa.properties.hibernate.dialect=org.hibernate.spatial.dialect.postgis.PostgisDialect
# Database connection
spring.datasource.platform=oracle
spring.datasource.username=<USERNAME>
spring.datasource.password=
spring.datasource.platform=pgsql
spring.datasource.username=sumaris
spring.datasource.password=sumaris
spring.jpa.properties.hibernate.default_catalog=${spring.datasource.username}
spring.jpa.properties.hibernate.default_schema=public
spring.datasource.url=jdbc:postgresql://localhost:5432/sumaristest
spring.datasource.url=jdbc:postgresql://localhost:5432/sumaris
......@@ -395,7 +395,7 @@ public class DataGraphQLService {
@GraphQLMutation(name = "deleteTrips", description = "Delete many trips")
@IsUser
public void deleteTrips(@GraphQLNonNull @GraphQLArgument(name = "ids") List<Integer> ids) {
tripService.asyncDelete(ids);
tripService.delete(ids);
}
@GraphQLSubscription(name = "updateTrip", description = "Subscribe to changes on a trip")
......
......@@ -103,7 +103,7 @@ public class TaxonNameGraphQLService {
@GraphQLQuery(name = "taxonNameCount", description = "Get taxon name count")
@Transactional(readOnly = true)
public Long getTaxonNameCount(@GraphQLArgument(name = "filter") TaxonNameFilterVO filter) {
return referentialService.countByFilter(Program.class.getSimpleName(), filter);
return taxonNameService.countByFilter(filter);
}
/* -- Mutations -- */
......
......@@ -99,10 +99,10 @@ public class ChangesPublisherServiceImpl implements ChangesPublisherService {
.orElse(null);
if (newUpdateDate != null && lastUpdateDate.getTime().before(newUpdateDate)) {
lastUpdateDate.setTime(newUpdateDate);
return Observable.just(entities);
return Observable.<L>just(entities);
}
}
return Observable.empty();
return Observable.<L>empty();
});
// Sending the initial value when starting
......@@ -153,9 +153,9 @@ public class ChangesPublisherServiceImpl implements ChangesPublisherService {
// Update the date used for comparision
if (entity != null && lastUpdateDate.getTime().before(entity.getUpdateDate())) {
lastUpdateDate.setTime(entity.getUpdateDate());
return Observable.just(entity);
return Observable.<V>just(entity);
}
return Observable.empty();
return Observable.<V>empty();
});
// Sending the initial value when starting
......
......@@ -24,6 +24,7 @@ package net.sumaris.core.test;
import com.google.common.base.Charsets;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import lombok.extern.slf4j.Slf4j;
import net.sumaris.core.config.SumarisConfiguration;
......@@ -45,6 +46,7 @@ import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory;
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.junit.Assume;
import org.junit.rules.ExternalResource;
......@@ -56,6 +58,7 @@ import java.io.IOException;
import java.net.URL;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Properties;
/**
......@@ -66,6 +69,7 @@ public class InitTests extends ExternalResource {
private static final String DATASET_COMMON_XML_FILE = "sumaris.test.data.common";
private static final String DATASET_ADDITIONAL_XML_FILES = "sumaris.test.data.additional";
private static final String DEFAULT_DATASOURCE_PLATFORM = "hsqldb";
/**
* Main method is used by clients projects, to generate and deploy a test DB
......@@ -106,8 +110,17 @@ public class InitTests extends ExternalResource {
}
}
public InitTests() {
}
public InitTests(String datasourcePlatform) {
this.datasourcePlatform = datasourcePlatform;
}
protected SumarisConfiguration config;
protected String datasourcePlatform = DEFAULT_DATASOURCE_PLATFORM;
private String targetDbDirectory = null;
private boolean replaceDbIfExists = false;
......@@ -130,6 +143,10 @@ public class InitTests extends ExternalResource {
return replaceDbIfExists;
}
public String getDatasourcePlatform() { return datasourcePlatform; }
public void setDatasourcePlatform(String datasourcePlatform) { this.datasourcePlatform = datasourcePlatform; }
protected String getDbEnumerationResource() {
return "classpath*:sumaris-db-enumerations.properties";
}
......@@ -139,11 +156,17 @@ public class InitTests extends ExternalResource {
}
protected String[] getConfigArgs() {
return new String[]{
List<String> configArgs = Lists.newArrayList();
configArgs.addAll(Lists.newArrayList(
"--option", SumarisConfigurationOption.DB_DIRECTORY.getKey(), getTargetDbDirectory(),
"--option", SumarisConfigurationOption.JDBC_URL.getKey(), SumarisConfigurationOption.JDBC_URL.getDefaultValue(),
"--option", SumarisConfigurationOption.SEQUENCE_START_WITH.getKey(), String.valueOf(1000)
};
"--option", SumarisConfigurationOption.SEQUENCE_START_WITH.getKey(), String.valueOf(1000)));
if (getDatasourcePlatform().equals(DEFAULT_DATASOURCE_PLATFORM)) {
configArgs.addAll(Lists.newArrayList("--option", SumarisConfigurationOption.JDBC_URL.getKey(), SumarisConfigurationOption.JDBC_URL.getDefaultValue()));
}
return configArgs.toArray(new String[configArgs.size()]);
}
protected void initServiceLocator() {
......@@ -383,6 +406,10 @@ public class InitTests extends ExternalResource {
dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory());
dbUnitConnection.getConfig().setProperty(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES, Boolean.TRUE);
}
else if (Daos.isPostgresqlDatabase(config.getJdbcURL())){
dbUnitConnection = new DatabaseConnection(jdbcConnection);
dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
}
else {
throw new SumarisTechnicalException("Unable to create DBUnit connection: Unknown DB type for URL [" + config.getJdbcURL() + "]");
}
......
......@@ -794,7 +794,7 @@
<PARAMETER ID="80" LABEL="SEX" NAME="Sex" IS_QUALITATIVE="1" IS_ALPHANUMERIC="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="81" LABEL="LENGTH_TOTAL" NAME="Longueur totale (LT)" IS_QUALITATIVE="0" IS_ALPHANUMERIC="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="82" LABEL="TAG_ID" NAME="Tag-ID" IS_QUALITATIVE="0" IS_ALPHANUMERIC="1" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="82" LABEL="TAG_ID" NAME="Code prélèvement" IS_QUALITATIVE="0" IS_ALPHANUMERIC="1" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="83" LABEL="MONITORING_BOX_ID" NAME="Monitoring box-ID" IS_QUALITATIVE="0" IS_ALPHANUMERIC="1" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
<PARAMETER ID="84" LABEL="LENGTH_CARAPACE" NAME="Longueur céphalothoracique (LC)" IS_QUALITATIVE="0" IS_ALPHANUMERIC="0" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
......
......@@ -40,6 +40,6 @@
<PROGRAM ID="20" LABEL="SIMM-PoC" NAME="Système d'Information Millieu Marin - PoC" DESCRIPTION="Système d'Information Millieu Marin - PoC" STATUS_FK="1" CREATION_DATE="2020-03-19" UPDATE_DATE="2020-03-19" GEAR_CLASSIFICATION_FK="1" TAXON_GROUP_TYPE_FK="2"/>
<!-- strategies -->
<!-- <STRATEGY ID="" PROGRAM_FK="20" LABEL="V1" NAME="version 1 - 2019-02-15" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>-->
<STRATEGY ID="32" PROGRAM_FK="20" LABEL="V1" NAME="version 1 - 2019-02-15" STATUS_FK="1" CREATION_DATE="2018-03-08" UPDATE_DATE="2018-03-08"/>
</dataset>
\ No newline at end of file
</dataset>
......@@ -349,4 +349,4 @@
<SAMPLE_MEASUREMENT ID="91" SAMPLE_FK="55" RECORDER_DEPARTMENT_FK="2" PMFM_FK="356" RANK_ORDER="2" UPDATE_DATE="2018-03-08" QUALITY_FLAG_FK="0" NUMERICAL_VALUE="28"/>
<!-- taille -->
<SAMPLE_MEASUREMENT ID="92" SAMPLE_FK="55" RECORDER_DEPARTMENT_FK="2" PMFM_FK="84" RANK_ORDER="3" UPDATE_DATE="2018-03-08" QUALITY_FLAG_FK="0" NUMERICAL_VALUE="75"/>
</dataset>
\ No newline at end of file
</dataset>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment