From 9461be96890c776e2d40a25b001d4f60f3719f59 Mon Sep 17 00:00:00 2001 From: jmedinaebi Date: Mon, 31 Oct 2022 12:48:12 +0000 Subject: [PATCH] Update dependencies --- .travis.yml | 2 +- feature-shortlabel-generator/pom.xml | 2 +- pom.xml | 4 +- protein-mapping/pom.xml | 8 +- .../protein/mapping/IntactBasicTestCase.java | 95 +++++++++++++++++++ .../FeatureRangeCheckingProcessTest.java | 6 +- .../actions/IntactCrc64SearchProcessTest.java | 4 +- .../actions/IntactNameSearchProcessTest.java | 4 +- .../SwissprotRemappingProcessTest.java | 18 ++-- .../strategies/StrategyWithSequenceTest.java | 4 +- .../update/proteinUpdateManagerTest.java | 2 +- .../resources/META-INF/jpa.test.spring.xml | 76 +++++++++++++-- 12 files changed, 182 insertions(+), 43 deletions(-) create mode 100644 protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/IntactBasicTestCase.java diff --git a/.travis.yml b/.travis.yml index 9f88225..ad1015d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: java sudo: false jdk: - - oraclejdk8 + - oraclejdk11 script: mvn test \ No newline at end of file diff --git a/feature-shortlabel-generator/pom.xml b/feature-shortlabel-generator/pom.xml index 1977b21..112593b 100644 --- a/feature-shortlabel-generator/pom.xml +++ b/feature-shortlabel-generator/pom.xml @@ -58,7 +58,7 @@ org.hibernate.javax.persistence hibernate-jpa-2.1-api - 1.0.0.Final + ${hibernate.jpa.version} diff --git a/pom.xml b/pom.xml index a3cde50..bb7aa35 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ uk.ac.ebi.intact.maven intact-hibernate-master - 45-SNAPSHOT + 46-SNAPSHOT 4.0.0 @@ -20,7 +20,7 @@ ${project.version} 4.3.30.RELEASE 3.3.0-SNAPSHOT - 1.4.0-SNAPSHOT + 2.1.0-SNAPSHOT 2.2.0-SNAPSHOT 2.7.0-SNAPSHOT true diff --git a/protein-mapping/pom.xml b/protein-mapping/pom.xml index d87d606..7eee064 100644 --- a/protein-mapping/pom.xml +++ b/protein-mapping/pom.xml @@ -174,13 +174,7 @@ com.h2database h2 - 1.4.200 - - - - hsqldb - hsqldb - 1.8.0.10 + ${h2.version} test diff --git a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/IntactBasicTestCase.java b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/IntactBasicTestCase.java new file mode 100644 index 0000000..505708e --- /dev/null +++ b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/IntactBasicTestCase.java @@ -0,0 +1,95 @@ +/* + * Copyright 2001-2007 The European Bioinformatics Institute. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package uk.ac.ebi.intact.protein.mapping; + +import org.junit.After; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; +import uk.ac.ebi.intact.core.context.DataContext; +import uk.ac.ebi.intact.core.context.IntactContext; +import uk.ac.ebi.intact.core.persistence.dao.DaoFactory; +import uk.ac.ebi.intact.core.persister.CoreDeleter; +import uk.ac.ebi.intact.core.persister.CorePersister; +import uk.ac.ebi.intact.core.persister.PersisterHelper; +import uk.ac.ebi.intact.core.unit.IntactMockBuilder; + +/** + * Base for all intact-tests. + * + * @author Bruno Aranda (baranda@ebi.ac.uk) + * @version $Id$ + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { "classpath*:/META-INF/jpa.test.spring.xml" }) +@Transactional("transactionManager") +@DirtiesContext +public abstract class IntactBasicTestCase { + + @Autowired + private ApplicationContext applicationContext; + + private IntactMockBuilder mockBuilder; + + @Before + public void prepareBasicTest() throws Exception { + mockBuilder = new IntactMockBuilder(getIntactContext().getConfig().getDefaultInstitution()); + } + + @After + public void afterBasicTest() throws Exception { + mockBuilder = null; + } + + protected IntactContext getIntactContext() { + return (IntactContext) applicationContext.getBean("intactContext"); + } + + protected DataContext getDataContext() { + return getIntactContext().getDataContext(); + } + + protected DaoFactory getDaoFactory() { + return getDataContext().getDaoFactory(); + } + + protected IntactMockBuilder getMockBuilder() { + return mockBuilder; + } + + public ConfigurableApplicationContext getSpringContext() { + return (ConfigurableApplicationContext) applicationContext; + } + + @Deprecated + public PersisterHelper getPersisterHelper() { + return getIntactContext().getPersisterHelper(); + } + + public CorePersister getCorePersister() { + return getIntactContext().getCorePersister(); + } + + public CoreDeleter getCoreDeleter() { + return getIntactContext().getCoreDeleter(); + } +} \ No newline at end of file diff --git a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/FeatureRangeCheckingProcessTest.java b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/FeatureRangeCheckingProcessTest.java index 70e985d..f06412d 100644 --- a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/FeatureRangeCheckingProcessTest.java +++ b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/FeatureRangeCheckingProcessTest.java @@ -3,14 +3,13 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.springframework.test.context.ContextConfiguration; import org.springframework.transaction.TransactionStatus; import uk.ac.ebi.intact.bridges.ncbiblast.model.BlastProtein; import uk.ac.ebi.intact.commons.util.Crc64; import uk.ac.ebi.intact.core.context.DataContext; import uk.ac.ebi.intact.core.context.IntactContext; -import uk.ac.ebi.intact.core.unit.IntactBasicTestCase; import uk.ac.ebi.intact.model.*; +import uk.ac.ebi.intact.protein.mapping.IntactBasicTestCase; import uk.ac.ebi.intact.protein.mapping.actions.exception.ActionProcessingException; import uk.ac.ebi.intact.protein.mapping.factories.impl.DefaultReportsFactory; import uk.ac.ebi.intact.protein.mapping.model.actionReport.MappingReport; @@ -27,8 +26,7 @@ * @version $Id$ * @since
17-May-2010
*/ -@ContextConfiguration(locations = {"classpath*:/META-INF/jpa.test.spring.xml"}) -public class FeatureRangeCheckingProcessTest extends IntactBasicTestCase{ +public class FeatureRangeCheckingProcessTest extends IntactBasicTestCase { private FeatureRangeCheckingProcess process; private UpdateContext context; diff --git a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactCrc64SearchProcessTest.java b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactCrc64SearchProcessTest.java index 46517e2..72246aa 100644 --- a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactCrc64SearchProcessTest.java +++ b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactCrc64SearchProcessTest.java @@ -3,12 +3,11 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.springframework.test.context.ContextConfiguration; import uk.ac.ebi.intact.commons.util.Crc64; import uk.ac.ebi.intact.core.context.IntactContext; -import uk.ac.ebi.intact.core.unit.IntactBasicTestCase; import uk.ac.ebi.intact.model.BioSource; import uk.ac.ebi.intact.model.Protein; +import uk.ac.ebi.intact.protein.mapping.IntactBasicTestCase; import uk.ac.ebi.intact.protein.mapping.actions.exception.ActionProcessingException; import uk.ac.ebi.intact.protein.mapping.factories.impl.DefaultReportsFactory; import uk.ac.ebi.intact.protein.mapping.model.actionReport.MappingReport; @@ -24,7 +23,6 @@ * @version $Id$ * @since
08-Apr-2010
*/ -@ContextConfiguration(locations = {"classpath*:/META-INF/jpa.test.spring.xml"}) public class IntactCrc64SearchProcessTest extends IntactBasicTestCase { private IntactCrc64SearchProcess process; diff --git a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactNameSearchProcessTest.java b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactNameSearchProcessTest.java index 68db467..3167dce 100644 --- a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactNameSearchProcessTest.java +++ b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/IntactNameSearchProcessTest.java @@ -3,11 +3,10 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.springframework.test.context.ContextConfiguration; import uk.ac.ebi.intact.core.context.IntactContext; -import uk.ac.ebi.intact.core.unit.IntactBasicTestCase; import uk.ac.ebi.intact.model.BioSource; import uk.ac.ebi.intact.model.Protein; +import uk.ac.ebi.intact.protein.mapping.IntactBasicTestCase; import uk.ac.ebi.intact.protein.mapping.actions.exception.ActionProcessingException; import uk.ac.ebi.intact.protein.mapping.factories.impl.DefaultReportsFactory; import uk.ac.ebi.intact.protein.mapping.model.actionReport.MappingReport; @@ -23,7 +22,6 @@ * @version $Id$ * @since
28-Apr-2010
*/ -@ContextConfiguration(locations = {"classpath*:/META-INF/jpa.test.spring.xml"}) public class IntactNameSearchProcessTest extends IntactBasicTestCase { private IntactNameSearchProcess process; diff --git a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/SwissprotRemappingProcessTest.java b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/SwissprotRemappingProcessTest.java index f513304..4e3847a 100644 --- a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/SwissprotRemappingProcessTest.java +++ b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/actions/SwissprotRemappingProcessTest.java @@ -22,8 +22,8 @@ public class SwissprotRemappingProcessTest { - private SwissprotRemappingProcess process; - private BlastContext context; + private final SwissprotRemappingProcess process; + private final BlastContext context; public SwissprotRemappingProcessTest(){ this.process = new SwissprotRemappingProcess(new DefaultReportsFactory()); @@ -67,7 +67,7 @@ public void test_SwissprotRemapping_failed(){ System.out.println(reports.get(1).getStatus().getLabel() + " " + reports.get(1).getStatus().getDescription()); Assert.assertNull(ac); - Assert.assertEquals(true, reports.get(1) instanceof DefaultBlastReport); + Assert.assertTrue(reports.get(1) instanceof DefaultBlastReport); Assert.assertEquals(StatusLabel.FAILED, reports.get(1).getStatusLabel()); } catch (ActionProcessingException e) { @@ -103,7 +103,7 @@ public void test_SwissprotRemapping_failed_WithoutOrganism(){ System.out.println(reports.get(1).getStatus().getLabel() + " " + reports.get(1).getStatus().getDescription()); Assert.assertNull(ac); - Assert.assertEquals(true, reports.get(1) instanceof DefaultBlastReport); + Assert.assertTrue(reports.get(1) instanceof DefaultBlastReport); Assert.assertEquals(StatusLabel.FAILED, reports.get(1).getStatusLabel()); } catch (ActionProcessingException e) { @@ -138,8 +138,8 @@ public void test_SwissprotRemapping_Unsuccessful_WithBadEnsemblGeneAndOrganism() System.out.println(reports.get(2).getStatus().getLabel() + " " + reports.get(2).getStatus().getDescription()); Assert.assertNull(ac); - Assert.assertEquals(true, reports.get(2) instanceof DefaultBlastReport); - Assert.assertEquals(true, ((DefaultBlastReport) reports.get(2)).getBlastMatchingProteins().size() == 0); + Assert.assertTrue(reports.get(2) instanceof DefaultBlastReport); + Assert.assertTrue(((DefaultBlastReport) reports.get(2)).getBlastMatchingProteins().isEmpty()); Assert.assertEquals(StatusLabel.FAILED, reports.get(1).getStatus().getLabel()); Assert.assertEquals(StatusLabel.FAILED, reports.get(2).getStatus().getLabel()); @@ -149,7 +149,7 @@ public void test_SwissprotRemapping_Unsuccessful_WithBadEnsemblGeneAndOrganism() } @Test - public void test_SwissprotRemapping_failed_WithEnsemblGeneAndOrganism_LowIdentity(){ + public void test_SwissprotRemapping_ToBeReviewed_WithEnsemblGeneAndOrganism_LowIdentity(){ String sequence = "MSAIQAAWPSGTECIAKYNFHGTAEQDLPFCKGDVLTIVAVTKDPNWYKAKNKVGREGII\n" + "PANYVQKREGVKAGTKLSLMPWFHGKITREQAERLLYPPETGLFLVRESTNYPGDYTLCV\n" + "SCDGKVEHYRIMYHASKLSIDEEVYFENLMQLVEHYTSDADGLCTRLIKPKVMEGTVAAQ\n" + @@ -175,8 +175,8 @@ public void test_SwissprotRemapping_failed_WithEnsemblGeneAndOrganism_LowIdentit System.out.println(reports.get(2).getStatus().getLabel() + " " + reports.get(2).getStatus().getDescription()); Assert.assertNull(ac); - Assert.assertEquals(true, reports.get(2) instanceof DefaultBlastReport); - Assert.assertEquals(false, ((DefaultBlastReport) reports.get(2)).getBlastMatchingProteins().size() > 0); + Assert.assertTrue(reports.get(2) instanceof DefaultBlastReport); + Assert.assertFalse(((DefaultBlastReport) reports.get(2)).getBlastMatchingProteins().isEmpty()); Assert.assertEquals(StatusLabel.FAILED, reports.get(1).getStatus().getLabel()); Assert.assertEquals(StatusLabel.TO_BE_REVIEWED, reports.get(2).getStatus().getLabel()); diff --git a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/strategies/StrategyWithSequenceTest.java b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/strategies/StrategyWithSequenceTest.java index 678fd88..2988f24 100644 --- a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/strategies/StrategyWithSequenceTest.java +++ b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/strategies/StrategyWithSequenceTest.java @@ -3,12 +3,11 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.springframework.test.context.ContextConfiguration; import uk.ac.ebi.intact.commons.util.Crc64; import uk.ac.ebi.intact.core.context.IntactContext; -import uk.ac.ebi.intact.core.unit.IntactBasicTestCase; import uk.ac.ebi.intact.model.BioSource; import uk.ac.ebi.intact.model.Protein; +import uk.ac.ebi.intact.protein.mapping.IntactBasicTestCase; import uk.ac.ebi.intact.protein.mapping.actions.status.StatusLabel; import uk.ac.ebi.intact.protein.mapping.model.actionReport.MappingReport; import uk.ac.ebi.intact.protein.mapping.model.actionReport.impl.DefaultIntactCrc64Report; @@ -24,7 +23,6 @@ * @version $Id$ * @since
30-Apr-2010
*/ -@ContextConfiguration(locations = {"classpath*:/META-INF/jpa.test.spring.xml"}) public class StrategyWithSequenceTest extends IntactBasicTestCase { private StrategyWithSequence strategy; diff --git a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/update/proteinUpdateManagerTest.java b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/update/proteinUpdateManagerTest.java index 96a1ce1..890d754 100644 --- a/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/update/proteinUpdateManagerTest.java +++ b/protein-mapping/src/test/java/uk/ac/ebi/intact/protein/mapping/update/proteinUpdateManagerTest.java @@ -3,7 +3,7 @@ import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; -import uk.ac.ebi.intact.core.unit.IntactBasicTestCase; +import uk.ac.ebi.intact.protein.mapping.IntactBasicTestCase; import uk.ac.ebi.intact.protein.mapping.strategies.exceptions.StrategyException; import javax.xml.ws.soap.SOAPFaultException; diff --git a/protein-mapping/src/test/resources/META-INF/jpa.test.spring.xml b/protein-mapping/src/test/resources/META-INF/jpa.test.spring.xml index 833fbab..223766f 100644 --- a/protein-mapping/src/test/resources/META-INF/jpa.test.spring.xml +++ b/protein-mapping/src/test/resources/META-INF/jpa.test.spring.xml @@ -3,14 +3,24 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" - xmlns:p="http://www.springframework.org/schema/p" xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans-3.0.xsd + http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/context - http://www.springframework.org/schema/context/spring-context-3.0.xsd + http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx - http://www.springframework.org/schema/tx/spring-tx-3.0.xsd - http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> + http://www.springframework.org/schema/tx/spring-tx-3.2.xsd + http://www.springframework.org/schema/jdbc + http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> + + + + + + + + + @@ -25,8 +35,8 @@ - - + + @@ -34,11 +44,59 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +