Commits

petermr committed e56c655

fixed poms

Comments (0)

Files changed (15)

jc-molecule-all/src/test/java/org/xmlcml/cml/converters/molecule/registry/MoleculeConverterRegistryTest.java

+package org.xmlcml.cml.converters.molecule.registry;
+
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.xmlcml.cml.converters.Converter;
+import org.xmlcml.cml.converters.MimeType;
+import org.xmlcml.cml.converters.TypePair;
+import org.xmlcml.cml.converters.cml.CML2CMLLiteConverter;
+import org.xmlcml.cml.converters.cml.CMLCommon;
+import org.xmlcml.cml.converters.molecule.mdl.MDLModule;
+import org.xmlcml.cml.converters.registry.ConverterRegistry;
+
+public class MoleculeConverterRegistryTest {
+
+	String CML = "chemical/x-cml";
+	String CDX = "chemical/x-cdx";
+	String FOO = "chemical/x-foo";
+	TypePair PAIR_OK  = new TypePair(FOO, CML);
+	TypePair PAIR_MISSING  = new TypePair(CML, CDX);
+	int MAP_SIZE = 8;
+	int CONVERTER_SIZE = 10;
+
+    @Test
+    public void testMap() {
+    	Map<TypePair, List<Converter>> map = ConverterRegistry.getDefaultConverterRegistry().getMap();
+    	Assert.assertNotNull(map);
+    	// size will change as more are added
+    	Assert.assertTrue(MAP_SIZE <= map.size());
+    }
+
+    @Test
+    public void testList() {
+    	List<Converter> converterList = ConverterRegistry.getDefaultConverterRegistry().getConverterList();
+    	Assert.assertNotNull(converterList);
+    	for (Converter converter : converterList) {
+    		System.out.println(converter);
+    	}
+    	Assert.assertTrue(CONVERTER_SIZE <= converterList.size());
+    }
+
+    @Test
+    public void testList1() {
+    	List<Converter> converterList = ConverterRegistry.getDefaultConverterRegistry().getConverterList();
+    	boolean found = false;
+    	for (Converter converter : converterList) {
+    		if (CML2CMLLiteConverter.class.equals(converter.getClass())) {
+    			found = true;
+    			break;
+    		}
+    	}
+    	Assert.assertTrue("converter", found);
+    }
+
+    @Test
+    public void testMap1() {
+    	Map<TypePair, List<Converter>> map = ConverterRegistry.getDefaultConverterRegistry().getMap();
+    	Assert.assertTrue(map.containsKey(PAIR_OK));
+    	Assert.assertFalse(map.containsKey(PAIR_MISSING));
+    	for (TypePair typePair1 : map.keySet()) {
+    		System.out.println(typePair1);
+    	}
+    }
+
+    @Test
+    public void testFindConverter() {
+    	List<Converter> converters = ConverterRegistry.getDefaultConverterRegistry().findConverters(
+    			MDLModule.MOL_TYPE.getMimeType(), CMLCommon.CML_TYPE.getMimeType());
+    	Assert.assertNotNull("mdl", converters);
+    	for (Converter converter : converters) {
+    		System.out.println("Converter: "+converter);
+    	}
+    	Assert.assertEquals("mdl", 1, converters.size());
+    	Assert.assertEquals("mdl", "org.xmlcml.cml.converters.molecule.mdl.MDL2CMLConverter", converters.get(0).getClass().getName());
+    }
+
+    @Test
+    public void testFindConverter1() {
+    	List<Converter> converters = ConverterRegistry.getDefaultConverterRegistry().findConverters(CML, CML);
+    	Assert.assertNotNull("cml", converters);
+//    	for (Converter converter : converters) {
+//    		System.out.println(converter);
+//    	}
+    	Assert.assertEquals("cml", 2, converters.size());
+    }
+
+	@Test
+	public void testRegistryLoadsConverterList() {
+		List<Converter> list = ConverterRegistry.getDefaultConverterRegistry().getConverterList();
+		assertTrue(list.size()>0);
+	}
+
+	@Test
+	public void testFindFoo2BarConverter() {
+		List<Converter> converterList = ConverterRegistry.getDefaultConverterRegistry().findConverters("foo", "bar");
+		assertNull(converterList);
+	}
+
+	@Test
+	public void testFindTypesFromSuffix() {
+		Set<MimeType> types = ConverterRegistry.getDefaultConverterRegistry().getTypes("cml");
+		Assert.assertNotNull("get types", types);
+		Assert.assertEquals("get types", 2, types.size());
+		Assert.assertEquals("get types", "chemical/x-cml", ((MimeType)types.toArray()[0]).getMimeType());
+	}
+
+	@Test
+	public void testFindTypesFromSuffix1() {
+		Set<MimeType> types = ConverterRegistry.getDefaultConverterRegistry().getTypes("foo");
+		Assert.assertNotNull("get types", types);
+		Assert.assertEquals("types count", 1, types.size());
+		Assert.assertEquals("type", "chemical/x-foo", ((MimeType)types.toArray()[0]).getMimeType());
+	}
+
+	@Test
+	public void testFindSingleTypeFromSuffix() {
+		MimeType type = ConverterRegistry.getDefaultConverterRegistry().getSingleTypeFromSuffix("cml");
+		Assert.assertNull("get type", type);
+	}
+
+	@Test
+	public void testSingletonConverterRegistry() {
+		Assert.assertNotNull(ConverterRegistry.getDefaultConverterRegistry());
+	}
+
+	@Test
+	public void testCreateRegistryList0() {
+		ConverterRegistry converterRegistry = new ConverterRegistry(ConverterRegistry.class.getClassLoader());
+		List<Converter> converterList = converterRegistry.getConverterList();
+		Assert.assertNotNull(converterList);
+		converterRegistry.createConvertersList();
+		converterList = converterRegistry.getConverterList();
+		Assert.assertNotNull(converterList);
+	}
+
+	@Test
+	public void testCreateRegistryList() {
+		ConverterRegistry converterRegistry = new ConverterRegistry(ConverterRegistry.class.getClassLoader());
+		converterRegistry.populateAndRegister();
+		List<Converter> converterList = converterRegistry.getConverterList();
+		converterRegistry.createConvertersList();
+		converterList = converterRegistry.getConverterList();
+		// should at least contain org.xmlcml.cml.converters.cml.CML2CMLLiteConverter@76f2d004
+		Assert.assertTrue(converterList.size()>0);
+		boolean hasCmllite = hasConverter(converterList, "org.xmlcml.cml.converters.cml.CML2CMLLiteConverter");
+		Assert.assertTrue("has cmllite", hasCmllite);
+	}
+
+	private boolean hasConverter(List<Converter> converterList, String className) {
+		for (Converter converter : converterList) {
+			if (converter.getClass().getName().equals(className)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	@Test
+	public void testSingletonConverterRegistryList0() {
+		ConverterRegistry converterRegistry = ConverterRegistry.getDefaultConverterRegistry();
+		List<Converter> converterList = converterRegistry.getConverterList();
+		Assert.assertNotNull(converterList);
+		Assert.assertEquals("converterList", CONVERTER_SIZE, converterList.size());
+	}
+
+}

jc-molecule-mdl/src/test/java/org/xmlcml/cml/converters/molecule/mdl/RegressionTest.java

 
 import org.junit.Ignore;
 import org.junit.Test;
-import org.xmlcml.cml.converters.testutils.RegressionSuite;
+import org.xmlcml.cml.converters.testutils.JumboConvertersRegressionSuite;
 /**
  *
  * @author ojd20
    @Test
    @Ignore
    public void cml2mdl() {
-      RegressionSuite.run("molecule/mdl/cml2mdl", "cml", "mol",
+      JumboConvertersRegressionSuite.run("molecule/mdl/cml2mdl", "cml", "mol",
                           new CML2MDLConverter());
    }
 
    @Test
    @Ignore
    public void mdl2cml() {
-      RegressionSuite.run("molecule/mdl/mdl2cml", "mol", "cml",
+      JumboConvertersRegressionSuite.run("molecule/mdl/mdl2cml", "mol", "cml",
                           new MDL2CMLConverter());
    }
 
    @Test
    @Ignore
    public void sdf2cml() {
-      RegressionSuite.run("molecule/sdf", "sdf", "cml",
+      JumboConvertersRegressionSuite.run("molecule/sdf", "sdf", "cml",
                           new SDF2CMLConverter());
    }
 }

jc-molecule-pubchem/src/test/java/org/xmlcml/cml/converters/molecule/pubchem/RegressionTest.java

 import org.junit.Ignore;
 import org.junit.Test;
 import org.xmlcml.cml.converters.molecule.pubchem.sdf.CML2PubchemSDFConverter;
-import org.xmlcml.cml.converters.testutils.RegressionSuite;
+import org.xmlcml.cml.converters.testutils.JumboConvertersRegressionSuite;
 
 /**
  *
    @Test
    @Ignore
    public void cml2pubchem() {
-      RegressionSuite.run("molecule/pubchem/sdf", "cml.xml", "sdf",
+      JumboConvertersRegressionSuite.run("molecule/pubchem/sdf", "cml.xml", "sdf",
                           new CML2PubchemSDFConverter());
    }
 
    @Test
    @Ignore
    public void pubchemxml2cml() {
-      RegressionSuite.run("molecule/pubchem", "xml", "cml",
+      JumboConvertersRegressionSuite.run("molecule/pubchem", "xml", "cml",
                           new PubchemXML2CMLConverter(
               "molecule/pubchem/config/config.xml"));
    }

jc-molecule-test/.classpath

-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
-	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
-	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>

jc-molecule-test/.project

-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>jc-molecule-xyz</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.m2e.core.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.eclipse.m2e.core.maven2Nature</nature>
-	</natures>
-</projectDescription>

jc-molecule-test/.settings/org.eclipse.core.resources.prefs

-#Wed Feb 15 21:55:40 GMT 2012
-eclipse.preferences.version=1
-encoding//src/main/java=UTF-8
-encoding//src/main/resources=UTF-8
-encoding//src/test/java=UTF-8
-encoding//src/test/resources=UTF-8
-encoding/<project>=UTF-8

jc-molecule-test/.settings/org.eclipse.jdt.core.prefs

-#Sat Feb 11 21:06:58 GMT 2012
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.source=1.6

jc-molecule-test/.settings/org.eclipse.m2e.core.prefs

-#Wed Jan 04 18:20:05 GMT 2012
-activeProfiles=
-eclipse.preferences.version=1
-resolveWorkspaceProjects=true
-version=1

jc-molecule-test/pom.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<project
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-	<modelVersion>4.0.0</modelVersion>
-
-	<parent>
-		<groupId>org.xml-cml.jc</groupId>
-		<artifactId>jc-molecule</artifactId>
-		<version>0.3-SNAPSHOT</version>
-	</parent>
-
-	<artifactId>jc-molecule-test</artifactId>
-	<name>jc-molecule-test</name>
-
-	<dependencies>
-		<dependency>
-			<groupId>${jc.groupId}</groupId>
-			<artifactId>jc-molecule-all</artifactId>
-            		<version>${project.version}</version>
-		</dependency>
-	</dependencies>
-</project>

jc-molecule-test/src/main/java/org/xmlcml/cml/converters/molecule/registry/MoleculeConverterRegistry.java

-package org.xmlcml.cml.converters.molecule.registry;
-
-// Mavens needs something here/
-public class MoleculeConverterRegistry {
-	public MoleculeConverterRegistry() {
-		
-	}
-}

jc-molecule-test/src/main/resources/META-INF/jumbo-converters

-org.xmlcml.cml.converters.molecule.xyz.XYZModule

jc-molecule-test/src/test/java/org/xmlcml/cml/converters/molecule/registry/MoleculeConverterRegistryTest.java

-package org.xmlcml.cml.converters.molecule.registry;
-
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.xmlcml.cml.converters.Converter;
-import org.xmlcml.cml.converters.MimeType;
-import org.xmlcml.cml.converters.TypePair;
-import org.xmlcml.cml.converters.cml.CML2CMLLiteConverter;
-import org.xmlcml.cml.converters.cml.CMLCommon;
-import org.xmlcml.cml.converters.molecule.mdl.MDLModule;
-import org.xmlcml.cml.converters.registry.ConverterRegistry;
-
-public class MoleculeConverterRegistryTest {
-
-	String CML = "chemical/x-cml";
-	String CDX = "chemical/x-cdx";
-	String FOO = "chemical/x-foo";
-	TypePair PAIR_OK  = new TypePair(FOO, CML);
-	TypePair PAIR_MISSING  = new TypePair(CML, CDX);
-	int MAP_SIZE = 9;
-	int CONVERTER_SIZE = 12;
-
-    @Test
-    public void testMap() {
-    	Map<TypePair, List<Converter>> map = ConverterRegistry.getDefaultConverterRegistry().getMap();
-    	Assert.assertNotNull(map);
-    	// size will change as more are added
-    	Assert.assertEquals(MAP_SIZE, map.size());
-    }
-
-    @Test
-    public void testList() {
-    	List<Converter> converterList = ConverterRegistry.getDefaultConverterRegistry().getConverterList();
-    	Assert.assertNotNull(converterList);
-    	for (Converter converter : converterList) {
-    		System.out.println(converter);
-    	}
-    	Assert.assertEquals(CONVERTER_SIZE, converterList.size());
-    }
-
-    @Test
-    public void testList1() {
-    	List<Converter> converterList = ConverterRegistry.getDefaultConverterRegistry().getConverterList();
-    	boolean found = false;
-    	for (Converter converter : converterList) {
-    		if (CML2CMLLiteConverter.class.equals(converter.getClass())) {
-    			found = true;
-    			break;
-    		}
-    	}
-    	Assert.assertTrue("converter", found);
-    }
-
-    @Test
-    public void testMap1() {
-    	Map<TypePair, List<Converter>> map = ConverterRegistry.getDefaultConverterRegistry().getMap();
-    	Assert.assertTrue(map.containsKey(PAIR_OK));
-    	Assert.assertFalse(map.containsKey(PAIR_MISSING));
-    	for (TypePair typePair1 : map.keySet()) {
-    		System.out.println(typePair1);
-    	}
-    }
-
-    @Test
-    public void testFindConverter() {
-    	List<Converter> converters = ConverterRegistry.getDefaultConverterRegistry().findConverters(
-    			MDLModule.MOL_TYPE.getMimeType(), CMLCommon.CML_TYPE.getMimeType());
-    	Assert.assertNotNull("mdl", converters);
-    	for (Converter converter : converters) {
-    		System.out.println("Converter: "+converter);
-    	}
-    	Assert.assertEquals("mdl", 1, converters.size());
-    	Assert.assertEquals("mdl", "org.xmlcml.cml.converters.molecule.mdl.MDL2CMLConverter", converters.get(0).getClass().getName());
-    }
-
-    @Test
-    public void testFindConverter1() {
-    	List<Converter> converters = ConverterRegistry.getDefaultConverterRegistry().findConverters(CML, CML);
-    	Assert.assertNotNull("cml", converters);
-//    	for (Converter converter : converters) {
-//    		System.out.println(converter);
-//    	}
-    	Assert.assertEquals("cml", 2, converters.size());
-    }
-
-	@Test
-	public void testRegistryLoadsConverterList() {
-		List<Converter> list = ConverterRegistry.getDefaultConverterRegistry().getConverterList();
-		assertTrue(list.size()>0);
-	}
-
-	@Test
-	public void testFindFoo2BarConverter() {
-		List<Converter> converterList = ConverterRegistry.getDefaultConverterRegistry().findConverters("foo", "bar");
-		assertNull(converterList);
-	}
-
-	@Test
-	public void testFindTypesFromSuffix() {
-		Set<MimeType> types = ConverterRegistry.getDefaultConverterRegistry().getTypes("cml");
-		Assert.assertNotNull("get types", types);
-		Assert.assertEquals("get types", 2, types.size());
-		Assert.assertEquals("get types", "chemical/x-cml", ((MimeType)types.toArray()[0]).getMimeType());
-	}
-
-	@Test
-	public void testFindTypesFromSuffix1() {
-		Set<MimeType> types = ConverterRegistry.getDefaultConverterRegistry().getTypes("foo");
-		Assert.assertNotNull("get types", types);
-		Assert.assertEquals("types count", 1, types.size());
-		Assert.assertEquals("type", "chemical/x-foo", ((MimeType)types.toArray()[0]).getMimeType());
-	}
-
-	@Test
-	public void testFindSingleTypeFromSuffix() {
-		MimeType type = ConverterRegistry.getDefaultConverterRegistry().getSingleTypeFromSuffix("cml");
-		Assert.assertNull("get type", type);
-	}
-
-	@Test
-	public void testSingletonConverterRegistry() {
-		Assert.assertNotNull(ConverterRegistry.getDefaultConverterRegistry());
-	}
-
-	@Test
-	public void testCreateRegistryList0() {
-		ConverterRegistry converterRegistry = new ConverterRegistry(ConverterRegistry.class.getClassLoader());
-		List<Converter> converterList = converterRegistry.getConverterList();
-		Assert.assertNotNull(converterList);
-		converterRegistry.createConvertersList();
-		converterList = converterRegistry.getConverterList();
-		Assert.assertNotNull(converterList);
-	}
-
-	@Test
-	public void testCreateRegistryList() {
-		ConverterRegistry converterRegistry = new ConverterRegistry(ConverterRegistry.class.getClassLoader());
-		converterRegistry.populateAndRegister();
-		List<Converter> converterList = converterRegistry.getConverterList();
-		converterRegistry.createConvertersList();
-		converterList = converterRegistry.getConverterList();
-		// should at least contain org.xmlcml.cml.converters.cml.CML2CMLLiteConverter@76f2d004
-		Assert.assertTrue(converterList.size()>0);
-		boolean hasCmllite = hasConverter(converterList, "org.xmlcml.cml.converters.cml.CML2CMLLiteConverter");
-		Assert.assertTrue("has cmllite", hasCmllite);
-	}
-
-	private boolean hasConverter(List<Converter> converterList, String className) {
-		for (Converter converter : converterList) {
-			if (converter.getClass().getName().equals(className)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	@Test
-	public void testSingletonConverterRegistryList0() {
-		ConverterRegistry converterRegistry = ConverterRegistry.getDefaultConverterRegistry();
-		List<Converter> converterList = converterRegistry.getConverterList();
-		Assert.assertNotNull(converterList);
-		Assert.assertEquals("converterList", CONVERTER_SIZE, converterList.size());
-	}
-
-}

jc-molecule-xyz/pom.xml

 	<dependencies>
 		<dependency>
 			<groupId>${jc.groupId}</groupId>
-			<artifactId>jc-top-core</artifactId>
-            <version>${project.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>${jc.groupId}</groupId>
 			<artifactId>jc-molecule-cml</artifactId>
             <version>${project.version}</version>
 		</dependency>

jc-molecule-xyz/src/test/java/org/xmlcml/cml/converters/molecule/xyz/RegressionTest.java

 
 import org.junit.Ignore;
 
+
+
 import org.junit.Test;
-import org.xmlcml.cml.converters.testutils.RegressionSuite;
+import org.xmlcml.cml.converters.testutils.JumboConvertersRegressionSuite;
 
 /**
  *
    @Test
    @Ignore
    public void xyz2cml() {
-      RegressionSuite.run("molecule/xyz/xyz2cml", "xyz", "cml",
+      JumboConvertersRegressionSuite.run("molecule/xyz/xyz2cml", "xyz", "cml",
                           new XYZ2CMLConverter());
    }
 
    @Test
    @Ignore
    public void cml2xyz() {
-      RegressionSuite.run("molecule/xyz/cml2xyz", "cml", "xyz",
+      JumboConvertersRegressionSuite.run("molecule/xyz/cml2xyz", "cml", "xyz",
                           new CML2XYZConverter());
    }
 }
 	    <url>http://maven.ch.cam.ac.uk/m2repo</url>
 	  </repository>
 	</repositories>
-	
+
+<!--  aggregates modules -->	
     <modules>
         <module>jc-molecule-core</module>
         <module>jc-molecule-xyz</module>
         <module>jc-molecule-mdl</module>
         <module>jc-molecule-pubchem</module>
         <module>jc-molecule-all</module>
-        <module>jc-molecule-test</module>
     </modules>
 
+<!--  runs only aggregated tests -->
     <dependencies>
-        <dependency>
-            <groupId>${jc.groupId}</groupId>
-            <artifactId>jc-top-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.