diff --git a/README.md b/README.md index 34634d1f..1a04e860 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,39 @@ This repo contains: ## Inclusion in main codebase The `cbioportal-core` code is currently included in the final Docker image during the Docker build process: https://github.com/cBioPortal/cbioportal/blob/master/docker/web-and-data/Dockerfile#L48 + +## How to run integration tests + +This section guides you through the process of running integration tests by setting up a cBioPortal MySQL database environment using Docker. Please follow these steps carefully to ensure your testing environment is configured correctly. + +### Preparing the cbioportal test database + +1. **Download the cBioPortal Database Schema**: To begin, you need to download the database schema for the version of cBioPortal you are interested in testing. +Locate the pom.xml file in your project directory and check the values of `` and `` to determine the correct version. +Replace `v6.0.3` in the command below with your desired cBioPortal version: +``` +curl -o cgds.sql https://raw.githubusercontent.com/cBioPortal/cbioportal/v6.0.3/src/main/resources/db-scripts/cgds.sql +``` + +2. **Launch the MySQL Server Container**: Use Docker to start a MySQL server pre-loaded with the cBioPortal schema. Execute the following command from the root of your project directory. +It is recommended to open a separate terminal tab or window for this operation as it will occupy the console until stopped: + +``` +docker run -p 3306:3306 \ +-v $(pwd)/src/test/resources/seed_mini.sql:/docker-entrypoint-initdb.d/seed.sql:ro \ +-v $(pwd)/cgds.sql:/docker-entrypoint-initdb.d/cgds.sql:ro \ +-e MYSQL_ROOT_PASSWORD=root \ +-e MYSQL_USER=cbio_user \ +-e MYSQL_PASSWORD=somepassword \ +-e MYSQL_DATABASE=cgds_test \ +mysql:5.7 +``` + +### Run integration tests + +With the database up and running, you are now ready to execute the integration tests. + +Use Maven to run the integration tests. Ensure you are in the root directory of your project and run the following command: +``` +mvn integration-test +``` diff --git a/pom.xml b/pom.xml index 802d5ce8..99339126 100644 --- a/pom.xml +++ b/pom.xml @@ -247,7 +247,35 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12.4 + 2.21.0 + + + default-test + test + + test + + + + **/integrationTest/**/* + + + + + integration-test + integration-test + + test + + + + **/integrationTest/**/* + + 1 + false + + + org.apache.maven.plugins diff --git a/src/main/java/org/mskcc/cbio/portal/scripts/ImportGenesetData.java b/src/main/java/org/mskcc/cbio/portal/scripts/ImportGenesetData.java index f912fa77..7c6ed3b7 100644 --- a/src/main/java/org/mskcc/cbio/portal/scripts/ImportGenesetData.java +++ b/src/main/java/org/mskcc/cbio/portal/scripts/ImportGenesetData.java @@ -278,7 +278,7 @@ public static int importData(File genesetFile, boolean updateInfo, boolean newV * @param suppFile * @throws Exception */ - static void importSuppGenesetData(File suppFile) throws Exception { + public static void importSuppGenesetData(File suppFile) throws Exception { ProgressMonitor.setCurrentMessage("Reading data from: " + suppFile.getCanonicalPath()); diff --git a/src/main/java/org/mskcc/cbio/portal/util/ProgressMonitor.java b/src/main/java/org/mskcc/cbio/portal/util/ProgressMonitor.java index cd95a9ae..948d25d9 100644 --- a/src/main/java/org/mskcc/cbio/portal/util/ProgressMonitor.java +++ b/src/main/java/org/mskcc/cbio/portal/util/ProgressMonitor.java @@ -68,7 +68,10 @@ private ProgressMonitor() { } private static boolean isRunningOnServer() { - return ServerDetector.getServerId() != null; + // FXIME because we bring core as dependency into cbioportal-core, we have web server classes in classpath + // But we run loader as standalone java process atm, not from the web server. + // return ServerDetector.getServerId() != null; + return false; } /** * Sets Console Flag. diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoCancerStudy.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoCancerStudy.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoCancerStudy.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoCancerStudy.java index 5fa9ac4f..aec208b9 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoCancerStudy.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoCancerStudy.java @@ -30,23 +30,26 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; import org.junit.Test; -import org.junit.Ignore; import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoTypeOfCancer; import org.mskcc.cbio.portal.model.CancerStudy; - -import java.io.IOException; -import java.util.ArrayList; - import org.mskcc.cbio.portal.model.ReferenceGenome; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import java.io.IOException; +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * JUnit Tests for DaoCancer Study. @@ -54,7 +57,6 @@ * @author Arman Aksoy, Ethan Cerami, Arthur Goldberg, Ersin Ciftci. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoClinicalAttribute.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoClinicalAttribute.java similarity index 90% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoClinicalAttribute.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoClinicalAttribute.java index ecc83385..734a44db 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoClinicalAttribute.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoClinicalAttribute.java @@ -30,21 +30,22 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.dao.DaoClinicalAttributeMeta; +import org.mskcc.cbio.portal.dao.DaoException; import org.mskcc.cbio.portal.model.ClinicalAttribute; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGene.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGene.java similarity index 95% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoGene.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGene.java index 2d1180b8..9ba437c9 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGene.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGene.java @@ -30,11 +30,13 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; import org.mskcc.cbio.portal.model.CanonicalGene; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; @@ -50,7 +52,6 @@ * JUnit Tests for DaoGene and DaoGeneOptimized. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGenePanel.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGenePanel.java similarity index 88% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoGenePanel.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGenePanel.java index dc6f3bef..a0fbd5af 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGenePanel.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGenePanel.java @@ -30,30 +30,29 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; - +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGenePanel; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.GenePanel; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import org.junit.Test; -import org.junit.runner.RunWith; -import static org.junit.Assert.*; +import java.util.HashSet; -import java.util.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * JUnit Tests for DaoGenePanel. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticAlteration.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticAlteration.java similarity index 86% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticAlteration.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticAlteration.java index f18f5cf8..000b90fa 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticAlteration.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticAlteration.java @@ -30,27 +30,38 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.model.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneticAlteration; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoGeneticProfileSamples; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.model.Sample; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Set; -import java.util.*; +import static org.junit.Assert.assertEquals; /** * JUnit tests for DaoGeneticAlteration class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticProfile.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticProfile.java similarity index 94% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticProfile.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticProfile.java index 20552257..8c1afdcc 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticProfile.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticProfile.java @@ -30,25 +30,30 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import java.util.ArrayList; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.model.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.model.GeneticAlterationType; +import org.mskcc.cbio.portal.model.GeneticProfile; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; + +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * JUnit tests for DaoGeneticProfile class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticProfileSamples.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticProfileSamples.java similarity index 87% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticProfileSamples.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticProfileSamples.java index 0812aeb8..01d65388 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGeneticProfileSamples.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGeneticProfileSamples.java @@ -30,27 +30,33 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.model.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoGeneticProfileSamples; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.model.Sample; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import static org.junit.Assert.*; - import java.util.ArrayList; +import static org.junit.Assert.assertEquals; + /** * JUnit Tests for the Dao Genetic Profile Cases Class. * * @author Ethan Cerami. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) public class TestDaoGeneticProfileSamples { diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGistic.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGistic.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoGistic.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGistic.java index b430e585..df152f7b 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoGistic.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoGistic.java @@ -30,15 +30,12 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import java.util.Arrays; - -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.DaoGeneOptimized; import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; import org.mskcc.cbio.portal.dao.DaoGistic; import org.mskcc.cbio.portal.model.CanonicalGene; import org.mskcc.cbio.portal.model.Gistic; @@ -48,13 +45,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - import java.sql.SQLException; import java.util.ArrayList; +import java.util.Arrays; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoMutSig.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoMutSig.java similarity index 92% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoMutSig.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoMutSig.java index 1616f2e5..67714b6e 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoMutSig.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoMutSig.java @@ -30,11 +30,13 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoMutSig; import org.mskcc.cbio.portal.model.CanonicalGene; import org.mskcc.cbio.portal.model.MutSig; import org.springframework.test.annotation.Rollback; @@ -42,17 +44,17 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - import java.io.IOException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * @author Lennart Bastian */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoMutation.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoMutation.java similarity index 87% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoMutation.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoMutation.java index e31dc8c7..cd22ac6c 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoMutation.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoMutation.java @@ -30,32 +30,40 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import java.io.IOException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.model.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoMutation; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.ExtendedMutation; +import org.mskcc.cbio.portal.model.GeneticProfile; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - -import java.util.*; - -import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; -import org.junit.Assert; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * JUnit tests for DaoMutation class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional @@ -215,23 +223,23 @@ private void validateMockAnnotationJson(ExtendedMutation mutation) { Map> expectedAnnotationJsonMap = makeMockExpectedAnnotationJsonMap(); // confirm expected sizes - Assert.assertTrue(annotationJsonMap.containsKey("namespace1")); - Assert.assertEquals(expectedAnnotationJsonMap.get("namespace1").size(), annotationJsonMap.get("namespace1").size()); - Assert.assertEquals(2, annotationJsonMap.get("namespace1").size()); - Assert.assertTrue(annotationJsonMap.containsKey("namespace2")); - Assert.assertEquals(1, annotationJsonMap.get("namespace2").size()); - Assert.assertEquals(expectedAnnotationJsonMap.get("namespace2").size(), annotationJsonMap.get("namespace2").size()); + assertTrue(annotationJsonMap.containsKey("namespace1")); + assertEquals(expectedAnnotationJsonMap.get("namespace1").size(), annotationJsonMap.get("namespace1").size()); + assertEquals(2, annotationJsonMap.get("namespace1").size()); + assertTrue(annotationJsonMap.containsKey("namespace2")); + assertEquals(1, annotationJsonMap.get("namespace2").size()); + assertEquals(expectedAnnotationJsonMap.get("namespace2").size(), annotationJsonMap.get("namespace2").size()); // compare namespace 1 annotation map values Map namespace1Map = annotationJsonMap.get("namespace1"); Map expectedNamespace1Map = expectedAnnotationJsonMap.get("namespace1"); - Assert.assertEquals(expectedNamespace1Map.get("header1"), namespace1Map.get("header1")); - Assert.assertEquals(expectedNamespace1Map.get("header2"), namespace1Map.get("header2")); + assertEquals(expectedNamespace1Map.get("header1"), namespace1Map.get("header1")); + assertEquals(expectedNamespace1Map.get("header2"), namespace1Map.get("header2")); // compare namespace 2 annotation map values Map namespace2Map = annotationJsonMap.get("namespace2"); Map expectedNamespace2Map = expectedAnnotationJsonMap.get("namespace2"); - Assert.assertEquals(expectedNamespace2Map.get("header1"), namespace2Map.get("header1")); + assertEquals(expectedNamespace2Map.get("header1"), namespace2Map.get("header1")); } private String makeMockAnnotationJsonString() { diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoSampleList.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoSampleList.java similarity index 86% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoSampleList.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoSampleList.java index 1b73db9e..83b807b3 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoSampleList.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoSampleList.java @@ -30,27 +30,34 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; - -import java.util.ArrayList; +package org.mskcc.cbio.portal.integrationTest.dao; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.model.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.DaoSampleList; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.model.Sample; +import org.mskcc.cbio.portal.model.SampleList; +import org.mskcc.cbio.portal.model.SampleListCategory; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import java.util.ArrayList; + +import static org.junit.Assert.assertEquals; /** * JUnit test for DaoCase List. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoSampleProfile.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoSampleProfile.java similarity index 85% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoSampleProfile.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoSampleProfile.java index f327facc..705f46b6 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoSampleProfile.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoSampleProfile.java @@ -30,28 +30,39 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; - -import org.junit.Ignore; -import org.mskcc.cbio.portal.model.*; +package org.mskcc.cbio.portal.integrationTest.dao; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGenePanel; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.DaoSampleProfile; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.GenePanel; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.model.Sample; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import org.junit.Test; -import org.junit.Before; -import org.junit.runner.RunWith; -import static org.junit.Assert.*; +import java.util.ArrayList; +import java.util.HashSet; -import java.util.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * JUnit test for DaoSample class */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoUser.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoUser.java similarity index 91% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoUser.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoUser.java index b6c2890e..2c6b78a0 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoUser.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoUser.java @@ -30,13 +30,8 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; -import static org.junit.Assert.*; - -import java.util.ArrayList; - -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoUser; @@ -46,15 +41,20 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; -import static org.hamcrest.CoreMatchers.*; +import java.util.ArrayList; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; /** * JUnit test for DaoUser class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoUserAuthorities.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoUserAuthorities.java similarity index 97% rename from src/test/java/org/mskcc/cbio/portal/dao/TestDaoUserAuthorities.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoUserAuthorities.java index c90a8b3a..556a11dd 100644 --- a/src/test/java/org/mskcc/cbio/portal/dao/TestDaoUserAuthorities.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/dao/TestDaoUserAuthorities.java @@ -30,19 +30,13 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.dao; +package org.mskcc.cbio.portal.integrationTest.dao; // imports -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; -import java.util.Arrays; - -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.dao.DaoUserAuthorities; import org.mskcc.cbio.portal.model.User; import org.mskcc.cbio.portal.model.UserAuthorities; import org.springframework.test.annotation.Rollback; @@ -50,11 +44,17 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.util.Arrays; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + /** * JUnit test for DaoUserAuthorities class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/pancancer/LargeTestSetGenerator.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/pancancer/LargeTestSetGenerator.java similarity index 99% rename from src/test/java/org/mskcc/cbio/portal/pancancer/LargeTestSetGenerator.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/pancancer/LargeTestSetGenerator.java index 9ab181cd..f85d7f2b 100644 --- a/src/test/java/org/mskcc/cbio/portal/pancancer/LargeTestSetGenerator.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/pancancer/LargeTestSetGenerator.java @@ -1,4 +1,4 @@ -package org.mskcc.cbio.portal.pancancer; +package org.mskcc.cbio.portal.integrationTest.pancancer; import java.io.BufferedReader; import java.io.File; diff --git a/src/test/java/org/mskcc/cbio/portal/pancancer/TestPanCancerStudySummaryImport.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/pancancer/TestPanCancerStudySummaryImport.java similarity index 92% rename from src/test/java/org/mskcc/cbio/portal/pancancer/TestPanCancerStudySummaryImport.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/pancancer/TestPanCancerStudySummaryImport.java index 248ee686..81cf6a2e 100755 --- a/src/test/java/org/mskcc/cbio/portal/pancancer/TestPanCancerStudySummaryImport.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/pancancer/TestPanCancerStudySummaryImport.java @@ -1,11 +1,18 @@ -package org.mskcc.cbio.portal.pancancer; +package org.mskcc.cbio.portal.integrationTest.pancancer; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoClinicalData; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.DaoTypeOfCancer; import org.mskcc.cbio.portal.model.CancerStudy; import org.mskcc.cbio.portal.model.CanonicalGene; import org.mskcc.cbio.portal.model.ClinicalAttribute; @@ -13,10 +20,10 @@ import org.mskcc.cbio.portal.model.TypeOfCancer; import org.mskcc.cbio.portal.scripts.ImportCancerStudy; import org.mskcc.cbio.portal.scripts.ImportClinicalData; -import org.mskcc.cbio.portal.scripts.ImportSampleList; import org.mskcc.cbio.portal.scripts.ImportProfileData; -import org.mskcc.cbio.portal.util.*; -import org.mskcc.cbio.portal.web_api.GetSampleLists; +import org.mskcc.cbio.portal.scripts.ImportSampleList; +import org.mskcc.cbio.portal.util.ConsoleUtil; +import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestGenerateMutationData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestGenerateMutationData.java similarity index 94% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestGenerateMutationData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestGenerateMutationData.java index 9217f91e..66926984 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestGenerateMutationData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestGenerateMutationData.java @@ -30,26 +30,26 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.scripts.GenerateMutationData; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - import java.io.File; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * JUnit test for GenerateMutationData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportCaisesClinicalXML.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCaisesClinicalXML.java similarity index 97% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportCaisesClinicalXML.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCaisesClinicalXML.java index d139a87f..e0532c90 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportCaisesClinicalXML.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCaisesClinicalXML.java @@ -30,9 +30,7 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; - -import java.io.File; +package org.mskcc.cbio.portal.integrationTest.scripts; import org.junit.Before; import org.junit.Ignore; @@ -46,11 +44,14 @@ import org.mskcc.cbio.portal.model.Patient; import org.mskcc.cbio.portal.model.Sample; import org.mskcc.cbio.portal.model.TypeOfCancer; +import org.mskcc.cbio.portal.scripts.ImportCaisesClinicalXML; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.io.File; + /** * * @author jgao diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportClinicalData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportClinicalData.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportClinicalData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportClinicalData.java index df3e1fbd..6d1475f2 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportClinicalData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportClinicalData.java @@ -30,28 +30,38 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoClinicalData; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.ClinicalParameterMap; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.scripts.ImportClinicalData; import org.mskcc.cbio.portal.util.ConsoleUtil; import org.mskcc.cbio.portal.util.ProgressMonitor; -import org.mskcc.cbio.portal.scripts.ImportClinicalData; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; -import java.io.*; -import java.util.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * Tests Import of Clinical Data. @@ -61,8 +71,6 @@ * @author Pieter Lukasse */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportCnaDiscreteLongData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCnaDiscreteLongData.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportCnaDiscreteLongData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCnaDiscreteLongData.java index 0f3703af..d317aa03 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportCnaDiscreteLongData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCnaDiscreteLongData.java @@ -25,15 +25,28 @@ * @author Sander Tan */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import com.fasterxml.jackson.databind.*; -import org.junit.*; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoCnaEvent; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGeneticAlteration; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.DaoSampleProfile; +import org.mskcc.cbio.portal.dao.JdbcUtil; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; import org.mskcc.cbio.portal.model.CnaEvent; import org.mskcc.cbio.portal.model.GeneticProfile; import org.mskcc.cbio.portal.model.Sample; +import org.mskcc.cbio.portal.scripts.ImportCnaDiscreteLongData; import org.mskcc.cbio.portal.util.StableIdUtil; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; @@ -45,7 +58,10 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import static com.google.common.collect.Lists.newArrayList; import static com.google.common.collect.Sets.newHashSet; @@ -54,11 +70,10 @@ import static org.cbioportal.model.MolecularProfile.DataType.DISCRETE; import static org.cbioportal.model.MolecularProfile.ImportType.DISCRETE_LONG; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = {"classpath:/applicationContext-dao.xml"}) @Rollback @Transactional @@ -565,8 +580,8 @@ private void assertSampleExistsInGeneticProfile(String sampleId) throws DaoExcep geneticProfile.getCancerStudyId(), sampleStableId ); - Assert.assertNotNull(sample); - Assert.assertTrue(DaoSampleProfile.sampleExistsInGeneticProfile( + assertNotNull(sample); + assertTrue(DaoSampleProfile.sampleExistsInGeneticProfile( sample.getInternalId(), geneticProfile.getGeneticProfileId() )); diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportCopyNumberSegmentData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCopyNumberSegmentData.java similarity index 97% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportCopyNumberSegmentData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCopyNumberSegmentData.java index a68270ce..7cc50cff 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportCopyNumberSegmentData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportCopyNumberSegmentData.java @@ -21,18 +21,9 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +package org.mskcc.cbio.portal.integrationTest.scripts; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -45,6 +36,7 @@ import org.mskcc.cbio.portal.model.CancerStudy; import org.mskcc.cbio.portal.model.Patient; import org.mskcc.cbio.portal.model.Sample; +import org.mskcc.cbio.portal.scripts.ImportCopyNumberSegmentData; import org.mskcc.cbio.portal.util.SpringUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; @@ -53,13 +45,19 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + /** * Test the import of Segment data into database. * @author pieterlukasse */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportExtendedMutationData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportExtendedMutationData.java similarity index 93% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportExtendedMutationData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportExtendedMutationData.java index 9f3ad075..b76c33d8 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportExtendedMutationData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportExtendedMutationData.java @@ -30,38 +30,57 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; -import org.mskcc.cbio.portal.util.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoClinicalAttributeMeta; +import org.mskcc.cbio.portal.dao.DaoClinicalData; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoMutation; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.ClinicalAttribute; +import org.mskcc.cbio.portal.model.ClinicalData; +import org.mskcc.cbio.portal.model.ExtendedMutation; +import org.mskcc.cbio.portal.model.GeneticAlterationType; +import org.mskcc.cbio.portal.model.GeneticProfile; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.model.Sample; +import org.mskcc.cbio.portal.scripts.ImportExtendedMutationData; +import org.mskcc.cbio.portal.util.ConsoleUtil; +import org.mskcc.cbio.portal.util.ProgressMonitor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static com.google.common.collect.Sets.newHashSet; -import static org.junit.Assert.*; - -import java.io.*; +import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; + +import static com.google.common.collect.Sets.newHashSet; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; /** * @author Arthur Goldberg goldberg@cbio.mskcc.org */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/integrationTestScript.xml", "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGeneData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGeneData.java similarity index 92% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportGeneData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGeneData.java index c192a46e..aa182c36 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGeneData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGeneData.java @@ -30,33 +30,27 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; - -import static org.junit.Assert.assertEquals; - -import java.io.File; - import org.mskcc.cbio.portal.dao.DaoGeneOptimized; -import org.mskcc.cbio.portal.dao.DaoReferenceGenomeGene; import org.mskcc.cbio.portal.model.CanonicalGene; -import org.mskcc.cbio.portal.model.ReferenceGenome; -import org.mskcc.cbio.portal.model.ReferenceGenomeGene; +import org.mskcc.cbio.portal.scripts.ImportGeneData; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.io.File; + +import static org.junit.Assert.assertEquals; + /** * JUnit tests for ImportGeneData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenericAssayData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenericAssayData.java similarity index 98% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenericAssayData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenericAssayData.java index 38b099e1..a0a33c6d 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenericAssayData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenericAssayData.java @@ -25,39 +25,36 @@ * @author Pim van Nierop, pim@thehyve.nl */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.io.File; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; - -import org.cbioportal.model.EntityType; import org.cbioportal.model.meta.GenericAssayMeta; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoGenericAssay; import org.mskcc.cbio.portal.dao.DaoGeneticEntity; import org.mskcc.cbio.portal.dao.JdbcUtil; import org.mskcc.cbio.portal.model.GeneticAlterationType; +import org.mskcc.cbio.portal.scripts.ImportGenericAssayEntity; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.io.File; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + /* * JUnit tests for ImportTreatmentData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenericAssayPatientLevelData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenericAssayPatientLevelData.java similarity index 87% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenericAssayPatientLevelData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenericAssayPatientLevelData.java index 4599dc7f..123715f8 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenericAssayPatientLevelData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenericAssayPatientLevelData.java @@ -30,41 +30,49 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import java.io.BufferedReader; +import org.cbioportal.model.GeneticEntity; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; -import org.cbioportal.model.GeneticEntity; -import org.mskcc.cbio.portal.util.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGenericAssay; +import org.mskcc.cbio.portal.dao.DaoGeneticAlteration; +import org.mskcc.cbio.portal.dao.DaoGeneticEntity; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.DaoSampleProfile; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.GeneticAlterationType; +import org.mskcc.cbio.portal.model.GeneticProfile; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.model.Sample; +import org.mskcc.cbio.portal.scripts.ImportGenericAssayPatientLevelData; +import org.mskcc.cbio.portal.util.FileUtil; +import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * JUnit tests for ImportGenericAssayPatientLevelData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenesetData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenesetData.java similarity index 94% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenesetData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenesetData.java index 74825b3d..a345f722 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenesetData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenesetData.java @@ -19,46 +19,39 @@ * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . -*/ + */ /* * @author Sander Tan -*/ + */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; - -import static org.junit.Assert.assertEquals; - -import java.io.File; - import org.mskcc.cbio.portal.dao.DaoGeneset; import org.mskcc.cbio.portal.model.Geneset; +import org.mskcc.cbio.portal.scripts.ImportGenesetData; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -/* - * JUnit tests for ImportGenesetData class. -*/ +import java.io.File; -@RunWith(SpringJUnit4ClassRunner.class) -@Ignore +import static org.junit.Assert.assertEquals; +@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional public class TestImportGenesetData { - @Test + @Test public void testImportGenesetData() throws Exception { ProgressMonitor.setConsoleMode(false); - + // Open genesets test data file File file = new File("src/test/resources/genesets/unit-test1_genesets.gmt"); boolean updateInfo = false; @@ -68,23 +61,23 @@ public void testImportGenesetData() throws Exception { // Open supplementary file file = new File("src/test/resources/genesets/unit-test1_supp-genesets.txt"); ImportGenesetData.importSuppGenesetData(file); - + // Test database entries Geneset geneset = DaoGeneset.getGenesetByExternalId("UNITTEST_GENESET5"); assertEquals("UNITTEST_GENESET5", geneset.getExternalId()); geneset = DaoGeneset.getGenesetByExternalId("UNITTEST_GENESET10"); assertEquals("http://www.broadinstitute.org/gsea/msigdb/cards/GCNP_SHH_UP_EARLY.V1_UP", geneset.getRefLink()); - + // Test warning message assertEquals(5, skippedGenes); - + // Test database entries supplementary file geneset = DaoGeneset.getGenesetByExternalId("UNITTEST_GENESET2"); assertEquals("Genes up-regulated in RK3E cells (kidney epithelium) over-expressing GLI1 [GeneID=2735].", geneset.getDescription()); geneset = DaoGeneset.getGenesetByExternalId("UNITTEST_GENESET8"); assertEquals("UNITTEST_GENESET8", geneset.getName()); - - // Test update of genes + + // Test update of genes // Open genesets test data file file = new File("src/test/resources/genesets/unit-test2_genesets.gmt"); newVersion = false; @@ -94,13 +87,13 @@ public void testImportGenesetData() throws Exception { // Open supplementary file file = new File("src/test/resources/genesets/unit-test2_supp-genesets.txt"); ImportGenesetData.importSuppGenesetData(file); - + geneset = DaoGeneset.getGenesetByExternalId("UNITTEST_GENESET2"); assertEquals("A made up description is suited for this a fake gene.", geneset.getDescription()); geneset = DaoGeneset.getGenesetByExternalId("UNITTEST_GENESET1"); assertEquals("Thought of new nice name for this geneset", geneset.getName()); geneset = DaoGeneset.getGenesetByExternalId("UNITTEST_GENESET1"); assertEquals("http://www.thehyve.nl/", geneset.getRefLink()); - + } } diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenesetHierarchyData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenesetHierarchyData.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenesetHierarchyData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenesetHierarchyData.java index 5befd914..8e63b1ed 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportGenesetHierarchyData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportGenesetHierarchyData.java @@ -25,42 +25,40 @@ * @author Sander Tan */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.List; - import org.mskcc.cbio.portal.dao.DaoException; import org.mskcc.cbio.portal.dao.DaoGeneset; -import org.mskcc.cbio.portal.dao.DaoGenesetHierarchyNode; import org.mskcc.cbio.portal.dao.DaoGenesetHierarchyLeaf; +import org.mskcc.cbio.portal.dao.DaoGenesetHierarchyNode; import org.mskcc.cbio.portal.dao.JdbcUtil; import org.mskcc.cbio.portal.model.Geneset; import org.mskcc.cbio.portal.model.GenesetHierarchy; import org.mskcc.cbio.portal.model.GenesetHierarchyLeaf; +import org.mskcc.cbio.portal.scripts.ImportGenesetData; +import org.mskcc.cbio.portal.scripts.ImportGenesetHierarchy; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.io.File; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.List; + +import static org.junit.Assert.assertEquals; + /* * JUnit tests for ImportGenesetData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportProfileData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportProfileData.java similarity index 99% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportProfileData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportProfileData.java index 79054c65..f1cc61fe 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportProfileData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportProfileData.java @@ -21,18 +21,12 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import org.junit.*; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoCancerStudy; @@ -55,11 +49,10 @@ import org.mskcc.cbio.portal.model.CnaEvent; import org.mskcc.cbio.portal.model.ExtendedMutation; import org.mskcc.cbio.portal.model.GeneticProfile; -import org.mskcc.cbio.portal.model.GeneticAlterationType; import org.mskcc.cbio.portal.model.Patient; import org.mskcc.cbio.portal.model.Sample; import org.mskcc.cbio.portal.model.StructuralVariant; - +import org.mskcc.cbio.portal.scripts.ImportProfileData; import org.mskcc.cbio.portal.util.ConsoleUtil; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; @@ -67,12 +60,20 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + /** * @author Pieter Lukasse pieter@thehyve.nl */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportReferenceGenome.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportReferenceGenome.java similarity index 92% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportReferenceGenome.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportReferenceGenome.java index 8749febb..a59ba407 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportReferenceGenome.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportReferenceGenome.java @@ -1,27 +1,24 @@ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; - -import static org.junit.Assert.assertEquals; - -import java.io.File; - import org.mskcc.cbio.portal.dao.DaoReferenceGenome; import org.mskcc.cbio.portal.model.ReferenceGenome; +import org.mskcc.cbio.portal.scripts.ImportReferenceGenome; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.io.File; + +import static org.junit.Assert.assertEquals; + /** * JUnit tests for ImportGeneData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportStructuralVariantData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportStructuralVariantData.java similarity index 90% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportStructuralVariantData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportStructuralVariantData.java index 25442ea0..76a58f85 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportStructuralVariantData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportStructuralVariantData.java @@ -25,28 +25,38 @@ * @author Sander Tan */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; +import com.fasterxml.jackson.databind.ObjectMapper; import junitparams.JUnitParamsRunner; import junitparams.Parameters; -import org.apache.commons.lang3.StringEscapeUtils; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.junit.*; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; -import org.mskcc.cbio.portal.util.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoStructuralVariant; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; +import org.mskcc.cbio.portal.model.StructuralVariant; +import org.mskcc.cbio.portal.scripts.ImportStructuralVariantData; +import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; import org.springframework.transaction.annotation.Transactional; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Set; + import static com.google.common.collect.Sets.newHashSet; -import static org.junit.Assert.*; -import java.io.*; -import java.util.*; +import static org.junit.Assert.assertEquals; /** * Test class to test functionality of ImportStructralVariantData @@ -57,7 +67,7 @@ @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional -public class TestImportStructuralVariantData{ +public class TestImportStructuralVariantData { int studyId; int geneticProfileId; Set noNamespaces = null; diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportTabDelimData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportTabDelimData.java similarity index 94% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportTabDelimData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportTabDelimData.java index 03522f6f..33779cd3 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportTabDelimData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportTabDelimData.java @@ -30,23 +30,40 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; -import java.io.BufferedReader; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; -import org.mskcc.cbio.portal.util.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGeneset; +import org.mskcc.cbio.portal.dao.DaoGeneticAlteration; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.dao.DaoSampleProfile; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.CopyNumberStatus; +import org.mskcc.cbio.portal.model.Geneset; +import org.mskcc.cbio.portal.model.GeneticAlterationType; +import org.mskcc.cbio.portal.model.GeneticProfile; +import org.mskcc.cbio.portal.model.Patient; +import org.mskcc.cbio.portal.model.Sample; +import org.mskcc.cbio.portal.scripts.ImportGenesetData; +import org.mskcc.cbio.portal.scripts.ImportTabDelimData; +import org.mskcc.cbio.portal.util.ConsoleUtil; +import org.mskcc.cbio.portal.util.FileUtil; +import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - +import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; @@ -58,12 +75,13 @@ import java.util.List; import java.util.Set; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * JUnit tests for ImportTabDelimData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional @@ -509,5 +527,4 @@ private void addTestPatientAndSampleRecords(File file) throws FileNotFoundExcept } MySQLbulkLoader.flushAll(); } - } diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportUsers.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportUsers.java similarity index 92% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestImportUsers.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportUsers.java index 63dce370..d70ea0b0 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestImportUsers.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestImportUsers.java @@ -30,29 +30,30 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; // imports -import org.junit.Ignore; + import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.model.User; import org.mskcc.cbio.portal.dao.DaoUser; -import org.mskcc.cbio.portal.model.UserAuthorities; import org.mskcc.cbio.portal.dao.DaoUserAuthorities; +import org.mskcc.cbio.portal.model.User; +import org.mskcc.cbio.portal.model.UserAuthorities; +import org.mskcc.cbio.portal.scripts.ImportUsers; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * JUnit test for ImportUsers class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestIntegrationTest.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestIntegrationTest.java similarity index 99% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestIntegrationTest.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestIntegrationTest.java index e5e1c41b..bc3bbac1 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestIntegrationTest.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestIntegrationTest.java @@ -21,31 +21,13 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +package org.mskcc.cbio.portal.integrationTest.scripts; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; - import org.cbioportal.model.GenericAssayData; import org.cbioportal.model.GenesetMolecularData; import org.cbioportal.model.StructuralVariant; @@ -59,28 +41,29 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoClinicalAttributeMeta; +import org.mskcc.cbio.portal.dao.DaoClinicalData; import org.mskcc.cbio.portal.dao.DaoException; import org.mskcc.cbio.portal.dao.DaoGeneOptimized; import org.mskcc.cbio.portal.dao.DaoGeneset; +import org.mskcc.cbio.portal.dao.DaoGeneticAlteration; import org.mskcc.cbio.portal.dao.DaoGeneticEntity; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; import org.mskcc.cbio.portal.dao.DaoGistic; -import org.mskcc.cbio.portal.dao.DaoSampleList; -import org.mskcc.cbio.portal.dao.MySQLbulkLoader; import org.mskcc.cbio.portal.dao.DaoMutation; +import org.mskcc.cbio.portal.dao.DaoSampleList; import org.mskcc.cbio.portal.dao.DaoTypeOfCancer; -import org.mskcc.cbio.portal.dao.DaoClinicalData; -import org.mskcc.cbio.portal.dao.DaoGeneticProfile; -import org.mskcc.cbio.portal.dao.DaoGeneticAlteration; -import org.mskcc.cbio.portal.dao.DaoClinicalAttributeMeta; -import org.mskcc.cbio.portal.model.ClinicalData; -import org.mskcc.cbio.portal.model.ClinicalAttribute; -import org.mskcc.cbio.portal.model.GeneticProfile; -import org.mskcc.cbio.portal.model.SampleList; +import org.mskcc.cbio.portal.dao.MySQLbulkLoader; import org.mskcc.cbio.portal.model.CancerStudy; -import org.mskcc.cbio.portal.model.TypeOfCancer; import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.ClinicalAttribute; +import org.mskcc.cbio.portal.model.ClinicalData; import org.mskcc.cbio.portal.model.ExtendedMutation; +import org.mskcc.cbio.portal.model.GeneticProfile; import org.mskcc.cbio.portal.model.Gistic; +import org.mskcc.cbio.portal.model.SampleList; +import org.mskcc.cbio.portal.model.TypeOfCancer; +import org.mskcc.cbio.portal.scripts.ImportGenePanel; import org.mskcc.cbio.portal.util.ConsoleUtil; import org.mskcc.cbio.portal.util.ProgressMonitor; import org.mskcc.cbio.portal.util.SpringUtil; @@ -92,6 +75,23 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + /** * Integration test using the same data that is used by validation system test * "study_es_0". In the validation system test for "study_es_0" it is checked if @@ -103,8 +103,6 @@ */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/integrationTestScript.xml", "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestMutationFilter.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestMutationFilter.java similarity index 98% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestMutationFilter.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestMutationFilter.java index 6e4abce3..2c193723 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestMutationFilter.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestMutationFilter.java @@ -30,30 +30,28 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +package org.mskcc.cbio.portal.integrationTest.scripts; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoException; import org.mskcc.cbio.portal.dao.DaoGeneOptimized; import org.mskcc.cbio.portal.model.CanonicalGene; import org.mskcc.cbio.portal.model.ExtendedMutation; +import org.mskcc.cbio.portal.scripts.MutationFilter; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + /** * JUnit tests for MutationFilter class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestNormalizeExpressionLevels.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestNormalizeExpressionLevels.java similarity index 94% rename from src/test/java/org/mskcc/cbio/portal/scripts/TestNormalizeExpressionLevels.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestNormalizeExpressionLevels.java index bb857d32..964ccee3 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestNormalizeExpressionLevels.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/scripts/TestNormalizeExpressionLevels.java @@ -30,17 +30,14 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.scripts; +package org.mskcc.cbio.portal.integrationTest.scripts; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -import org.mskcc.cbio.portal.model.CanonicalGene; import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.scripts.NormalizeExpressionLevels; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -51,9 +48,11 @@ import java.net.URL; import java.util.ArrayList; -@RunWith(SpringJUnit4ClassRunner.class) -@Ignore +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/servlet/TestWebService.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/servlet/TestWebService.java similarity index 93% rename from src/test/java/org/mskcc/cbio/portal/servlet/TestWebService.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/servlet/TestWebService.java index fb2d968d..9b4917be 100644 --- a/src/test/java/org/mskcc/cbio/portal/servlet/TestWebService.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/servlet/TestWebService.java @@ -30,36 +30,50 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.servlet; - -import java.io.*; -import java.util.*; +package org.mskcc.cbio.portal.integrationTest.servlet; import jakarta.servlet.ServletException; - import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; -import org.mskcc.cbio.portal.util.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoSampleList; +import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.model.GeneticProfile; +import org.mskcc.cbio.portal.model.SampleList; +import org.mskcc.cbio.portal.model.SampleListCategory; +import org.mskcc.cbio.portal.model.User; +import org.mskcc.cbio.portal.servlet.NullHttpServletRequest; +import org.mskcc.cbio.portal.servlet.NullHttpServletResponse; +import org.mskcc.cbio.portal.servlet.WebService; +import org.mskcc.cbio.portal.util.AccessControl; +import org.mskcc.cbio.portal.util.SpringUtil; +import org.mskcc.cbio.portal.util.WebserviceParserUtils; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; -import static org.easymock.EasyMock.*; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.isA; +import static org.easymock.EasyMock.replay; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; /** * JUnit test for WebService class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/util/TestCancerStudyReader.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestCancerStudyReader.java similarity index 93% rename from src/test/java/org/mskcc/cbio/portal/util/TestCancerStudyReader.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestCancerStudyReader.java index d6c13b02..733cbc79 100644 --- a/src/test/java/org/mskcc/cbio/portal/util/TestCancerStudyReader.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestCancerStudyReader.java @@ -30,28 +30,27 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.util; +package org.mskcc.cbio.portal.integrationTest.util; -import java.io.File; - -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoCancerStudy; import org.mskcc.cbio.portal.model.CancerStudy; +import org.mskcc.cbio.portal.util.CancerStudyReader; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; /** * JUnit test for CancerStudyReader class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/util/TestGenePanelUtil.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestGenePanelUtil.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/util/TestGenePanelUtil.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestGenePanelUtil.java index c4b05600..e86341d0 100644 --- a/src/test/java/org/mskcc/cbio/portal/util/TestGenePanelUtil.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestGenePanelUtil.java @@ -1,6 +1,5 @@ -package org.mskcc.cbio.portal.util; +package org.mskcc.cbio.portal.integrationTest.util; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.model.CanonicalGene; @@ -16,12 +15,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import static org.mskcc.cbio.portal.util.GenePanelUtil.*; +import static org.mskcc.cbio.portal.util.GenePanelUtil.Pair; +import static org.mskcc.cbio.portal.util.GenePanelUtil.extractGenes; +import static org.mskcc.cbio.portal.util.GenePanelUtil.extractPropertyValue; +import static org.mskcc.cbio.portal.util.GenePanelUtil.getAddRemove; @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = {"classpath:/applicationContext-dao.xml"}) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/util/TestGeneticProfileReader.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestGeneticProfileReader.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/util/TestGeneticProfileReader.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestGeneticProfileReader.java index b8caceef..af6eaf95 100644 --- a/src/test/java/org/mskcc/cbio/portal/util/TestGeneticProfileReader.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestGeneticProfileReader.java @@ -30,9 +30,8 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.util; +package org.mskcc.cbio.portal.integrationTest.util; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoCancerStudy; @@ -41,23 +40,22 @@ import org.mskcc.cbio.portal.model.CancerStudy; import org.mskcc.cbio.portal.model.GeneticAlterationType; import org.mskcc.cbio.portal.model.GeneticProfile; +import org.mskcc.cbio.portal.util.GeneticProfileReader; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - import java.io.File; import java.io.IOException; import java.util.ArrayList; +import static org.junit.Assert.assertEquals; + /** * JUnit test for GeneticProfileReader class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/util/TestMutSigReader.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestMutSigReader.java similarity index 85% rename from src/test/java/org/mskcc/cbio/portal/util/TestMutSigReader.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestMutSigReader.java index bf46ab71..85c01d28 100644 --- a/src/test/java/org/mskcc/cbio/portal/util/TestMutSigReader.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestMutSigReader.java @@ -30,26 +30,30 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.util; +package org.mskcc.cbio.portal.integrationTest.util; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoMutSig; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.MutSig; +import org.mskcc.cbio.portal.util.MutSigReader; +import org.mskcc.cbio.portal.util.ProgressMonitor; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - import java.io.File; -@RunWith(SpringJUnit4ClassRunner.class) -@Ignore +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/util/TestTransactionalScripts.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestTransactionalScripts.java similarity index 90% rename from src/test/java/org/mskcc/cbio/portal/util/TestTransactionalScripts.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestTransactionalScripts.java index 25b691ea..0bb03e57 100644 --- a/src/test/java/org/mskcc/cbio/portal/util/TestTransactionalScripts.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/util/TestTransactionalScripts.java @@ -1,10 +1,10 @@ -package org.mskcc.cbio.portal.util; +package org.mskcc.cbio.portal.integrationTest.util; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.util.TransactionalScripts; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; import org.springframework.test.annotation.Rollback; @@ -13,8 +13,6 @@ import org.springframework.transaction.annotation.Transactional; @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/demoScript.xml", "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetGeneticProfiles.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetGeneticProfiles.java similarity index 94% rename from src/test/java/org/mskcc/cbio/portal/web_api/TestGetGeneticProfiles.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetGeneticProfiles.java index cd226089..ede6b433 100644 --- a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetGeneticProfiles.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetGeneticProfiles.java @@ -30,25 +30,23 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.web_api; +package org.mskcc.cbio.portal.integrationTest.web_api; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.web_api.GetGeneticProfiles; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; /** * JUnit test for GeneticProfile class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetMutSig.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetMutSig.java similarity index 94% rename from src/test/java/org/mskcc/cbio/portal/web_api/TestGetMutSig.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetMutSig.java index 6b074c3f..e7d33db7 100644 --- a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetMutSig.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetMutSig.java @@ -30,37 +30,35 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.web_api; +package org.mskcc.cbio.portal.integrationTest.web_api; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; import org.mskcc.cbio.portal.dao.DaoGeneOptimized; import org.mskcc.cbio.portal.dao.DaoGeneticProfile; import org.mskcc.cbio.portal.dao.DaoMutSig; -import org.mskcc.cbio.portal.model.CancerStudy; import org.mskcc.cbio.portal.model.CanonicalGene; import org.mskcc.cbio.portal.model.MutSig; -import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.web_api.GetMutSig; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import java.io.IOException; -import java.io.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * @author Lennart Bastian */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetProfileData.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetProfileData.java similarity index 88% rename from src/test/java/org/mskcc/cbio/portal/web_api/TestGetProfileData.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetProfileData.java index 37439531..8fdff896 100644 --- a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetProfileData.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetProfileData.java @@ -30,32 +30,36 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.web_api; +package org.mskcc.cbio.portal.integrationTest.web_api; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.mskcc.cbio.portal.dao.*; -import org.mskcc.cbio.portal.model.*; -import org.mskcc.cbio.portal.util.*; +import org.mskcc.cbio.portal.dao.DaoCancerStudy; +import org.mskcc.cbio.portal.dao.DaoException; +import org.mskcc.cbio.portal.dao.DaoGeneOptimized; +import org.mskcc.cbio.portal.dao.DaoGeneticProfile; +import org.mskcc.cbio.portal.dao.DaoPatient; +import org.mskcc.cbio.portal.dao.DaoSample; +import org.mskcc.cbio.portal.model.CanonicalGene; +import org.mskcc.cbio.portal.model.GeneticAlterationType; +import org.mskcc.cbio.portal.model.GeneticProfile; +import org.mskcc.cbio.portal.web_api.GetProfileData; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - -import java.io.File; import java.io.IOException; import java.util.ArrayList; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + /** * JUnit test for GetProfileData class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetSampleList.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetSampleList.java similarity index 93% rename from src/test/java/org/mskcc/cbio/portal/web_api/TestGetSampleList.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetSampleList.java index dc91d80e..598269ce 100644 --- a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetSampleList.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetSampleList.java @@ -30,24 +30,22 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.web_api; +package org.mskcc.cbio.portal.integrationTest.web_api; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; +import org.mskcc.cbio.portal.web_api.GetSampleLists; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; /** * JUnit test for GetSampleLists class. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetTypesOfCancer.java b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetTypesOfCancer.java similarity index 96% rename from src/test/java/org/mskcc/cbio/portal/web_api/TestGetTypesOfCancer.java rename to src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetTypesOfCancer.java index a28a89f6..51b1d78d 100644 --- a/src/test/java/org/mskcc/cbio/portal/web_api/TestGetTypesOfCancer.java +++ b/src/test/java/org/mskcc/cbio/portal/integrationTest/web_api/TestGetTypesOfCancer.java @@ -30,12 +30,11 @@ * along with this program. If not, see . */ -package org.mskcc.cbio.portal.web_api; +package org.mskcc.cbio.portal.integrationTest.web_api; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.mskcc.cbio.portal.dao.DaoCancerStudy; @@ -43,23 +42,25 @@ import org.mskcc.cbio.portal.dao.DaoTypeOfCancer; import org.mskcc.cbio.portal.model.CancerStudy; import org.mskcc.cbio.portal.model.TypeOfCancer; +import org.mskcc.cbio.portal.web_api.GetTypesOfCancer; +import org.mskcc.cbio.portal.web_api.ProtocolException; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.transaction.annotation.Transactional; -import static org.junit.Assert.*; - import java.io.IOException; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + /** * JUnit Tests for GetTypes of Cancer. * * @author Ethan Cerami, Arthur Goldberg, Ersin Ciftci. */ @RunWith(SpringJUnit4ClassRunner.class) -@Ignore - @ContextConfiguration(locations = { "classpath:/applicationContext-dao.xml" }) @Rollback @Transactional diff --git a/src/test/java/org/mskcc/cbio/portal/scripts/TestCutInvalidCases.java b/src/test/java/org/mskcc/cbio/portal/scripts/TestCutInvalidCases.java index fbb6fa6a..1b576c74 100644 --- a/src/test/java/org/mskcc/cbio/portal/scripts/TestCutInvalidCases.java +++ b/src/test/java/org/mskcc/cbio/portal/scripts/TestCutInvalidCases.java @@ -34,10 +34,11 @@ import org.junit.Test; -import static org.junit.Assert.*; - import java.io.File; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + /** * JUnit test for CutInvalidCases class. */ diff --git a/src/test/java/org/mskcc/cbio/portal/stats/TestOddsRatio.java b/src/test/java/org/mskcc/cbio/portal/stats/TestOddsRatio.java index 108fdb57..adad5c30 100644 --- a/src/test/java/org/mskcc/cbio/portal/stats/TestOddsRatio.java +++ b/src/test/java/org/mskcc/cbio/portal/stats/TestOddsRatio.java @@ -56,7 +56,7 @@ public void testFisherExact() throws IOException { GeneticAlterationType.COPY_NUMBER_ALTERATION, "DISCRETE", "CNA", "CNA", true); // TBD: change this to use getResourceAsStream() - String matrix0[][] = WebFileConnect.retrieveMatrix(new File("target/test-classes/cna_sample2.txt")); + String matrix0[][] = WebFileConnect.retrieveMatrix(new File("src/test/resources/cna_sample2.txt")); ProfileData data0 = new ProfileData(profile0, matrix0); profileList.add(data0); diff --git a/src/test/resources/applicationContext-dao.xml b/src/test/resources/applicationContext-dao.xml index e0fbe55b..7992c0f9 100644 --- a/src/test/resources/applicationContext-dao.xml +++ b/src/test/resources/applicationContext-dao.xml @@ -9,17 +9,6 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"> - - - - - - - - - - - @@ -89,26 +78,22 @@ - - - - - - allowLoadLocalInfile - true - - - + - - - -