From 94c6c751998d8c37c4002ac2f971346b2ab37ba5 Mon Sep 17 00:00:00 2001 From: ospjuth Date: Thu, 18 Sep 2008 20:22:08 +0000 Subject: [PATCH] Implemented a progressbar that ticks by descr/mol calculation and added option to cancel build. git-svn-id: https://bioclipse.svn.sourceforge.net/svnroot/bioclipse/bioclipse2/trunk@7041 fcb5ba71-d80d-0410-8237-ba3920747fcc --- .../META-INF/MANIFEST.MF | 5 +- .../bioclipse/cdk/qsar/test/TestCDKQsar.java | 48 +++++++++++++ .../bioclipse/cdk/qsar/test/testCDKAT.java | 67 +++++++++++++++++++ .../src/testFiles/0037.cml | 1 + 4 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 plugins/net.bioclipse.cdk.qsar.test/src/net/bioclipse/cdk/qsar/test/testCDKAT.java create mode 100644 plugins/net.bioclipse.cdk.qsar.test/src/testFiles/0037.cml diff --git a/plugins/net.bioclipse.cdk.qsar.test/META-INF/MANIFEST.MF b/plugins/net.bioclipse.cdk.qsar.test/META-INF/MANIFEST.MF index 732d55d..259a3b2 100644 --- a/plugins/net.bioclipse.cdk.qsar.test/META-INF/MANIFEST.MF +++ b/plugins/net.bioclipse.cdk.qsar.test/META-INF/MANIFEST.MF @@ -12,7 +12,10 @@ Require-Bundle: org.eclipse.ui, net.bioclipse.core;bundle-version="2.0.0", net.bioclipse.qsar;bundle-version="1.0.0", org.junit4;bundle-version="4.3.1", - org.eclipse.emf.ecore.edit;bundle-version="2.4.0" + org.eclipse.emf.ecore.edit;bundle-version="2.4.0", + net.bioclipse.core.tests;bundle-version="0.1.0", + org.eclipse.core.resources;bundle-version="3.4.0", + org.openscience.cdk;bundle-version="1.1.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Import-Package: org.apache.log4j;version="1.2.15" diff --git a/plugins/net.bioclipse.cdk.qsar.test/src/net/bioclipse/cdk/qsar/test/TestCDKQsar.java b/plugins/net.bioclipse.cdk.qsar.test/src/net/bioclipse/cdk/qsar/test/TestCDKQsar.java index 561982b..1ab57ee 100644 --- a/plugins/net.bioclipse.cdk.qsar.test/src/net/bioclipse/cdk/qsar/test/TestCDKQsar.java +++ b/plugins/net.bioclipse.cdk.qsar.test/src/net/bioclipse/cdk/qsar/test/TestCDKQsar.java @@ -2,10 +2,17 @@ import static org.junit.Assert.*; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.Map; +import net.bioclipse.cdk.business.ICDKManager; +import net.bioclipse.cdk.domain.ICDKMolecule; +import net.bioclipse.core.MockIFile; import net.bioclipse.core.business.BioclipseException; import net.bioclipse.core.domain.IMolecule; import net.bioclipse.core.domain.SmilesMolecule; @@ -20,9 +27,15 @@ import net.bioclipse.qsar.descriptor.model.DescriptorProvider; import net.bioclipse.qsar.init.Activator; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.preferences.DefaultScope; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.junit.Test; +import org.osgi.framework.Bundle; public class TestCDKQsar { @@ -225,6 +238,41 @@ public void testCalculateXlogPFromSmiles() throws BioclipseException{ } + + @Test + public void testCalculateXlogPFromCML() throws BioclipseException, FileNotFoundException, IOException, CoreException{ + + ICDKManager cdk=net.bioclipse.cdk.business.Activator.getDefault().getCDKManager(); + + Bundle bun=Platform.getBundle(net.bioclipse.cdk.qsar.test.Activator.PLUGIN_ID); + System.out.println("wee bun: " + bun); + + URL url=FileLocator.find(bun, new Path("src/testFiles/0037.cml"), null); + System.out.println("wee url: " + url); + + String str=FileLocator.toFileURL(url).getFile(); + System.out.println("wee File: " + str); + + ICDKMolecule mol = cdk.loadMolecule( new MockIFile(str), null ); + + IDescriptorResult dres1=qsar.calculate(mol, xlogpID); + assertNotNull(dres1); + assertNull(dres1.getErrorMessage(),dres1.getErrorMessage()); + assertEquals(xlogpID, dres1.getDescriptorId()); + + System.out.println("Mol: " + mol.getSmiles() + + " ; Desc: " + dres1.getDescriptorId() +": "); + for (int i=0; i