Skip to content

Commit

Permalink
Separated cdk-pdbcml from cdk-libiocml and created module suite for c…
Browse files Browse the repository at this point in the history
…dk-test-pdbcml.

Conflicts:
	src/main/org/openscience/cdk/libio/cml/PDBAtomCustomizer.java

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Jul 31, 2013
1 parent a0b8dcf commit caac9da
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 34 deletions.
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
<foreach target="compile-module" param="module" trim="true"
parallel="${parallel}" maxthreads="${threadCount}"
list="test-formula,test-qsaratomic,test-qsarbond,
test-pdb,test-smiles,test-extra,test-fragment,test-atomtype,
test-pdb,test-pdbcml,test-smiles,test-extra,test-fragment,test-atomtype,
test-structgen,test-iordf,test-silent"/>
<foreach target="compile-module" param="module" trim="true"
parallel="${parallel}" maxthreads="${threadCount}"
Expand Down Expand Up @@ -1147,7 +1147,7 @@
io,builder3d,forcefield,valencycheck,charges,reaction,
smarts,fingerprint,smiles,qsar,qsaratomic,qsarbond,
qsarmolecular,qsarionpot,qsarprotein,pdb,pcore,inchi,
structgen,libiomd,libiocml,formula,render,extra,fragment,sdg,
structgen,libiomd,libiocml,pdbcml,formula,render,extra,fragment,sdg,
ioformats,log4j,smsd,signature,iordf,cip,tautomer,
isomorphism,renderbasic,renderawt,renderextra,silent,group,
hash,pdbcml"/>
Expand Down
1 change: 0 additions & 1 deletion src/META-INF/test-libiocml.cdkdepends
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ cdk-qsarcml.jar
cdk-atomtype.jar
cdk-silent.jar
cdk-pdb.jar
cdk-pdbcml.jar
cdk-formula.jar
cdk-testdata.jar
cdk-diff.jar
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/libio/cml/ICMLCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*
* @author egonw
* @cdk.created 2005-05-04
* @cdk.module standard
* @cdk.module interfaces
* @cdk.githash
*/
public interface ICMLCustomizer {
Expand Down
5 changes: 5 additions & 0 deletions src/main/org/openscience/cdk/libio/cml/PDBAtomCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import nu.xom.Element;

import org.openscience.cdk.interfaces.IPDBAtom;
import org.openscience.cdk.annotations.TestClass;
import org.openscience.cdk.annotations.TestMethod;
import org.xmlcml.cml.element.CMLScalar;

import org.openscience.cdk.exception.CDKException;
Expand All @@ -46,8 +48,11 @@
* @cdk.set libio-cml-customizers
* @cdk.require java1.5+
*/
@TestClass("org.openscience.cdk.io.cml.PDBAtomCustomizerTest")
public class PDBAtomCustomizer implements ICMLCustomizer {


@TestMethod("testPDBAtomCustomization")
public void customize(IAtom atom, Object nodeToAdd) throws Exception {
if (!(nodeToAdd instanceof Element))
throw new CDKException("NodeToAdd must be of type nu.xom.Element!");
Expand Down
24 changes: 1 addition & 23 deletions src/test/org/openscience/cdk/io/cml/CML2WriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,9 @@
import org.openscience.cdk.interfaces.ICrystal;
import org.openscience.cdk.interfaces.IIsotope;
import org.openscience.cdk.interfaces.IMolecularFormula;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IPDBAtom;
import org.openscience.cdk.interfaces.IReaction;
import org.openscience.cdk.interfaces.IReactionScheme;
import org.openscience.cdk.io.CMLWriter;
import org.openscience.cdk.libio.cml.PDBAtomCustomizer;
import org.openscience.cdk.libio.cml.QSARCustomizer;
import org.openscience.cdk.qsar.DescriptorValue;
import org.openscience.cdk.qsar.IMolecularDescriptor;
Expand All @@ -63,7 +60,6 @@
import org.openscience.cdk.silent.AtomContainerSet;
import org.openscience.cdk.silent.ChemModel;
import org.openscience.cdk.silent.Crystal;
import org.openscience.cdk.silent.PDBAtom;
import org.openscience.cdk.silent.Reaction;
import org.openscience.cdk.templates.MoleculeFactory;
import org.openscience.cdk.tools.ILoggingTool;
Expand Down Expand Up @@ -235,25 +231,7 @@ public class CML2WriterTest extends CDKTestCase {
Assert.assertTrue(cmlContent.indexOf("<molecule id=\"product") != -1);
Assert.assertTrue(cmlContent.indexOf("<molecule id=\"agent") != -1);
}

@Test public void testPDBAtomCustomization() throws Exception {
StringWriter writer = new StringWriter();
IAtomContainer molecule = new AtomContainer();
IPDBAtom atom = new PDBAtom("C");
atom.setName("CA");
atom.setResName("PHE");
molecule.addAtom(atom);

CMLWriter cmlWriter = new CMLWriter(writer);
cmlWriter.registerCustomizer(new PDBAtomCustomizer());
cmlWriter.write(molecule);
String cmlContent = writer.toString();
logger.debug("****************************** testPDBAtomCustomization()");
logger.debug(cmlContent);
logger.debug("******************************");
Assert.assertTrue(cmlContent.indexOf("<scalar dictRef=\"pdb:resName") != -1);
}


@Test public void testReactionScheme1() throws Exception {
StringWriter writer = new StringWriter();
IReactionScheme scheme1 = DefaultChemObjectBuilder.getInstance().newInstance(IReactionScheme.class);
Expand Down
40 changes: 40 additions & 0 deletions src/test/org/openscience/cdk/libio/cml/PDBAtomCustomizerTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.openscience.cdk.libio.cml;

import org.junit.Assert;
import org.junit.Test;
import org.openscience.cdk.AtomContainer;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IPDBAtom;
import org.openscience.cdk.io.CMLWriter;
import org.openscience.cdk.protein.data.PDBAtom;
import org.openscience.cdk.tools.ILoggingTool;
import org.openscience.cdk.tools.LoggingToolFactory;

import java.io.StringWriter;

/**
* @author John May
* @cdk.module test-pdbcml
*/
public class PDBAtomCustomizerTest {

private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(PDBAtomCustomizerTest.class);

@Test public void testPDBAtomCustomization() throws Exception {
StringWriter writer = new StringWriter();
IAtomContainer molecule = new AtomContainer();
IPDBAtom atom = new PDBAtom("C");
atom.setName("CA");
atom.setResName("PHE");
molecule.addAtom(atom);

CMLWriter cmlWriter = new CMLWriter(writer);
cmlWriter.registerCustomizer(new PDBAtomCustomizer());
cmlWriter.write(molecule);
String cmlContent = writer.toString();
logger.debug("****************************** testPDBAtomCustomization()");
logger.debug(cmlContent);
logger.debug("******************************");
Assert.assertTrue(cmlContent.indexOf("<scalar dictRef=\"pdb:resName") != -1);
}
}
21 changes: 14 additions & 7 deletions src/test/org/openscience/cdk/modulesuites/MpdbcmlTests.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
/* Copyright (C) 2013 Egon Willighagen <egonw@users.sf.net>
/*
* Copyright (c) 2013. John May <jwmay@users.sf.net>
*
* Contact: cdk-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
* All we ask is that proper credit is given for our work, which includes
* - but is not limited to - adding the above copyright notice to the beginning
* of your source code files, and to any copyright notice that you may distribute
* with programs based on this work.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
Expand All @@ -14,22 +19,24 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 U
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.openscience.cdk.modulesuites;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import org.openscience.cdk.io.cml.PDBAtomCustomizerTest;
import org.openscience.cdk.libio.cml.PDBAtomCustomizerTest;

/**
* TestSuite that runs all the unit tests for the CDK module pdbcml.
* TestSuite that runs all the sample tests for the CDK module pdbcml.
*
* @cdk.module test-pdbcml
*/
@RunWith(value=Suite.class)
@SuiteClasses(value={
PDBAtomCustomizerTest.class
@RunWith(value = Suite.class)
@SuiteClasses(value = {
PDBAtomCustomizerTest.class
})
public class MpdbcmlTests {}
public class MpdbcmlTests {
}

0 comments on commit caac9da

Please sign in to comment.