-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
96 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
...a/org/jacksonlaboratory/model/Module.java → ...cksonlaboratory/model/OntologyModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package org.jacksonlaboratory.model; | ||
|
||
public enum Module { | ||
public enum OntologyModule { | ||
HPO, MAXO | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
oan-etl/src/test/java/org/jacksonlaboratory/graph/OperationsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.jacksonlaboratory.graph; | ||
|
||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | ||
import org.jacksonlaboratory.model.OntologyModule; | ||
import org.junit.jupiter.api.Test; | ||
import org.neo4j.driver.Driver; | ||
import org.neo4j.driver.Record; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
@MicronautTest | ||
class OperationsTest { | ||
|
||
Driver driver; | ||
Operations operations; | ||
public OperationsTest(Driver driver, Operations operations) { | ||
this.driver = driver; | ||
this.operations = operations; | ||
} | ||
|
||
@Test | ||
void truncate() { | ||
// Create fake nodes | ||
// expect nodes to be 0. | ||
driver.session().executeWriteWithoutResult(tx -> tx.run("CREATE (sample1),(sample2),(sample3),(sample4),(sample5)")); | ||
int current = driver.session().executeWrite(tx -> tx.run("MATCH (x) RETURN COUNT(x)").single().values().get(0).asInt()); | ||
assertEquals(5, current); | ||
operations.truncate(); | ||
current = driver.session().executeWrite(tx -> tx.run("MATCH (x) RETURN COUNT(x)").single().values().get(0).asInt()); | ||
assertEquals(0, current); | ||
} | ||
|
||
@Test | ||
void createAndDropIndexes() { | ||
driver.session().executeWriteWithoutResult(tx -> | ||
tx.run("CREATE (p: Phenotype {id: 'HP:000001'}),(d: Disease {id: 'OMIM:1000'}),(g: Gene {id: 'NCBIGene:30'}),(a: Assay {id: 'LOINC:09103-3'})")); | ||
|
||
operations.createIndexes(OntologyModule.HPO); | ||
List<Record> indexes = driver.session().executeWrite(tx -> tx.run("SHOW INDEXES YIELD name, labelsOrTypes, properties, type").list()).stream().filter(r -> r.get("type").asString().equals("RANGE")).collect(Collectors.toList()); | ||
assertEquals(4, indexes.size()); | ||
operations.dropIndexes(OntologyModule.HPO); | ||
indexes = driver.session().executeWrite(tx -> tx.run("SHOW INDEXES YIELD name, labelsOrTypes, properties, type").list()).stream().filter(r -> r.get("type").asString().equals("RANGE")).collect(Collectors.toList());; | ||
assertEquals(0, indexes.size()); | ||
operations.truncate(); | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
oan-etl/src/test/java/org/jacksonlaboratory/model/ModuleTest.java
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
oan-etl/src/test/java/org/jacksonlaboratory/model/OntologyModuleTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jacksonlaboratory.model; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class OntologyModuleTest { | ||
|
||
@Test | ||
void values() { | ||
assertEquals(OntologyModule.HPO, OntologyModule.HPO); | ||
assertNotEquals(OntologyModule.HPO, OntologyModule.MAXO); | ||
assertEquals(OntologyModule.values().length, 2); | ||
} | ||
|
||
@Test | ||
void valueOf() { | ||
assertEquals(OntologyModule.valueOf("HPO"), OntologyModule.HPO); | ||
assertEquals(OntologyModule.valueOf("MAXO"), OntologyModule.MAXO); | ||
} | ||
} |