Skip to content

Commit

Permalink
Added test data and setUp method for manager tests
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw authored and egonw committed Jul 15, 2009
1 parent 4ecbc16 commit 05e7cce
Show file tree
Hide file tree
Showing 9 changed files with 271 additions and 3 deletions.
Expand Up @@ -15,4 +15,6 @@ Require-Bundle: net.bioclipse.core;bundle-version="2.0.0",
net.bioclipse.structuredb.rdf;bundle-version="2.0.0", net.bioclipse.structuredb.rdf;bundle-version="2.0.0",
net.bioclipse.structuredb;bundle-version="2.0.0", net.bioclipse.structuredb;bundle-version="2.0.0",
org.eclipse.ui;bundle-version="3.4.2", org.eclipse.ui;bundle-version="3.4.2",
org.junit4;bundle-version="4.3.1" org.junit4;bundle-version="4.3.1",
net.bioclipse.cdk.business;bundle-version="2.0.0",
net.bioclipse.ui;bundle-version="2.0.0"
@@ -1,5 +1,6 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2009 Egon Willighagen <egonw@users.sf.net> * Copyright (c) 2009 Egon Willighagen <egonw@users.sf.net>
* 2008 Jonathan Alverson
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -10,15 +11,38 @@
******************************************************************************/ ******************************************************************************/
package net.bioclipse.structuredb.rdf.business.tests; package net.bioclipse.structuredb.rdf.business.tests;


import org.junit.Assert; import java.util.List;
import org.junit.Test;


import net.bioclipse.cdk.business.CDKManager;
import net.bioclipse.cdk.business.ICDKManager;
import net.bioclipse.cdk.domain.ICDKMolecule;
import net.bioclipse.core.MockIFile;
import net.bioclipse.core.business.IBioclipseManager; import net.bioclipse.core.business.IBioclipseManager;
import net.bioclipse.core.tests.AbstractManagerTest; import net.bioclipse.core.tests.AbstractManagerTest;
import net.bioclipse.structuredb.business.IStructuredbManager;
import net.bioclipse.structuredb.domain.DBMolecule;
import net.bioclipse.structuredb.rdf.business.StructureRDFManager; import net.bioclipse.structuredb.rdf.business.StructureRDFManager;


import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

