Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hsqldb 2.7.1 #6691

Draft
wants to merge 2 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import javax.persistence.Query;

import org.apache.commons.lang3.tuple.Pair;
import org.dbunit.dataset.DataSetException;
import org.joda.time.LocalDateTime;
import org.junit.AfterClass;
import org.junit.Before;
Expand Down Expand Up @@ -119,7 +118,7 @@ public void testFindAll() {
@Test
@Rollback(true)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testInsert() throws DataSetException {
public void testInsert() {
String newOrcid = "4444-1111-6666-4441";
ProfileEntity profile = new ProfileEntity();
profile.setId(newOrcid);
Expand All @@ -144,7 +143,7 @@ public void testInsert() throws DataSetException {
@Test
@Rollback(true)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testInsertWithPrimaryInstitutions() throws DataSetException {
public void testInsertWithPrimaryInstitutions() {
String newOrcid = "4444-1111-6666-4442";
ProfileEntity profile = new ProfileEntity();
profile.setId(newOrcid);
Expand All @@ -168,7 +167,7 @@ public void testInsertWithPrimaryInstitutions() throws DataSetException {
@Test
@Rollback(true)
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void testInsertWithInstitutionDepartments() throws DataSetException {
public void testInsertWithInstitutionDepartments() {
String newOrcid = "4444-1111-6666-4443";
ProfileEntity profile = new ProfileEntity();
profile.setId(newOrcid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
public class CustomDataTypeFactory extends HsqldbDataTypeFactory {

private static final JsonDatatype JSON_DATATYPE = new JsonDatatype();
private static final TimestampWithTimezoneDataType TIMESTAMP_WITH_TIMEZONE_DATATYPE = new TimestampWithTimezoneDataType();

@Override
public DataType createDataType(int sqlType, String sqlTypeName) throws DataTypeException {
if ("json".equals(sqlTypeName)) {
return JSON_DATATYPE;
} else if ("TIMESTAMP WITH TIME ZONE".equals(sqlTypeName)) {
return TIMESTAMP_WITH_TIMEZONE_DATATYPE;
}
DataType dt = super.createDataType(sqlType, sqlTypeName);
return dt;
Expand Down
5 changes: 3 additions & 2 deletions orcid-test/src/main/java/org/orcid/test/DBUnitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public static void initDBUnitData(List<String> flatXMLDataFiles) throws Exceptio
cleanClientSourcedProfiles(connection);
cleanAll(connection);
for (String flatXMLDataFile : flatXMLDataFiles) {
System.out.println(flatXMLDataFile);
DatabaseOperation.INSERT.execute(connection, getDataSet(flatXMLDataFile));
}
connection.close();
Expand Down Expand Up @@ -144,8 +145,8 @@ private static void cleanClientSourcedProfiles(IDatabaseConnection connection) t
dataSet.addTable("research_resource");
dataSet.addTable("find_my_stuff_history");
dataSet.addTable("spam");
DatabaseOperation.DELETE.execute(connection, dataSet);

DatabaseOperation.DELETE.execute(connection, dataSet);
QueryDataSet theRest = new QueryDataSet(connection);
theRest.addTable("profile", "SELECT * FROM profile WHERE source_id IS NOT NULL AND source_id != orcid ORDER BY orcid DESC");
theRest.addTable("client_details");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.orcid.test;

import java.sql.Timestamp;
import java.sql.Types;

import org.dbunit.dataset.ITable;
import org.dbunit.dataset.datatype.AbstractDataType;
import org.dbunit.dataset.datatype.TypeCastException;

public class TimestampWithTimezoneDataType extends AbstractDataType {

public TimestampWithTimezoneDataType(String name, int sqlType, Class<?> classType, boolean isNumber) {
super(name, sqlType, classType, isNumber);
}

public TimestampWithTimezoneDataType() {
super("TIMESTAMP WITH TIME ZONE", Types.TIMESTAMP_WITH_TIMEZONE, String.class, false);
}

@Override
public Object typeCast(Object value) throws TypeCastException {
if (value == null || value == ITable.NO_VALUE) {
return null;
}
System.out.println((String) value);
return Timestamp.valueOf((String) value);
}

}
34 changes: 17 additions & 17 deletions orcid-test/src/main/resources/data/ClientDetailsEntityData.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version='1.0' encoding='UTF-8'?>
<dataset>

<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4441" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="S. Milligan" client_description="Terence Alan Patrick Seán 'Spike' Milligan KBE (16 April 1918 – 27 February 2002) was a comedian, writer, musician, poet, playwright, soldier and actor." client_website="www.4444-4444-4444-4441.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4442" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="T. Edison" client_description="" client_website="www.4444-4444-4444-4442.com" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4443" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="P. Sellers III" client_description="Richard Henry Sellers, CBE (8 September 1925 – 24 July 1980), known as Peter Sellers, was a British film actor, comedian and singer." client_website="www.4444-4444-4444-4443.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4444" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="H. Secombe" client_description="Sir Harry Donald Secombe, CBE (8 September 1921 – 11 April 2001) was a Welsh entertainer with a talent for comedy and a noted fine tenor singing voice." client_website="www.4444-4444-4444-4444.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4445" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="A. Timothy" client_description="Andrew Timothy (1912–9 December 1990) was an Anglican priest and BBC Radio announcer, who is best remembered for being the original announcer of the comedy series The Goon Show." client_website="www.4444-4444-4444-4445.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4498" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2014-07-14" last_modified="2014-07-14" client_name="U. Test" client_description="Client used to test the public OAuth process." client_website="www.4444-4444-4444-4498.com" persistent_tokens_enabled="false" group_orcid="4444-4444-4444-4441" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-6666666666666666" date_created="2012-04-25" last_modified="2012-04-25" client_name="Source Client 2" client_description="A test source client" client_website="www.6666666666666666.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-1234567898765432" date_created="2019-05-13" last_modified="2019-05-13" client_name="ORCID source" client_description="ORCID source for issn record" client_website="orcid.org" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4441" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="S. Milligan" client_description="Terence Alan Patrick Seán 'Spike' Milligan KBE (16 April 1918 – 27 February 2002) was a comedian, writer, musician, poet, playwright, soldier and actor." client_website="www.4444-4444-4444-4441.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4442" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="T. Edison" client_description="" client_website="www.4444-4444-4444-4442.com" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4443" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="P. Sellers III" client_description="Richard Henry Sellers, CBE (8 September 1925 – 24 July 1980), known as Peter Sellers, was a British film actor, comedian and singer." client_website="www.4444-4444-4444-4443.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4444" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="H. Secombe" client_description="Sir Harry Donald Secombe, CBE (8 September 1921 – 11 April 2001) was a Welsh entertainer with a talent for comedy and a noted fine tenor singing voice." client_website="www.4444-4444-4444-4444.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="false"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4445" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="A. Timothy" client_description="Andrew Timothy (1912–9 December 1990) was an Anglican priest and BBC Radio announcer, who is best remembered for being the original announcer of the comedy series The Goon Show." client_website="www.4444-4444-4444-4445.com" group_orcid="4444-4444-4444-4441" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="4444-4444-4444-4498" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2014-07-14 00:00:00.00" last_modified="2014-07-14 00:00:00.00" client_name="U. Test" client_description="Client used to test the public OAuth process." client_website="www.4444-4444-4444-4498.com" persistent_tokens_enabled="false" group_orcid="4444-4444-4444-4441" />
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-6666666666666666" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="Source Client 2" client_description="A test source client" client_website="www.6666666666666666.com" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-1234567898765432" date_created="2019-05-13 00:00:00.00" last_modified="2019-05-13 00:00:00.00" client_name="ORCID source" client_description="ORCID source for issn record" client_website="orcid.org" group_orcid="5555-5555-5555-5558" persistent_tokens_enabled="true"/>

<client_authorised_grant_type client_details_id="APP-6666666666666666" grant_type="authorization_code" />
<client_authorised_grant_type client_details_id="APP-6666666666666666" grant_type="client_credentials" />
Expand Down Expand Up @@ -104,14 +104,14 @@
<client_scope client_details_id="APP-6666666666666666" scope_type="/read-public"/>
<client_scope client_details_id="APP-6666666666666666" scope_type="/orcid-profile/create"/>

<client_secret client_details_id="4444-4444-4444-4441" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="4444-4444-4444-4442" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="4444-4444-4444-4443" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="4444-4444-4444-4444" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="4444-4444-4444-4445" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="4444-4444-4444-4498" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="APP-6666666666666666" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="APP-1234567898765432" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<custom_email client_details_id="4444-4444-4444-4441" email_type="CLAIM" content="This is the content" sender="[email protected]" subject="This is the subject" is_html="true" />
<client_secret client_details_id="4444-4444-4444-4441" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="4444-4444-4444-4442" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="4444-4444-4444-4443" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="4444-4444-4444-4444" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="4444-4444-4444-4445" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="4444-4444-4444-4498" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="APP-6666666666666666" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="APP-1234567898765432" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<custom_email client_details_id="4444-4444-4444-4441" email_type="CLAIM" content="This is the content" sender="[email protected]" subject="This is the subject" is_html="true" />

</dataset>
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
source_id="5555-5555-5555-0000"
/>

<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-0000000000000001" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="Client # 1" client_description="Client # 1 description." client_website="http://www.google.com/APP-0000000000000001" group_orcid="5555-5555-5555-0000" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-0000000000000002" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="Client # 2" client_description="Client # 2 description." client_website="http://www.google.com/APP-0000000000000002" group_orcid="5555-5555-5555-0000" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-0000000000000003" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25" client_name="Client # 3" client_description="Client # 3 description." client_website="http://www.google.com/APP-0000000000000003" group_orcid="5555-5555-5555-0000" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-0000000000000001" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="Client # 1" client_description="Client # 1 description." client_website="http://www.google.com/APP-0000000000000001" group_orcid="5555-5555-5555-0000" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-0000000000000002" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="Client # 2" client_description="Client # 2 description." client_website="http://www.google.com/APP-0000000000000002" group_orcid="5555-5555-5555-0000" persistent_tokens_enabled="true"/>
<client_details client_type="PREMIUM_CREATOR" client_details_id="APP-0000000000000003" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00" client_name="Client # 3" client_description="Client # 3 description." client_website="http://www.google.com/APP-0000000000000003" group_orcid="5555-5555-5555-0000" persistent_tokens_enabled="true"/>

<client_authorised_grant_type client_details_id="APP-0000000000000001" grant_type="authorization_code" />
<client_authorised_grant_type client_details_id="APP-0000000000000001" grant_type="refresh_token" />
Expand Down Expand Up @@ -124,7 +124,7 @@
<client_scope client_details_id="APP-0000000000000003" scope_type="/read-public"/>
<client_scope client_details_id="APP-0000000000000003" scope_type="/webhook"/>

<client_secret client_details_id="APP-0000000000000001" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="APP-0000000000000002" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="APP-0000000000000003" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25" last_modified="2012-04-25"/>
<client_secret client_details_id="APP-0000000000000001" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="APP-0000000000000002" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
<client_secret client_details_id="APP-0000000000000003" client_secret="DhkFj5EI0qp6GsUKi55Vja+h+bsaKpBx" date_created="2012-04-25 00:00:00.00" last_modified="2012-04-25 00:00:00.00"/>
</dataset>
Loading