public class StructureRDFManagerTest extends AbstractManagerTest { public class StructureRDFManagerTest extends AbstractManagerTest {


private static IStructuredbManager manager;
private final static String database1 = "database1";
private final static String database2 = "database2";

private ICDKManager cdk = new CDKManager();

@BeforeClass
public static void setup() throws Exception {
manager = new StructureRDFManager();
Assert.assertNotNull(manager);
manager.createDatabase(database1);
manager.createDatabase(database2);
}

public IBioclipseManager getManager() { public IBioclipseManager getManager() {
return new StructureRDFManager(); return new StructureRDFManager();
} }
Expand All @@ -42,6 +66,49 @@ public IBioclipseManager getManager() {
@Test public void testAllLabels() { @Test public void testAllLabels() {
Assert.fail("Not implemented yet."); Assert.fail("Not implemented yet.");
} }

public void testCreatingAndRetrievingStructures() throws Exception {
ICDKManager cdk = new CDKManager();

ICDKMolecule mol1 = cdk.loadMolecule(
new MockIFile( StructureRDFManagerTest.class
.getClassLoader()
.getResourceAsStream(
"testData/0037.cml") ) );
Assert.assertNotNull(mol1);

DBMolecule structure1 = manager
.createMolecule( database1,
"0037",
mol1 );
Assert.assertNotNull(structure1);

DBMolecule structure2
= manager.createMolecule(
database1,
"0106",
cdk.loadMolecule(
new MockIFile( StructureRDFManagerTest.class
.getClassLoader()
.getResourceAsStream(
"testData/0106.cml") ) ) );

Assert.assertNotNull(structure2);

Assert.assertTrue( manager
.allMoleculesByName( database1,
structure1.getName() )
.contains(structure1) );
Assert.assertTrue( manager
.allMoleculesByName( database1,
structure2.getName() )
.contains(structure2) );

List<DBMolecule> dBMolecules = manager.allMolecules(database1);

Assert.assertTrue( dBMolecules.contains(structure1) );
Assert.assertTrue( dBMolecules.contains(structure2) );
}


@Test public void testCreatingChoiceAnnotation() { @Test public void testCreatingChoiceAnnotation() {
Assert.fail("Not implemented yet."); Assert.fail("Not implemented yet.");
Expand Down
@@ -0,0 +1 @@
<cml xmlns="http://www.xml-cml.org/schema"><molecule title="" id="nmrshiftdb20110444"><atomArray><atom id="a1" elementType="C" x2="2.89" y2="-1.25" formalCharge="0" hydrogenCount="0" /><atom id="a2" elementType="C" x2="2.89" y2="-0.42" formalCharge="0" hydrogenCount="0" /><atom id="a3" elementType="C" x2="2.17" y2="0.0" formalCharge="0" hydrogenCount="0" /><atom id="a4" elementType="C" x2="1.44" y2="-0.42" formalCharge="0" hydrogenCount="0" /><atom id="a5" elementType="C" x2="1.44" y2="-1.25" formalCharge="0" hydrogenCount="0" /><atom id="a6" elementType="C" x2="0.72" y2="-1.67" formalCharge="0" hydrogenCount="0" /><atom id="a7" elementType="C" x2="3.61" y2="-1.67" formalCharge="0" hydrogenCount="0" /><atom id="a8" elementType="C" x2="2.17" y2="-2.5" formalCharge="0" hydrogenCount="0" /><atom id="a9" elementType="C" x2="2.89" y2="-2.92" formalCharge="0" hydrogenCount="0" /><atom id="a10" elementType="C" x2="1.44" y2="-2.92" formalCharge="0" hydrogenCount="0" /><atom id="a11" elementType="C" x2="0.0" y2="-4.58" formalCharge="0" hydrogenCount="0" /><atom id="a12" elementType="C" x2="0.72" y2="-5.0" formalCharge="0" hydrogenCount="0" /><atom id="a13" elementType="C" x2="0.0" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a14" elementType="C" x2="2.89" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a15" elementType="C" x2="3.61" y2="-4.17" formalCharge="0" hydrogenCount="0" /><atom id="a16" elementType="C" x2="4.33" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a17" elementType="C" x2="4.33" y2="-2.92" formalCharge="0" hydrogenCount="0" /><atom id="a18" elementType="C" x2="3.61" y2="-2.5" formalCharge="0" hydrogenCount="0" /><atom id="a19" elementType="O" x2="1.44" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a20" elementType="N" x2="2.17" y2="-1.67" formalCharge="0" hydrogenCount="0" /><atom id="a21" elementType="N" x2="0.0" y2="-2.08" formalCharge="0" hydrogenCount="0" /><atom id="a22" elementType="Si" x2="0.72" y2="-4.17" formalCharge="0" hydrogenCount="0" /></atomArray><bondArray><bond id="b1" atomRefs2="a1 a20" order="S" /><bond id="b2" atomRefs2="a1 a2" order="S" /><bond id="b3" atomRefs2="a1 a7" order="S" /><bond id="b4" atomRefs2="a2 a3" order="S" /><bond id="b5" atomRefs2="a3 a4" order="S" /><bond id="b6" atomRefs2="a4 a5" order="S" /><bond id="b7" atomRefs2="a5 a20" order="S" /><bond id="b8" atomRefs2="a5 a6" order="S" /><bond id="b9" atomRefs2="a6 a21" order="T" /><bond id="b10" atomRefs2="a8 a20" order="S" /><bond id="b11" atomRefs2="a8 a9" order="S" /><bond id="b12" atomRefs2="a8 a10" order="S" /><bond id="b13" atomRefs2="a9 a14" order="D" /><bond id="b14" atomRefs2="a9 a18" order="S" /><bond id="b15" atomRefs2="a10 a19" order="S" /><bond id="b16" atomRefs2="a11 a22" order="S" /><bond id="b17" atomRefs2="a12 a22" order="S" /><bond id="b18" atomRefs2="a13 a22" order="S" /><bond id="b19" atomRefs2="a14 a15" order="S" /><bond id="b20" atomRefs2="a15 a16" order="D" /><bond id="b21" atomRefs2="a16 a17" order="S" /><bond id="b22" atomRefs2="a17 a18" order="D" /><bond id="b23" atomRefs2="a19 a22" order="S" /></bondArray></molecule></cml>
@@ -0,0 +1 @@
<cml xmlns="http://www.xml-cml.org/schema"><molecule title="" id="nmrshiftdb20110098"><atomArray><atom id="a1" elementType="C" x2="1.73" y2="-2.5" formalCharge="0" hydrogenCount="0" /><atom id="a2" elementType="C" x2="1.73" y2="-1.5" formalCharge="0" hydrogenCount="0" /><atom id="a3" elementType="C" x2="0.87" y2="-1.0" formalCharge="0" hydrogenCount="0" /><atom id="a4" elementType="C" x2="2.6" y2="-1.0" formalCharge="0" hydrogenCount="0" /><atom id="a5" elementType="C" x2="2.6" y2="-3.0" formalCharge="0" hydrogenCount="0" /><atom id="a6" elementType="C" x2="3.46" y2="-2.5" formalCharge="0" hydrogenCount="0" /><atom id="a7" elementType="C" x2="3.46" y2="-1.5" formalCharge="0" hydrogenCount="0" /><atom id="a8" elementType="C" x2="5.0" y2="-2.0" formalCharge="0" hydrogenCount="0" /><atom id="a9" elementType="C" x2="4.41" y2="-1.19" formalCharge="0" hydrogenCount="0" /><atom id="a10" elementType="C" x2="0.87" y2="-3.0" formalCharge="0" hydrogenCount="0" /><atom id="a11" elementType="C" x2="0.0" y2="-2.5" formalCharge="0" hydrogenCount="0" /><atom id="a12" elementType="O" x2="2.6" y2="-4.0" formalCharge="0" hydrogenCount="0" /><atom id="a13" elementType="O" x2="2.6" y2="0.0" formalCharge="0" hydrogenCount="0" /><atom id="a14" elementType="N" x2="0.0" y2="-1.5" formalCharge="0" hydrogenCount="0" /><atom id="a15" elementType="N" x2="4.41" y2="-2.81" formalCharge="0" hydrogenCount="0" /></atomArray><bondArray><bond id="b1" atomRefs2="a1 a2" order="D" /><bond id="b2" atomRefs2="a1 a5" order="S" /><bond id="b3" atomRefs2="a1 a10" order="S" /><bond id="b4" atomRefs2="a2 a3" order="S" /><bond id="b5" atomRefs2="a2 a4" order="S" /><bond id="b6" atomRefs2="a3 a14" order="D" /><bond id="b7" atomRefs2="a4 a7" order="S" /><bond id="b8" atomRefs2="a4 a13" order="D" /><bond id="b9" atomRefs2="a5 a6" order="S" /><bond id="b10" atomRefs2="a5 a12" order="D" /><bond id="b11" atomRefs2="a6 a7" order="D" /><bond id="b12" atomRefs2="a6 a15" order="S" /><bond id="b13" atomRefs2="a7 a9" order="S" /><bond id="b14" atomRefs2="a8 a9" order="D" /><bond id="b15" atomRefs2="a8 a15" order="S" /><bond id="b16" atomRefs2="a10 a11" order="D" /><bond id="b17" atomRefs2="a11 a14" order="S" /></bondArray></molecule></cml>
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright (c) 2007-2008 Bioclipse Project
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
*******************************************************************************/
package testData;

import java.io.File;
import java.io.InputStream;

import org.openscience.cdk.AtomContainer;
import org.openscience.cdk.ChemObject;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.exception.CDKException;
import org.openscience.cdk.io.MDLReader;

/**
* Instatiates some testdata from files in the testdata package
*
* @author jonalv
*
*/
public abstract class TestData {

private TestData() {
}

public static AtomContainer getCycloPropane() throws CDKException {
return readFromFile( "testData/cyclopropane.mol" );

}

public static AtomContainer getCycloOctan() throws CDKException {
return readFromFile( "testData/cyclooctan.mol" );
}

public static AtomContainer readFromFile(String path) throws CDKException {
InputStream ins = TestData.class.getClassLoader().getResourceAsStream(path);
MDLReader reader = new MDLReader(ins);
return (AtomContainer) reader.read( (ChemObject)new Molecule() );
}

public static String getTestSDFFilePath() {
return TestData.class
.getClassLoader()
.getResource("testData/sdfTestFile.sdf")
.getPath();
}
}
69 changes: 69 additions & 0 deletions plugins/net.bioclipse.structuredb.rdf.tests/src/testData/atp.mol
@@ -0,0 +1,69 @@

Marvin 07140515482D

31 33 0 0 0 0 999 V2000
0.4239 -4.2648 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
0.4239 -3.4398 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.1384 -3.0273 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
1.1384 -2.2023 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4239 -1.7898 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-0.2906 -2.2023 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0752 -1.9474 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-1.5601 -2.6148 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.0752 -3.2823 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
-0.2906 -3.0273 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.3301 -1.1628 0.0000 C 0 0 3 0 0 0 0 0 0 0 0 0
-0.8452 -0.4953 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-1.3301 0.1721 0.0000 C 0 0 3 0 0 0 0 0 0 0 0 0
-1.0752 0.9567 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.2682 1.1283 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-0.0133 1.9129 0.0000 P 0 0 3 0 0 0 0 0 0 0 0 0
-0.7979 2.1678 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
0.7713 1.6579 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
0.2417 2.6975 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.0486 2.8690 0.0000 P 0 0 3 0 0 0 0 0 0 0 0 0
0.8771 3.6760 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.2202 2.0621 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.8556 3.0406 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
2.4076 2.4275 0.0000 P 0 0 0 0 0 0 0 0 0 0 0 0
3.0207 2.9795 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1.7945 1.8754 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
2.9597 1.8144 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-2.1147 -0.0828 0.0000 C 0 0 3 0 0 0 0 0 0 0 0 0
-2.7822 0.4021 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-2.1147 -0.9078 0.0000 C 0 0 3 0 0 0 0 0 0 0 0 0
-2.7822 -1.3927 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
2 3 4 0 0 0 0
3 4 4 0 0 0 0
4 5 4 0 0 0 0
5 6 4 0 0 0 0
6 7 4 0 0 0 0
7 8 4 0 0 0 0
8 9 4 0 0 0 0
9 10 4 0 0 0 0
2 10 4 0 0 0 0
6 10 4 0 0 0 0
7 11 1 0 0 0 0
11 12 1 0 0 0 0
12 13 1 0 0 0 0
13 14 1 0 0 0 0
14 15 1 0 0 0 0
15 16 1 0 0 0 0
16 17 1 0 0 0 0
16 18 2 0 0 0 0
16 19 1 0 0 0 0
19 20 1 0 0 0 0
20 21 1 0 0 0 0
20 22 2 0 0 0 0
20 23 1 0 0 0 0
23 24 1 0 0 0 0
24 25 1 0 0 0 0
24 26 1 0 0 0 0
24 27 2 0 0 0 0
13 28 1 0 0 0 0
28 29 1 0 0 0 0
28 30 1 0 0 0 0
11 30 1 0 0 0 0
30 31 1 0 0 0 0
M END
@@ -0,0 +1,22 @@

CDK

8 8 0 0 0 0 0 0 0 0999 V2000
258.0000 1001.9637 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
224.7403 1015.7404 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
291.2597 1015.7404 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
210.9637 1049.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
305.0363 1049.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
224.7403 1082.2596 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
291.2597 1082.2596 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
258.0000 1096.0363 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 2 0 0 0 0
3 1 1 0 0 0 0
2 4 1 0 0 0 0
5 3 1 0 0 0 0
4 6 1 0 0 0 0
7 5 1 0 0 0 0
6 8 1 0 0 0 0
8 7 1 0 0 0 0
M END
$$$$
@@ -0,0 +1,23 @@
cyclopropane.mol


9 9 0 0 0 1 V2000
-0.0073 -0.5272 0.9655 C 0 0 0 0 0
-0.6776 -0.7930 -0.3498 C 0 0 0 0 0
0.2103 0.4053 -0.1891 C 0 0 0 0 0
0.8019 -1.1711 1.2970 H 0 0 0 0 0
-0.6000 -0.2021 1.8155 H 0 0 0 0 0
-1.7511 -0.6586 -0.4435 H 0 0 0 0 0
-0.3492 -1.6277 -0.9620 H 0 0 0 0 0
1.1755 0.4303 -0.6860 H 0 0 0 0 0
-0.2264 1.3994 -0.1675 H 0 0 0 0 0
1 2 1 6 0 0
1 3 1 6 0 0
1 4 1 0 0 0
1 5 1 1 0 0
2 3 1 0 0 0
2 6 1 0 0 0
2 7 1 6 0 0
3 8 1 6 0 0
3 9 1 0 0 0
M END
@@ -0,0 +1,29 @@

MassFron052fd10709212D

4 4 0 0 0 0 0 0 0 0 2 V2000
1.8966 -3.2759 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.8966 -4.0345 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2.2759 -4.6897 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.5172 -4.6897 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 2 0 0 0 0
2 3 1 0 0 0 0
2 4 1 0 0 0 0
3 4 1 0 0 0 0
M CHG 1 3 1
M END
$$$$

MassFron052poiiiiiiii10709212D

4 3 0 0 0 0 0 0 0 0 2 V2000
4.5172 2.7931 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
4.5172 3.5517 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0
5.1724 3.9310 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
5.1724 4.6897 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 0 0 0 0
2 3 1 0 0 0 0
3 4 2 0 0 0 0
M CHG 1 2 1
M END
$$$$

0 comments on commit 05e7cce

Please sign in to comment.