-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an AnIML HPLC-DAD export/import test case.
- Loading branch information
1 parent
86a8c3c
commit 41552af
Showing
12 changed files
with
268 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
...converter.supplier.animl/src/net/openchrom/wsd/converter/supplier/animl/PathResolver.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,45 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2013, 2024 Lablicate GmbH. | ||
* | ||
* 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: | ||
* Dr. Philip Wenig - initial API and implementation | ||
*******************************************************************************/ | ||
package net.openchrom.wsd.converter.supplier.animl; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
|
||
import org.eclipse.core.runtime.FileLocator; | ||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.core.runtime.Path; | ||
import org.eclipse.core.runtime.Platform; | ||
import org.osgi.framework.Bundle; | ||
|
||
public class PathResolver { | ||
|
||
/** | ||
* Returns a absolute path of the specified Folder. For example | ||
* TESTDATA_IMPORT_EMPTY as an absolute Path: | ||
* $PluginPath$/testData/files/file.animl | ||
* | ||
* @param string | ||
* @return String absolutePath | ||
*/ | ||
public static String getAbsolutePath(String string) { | ||
|
||
Bundle bundle = Platform.getBundle(Activator.getContext().getBundle().getSymbolicName()); | ||
IPath path = new Path(string); | ||
URL url = FileLocator.find(bundle, path, null); | ||
try { | ||
return FileLocator.resolve(url).getPath().toString(); | ||
} catch(IOException e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
openchrom/tests/net.openchrom.wsd.converter.supplier.animl.fragment.test/.classpath
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,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
1 change: 1 addition & 0 deletions
1
openchrom/tests/net.openchrom.wsd.converter.supplier.animl.fragment.test/.gitignore
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 @@ | ||
/bin/ |
28 changes: 28 additions & 0 deletions
28
openchrom/tests/net.openchrom.wsd.converter.supplier.animl.fragment.test/.project
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,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>net.openchrom.wsd.converter.supplier.animl.fragment.test</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
2 changes: 2 additions & 0 deletions
2
...rom.wsd.converter.supplier.animl.fragment.test/.settings/org.eclipse.core.resources.prefs
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,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding/<project>=utf8 |
7 changes: 7 additions & 0 deletions
7
...openchrom.wsd.converter.supplier.animl.fragment.test/.settings/org.eclipse.jdt.core.prefs
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,7 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 | ||
org.eclipse.jdt.core.compiler.compliance=17 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=17 |
14 changes: 14 additions & 0 deletions
14
...chrom/tests/net.openchrom.wsd.converter.supplier.animl.fragment.test/META-INF/MANIFEST.MF
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,14 @@ | ||
Manifest-Version: 1.0 | ||
Automatic-Module-Name: net.openchrom.wsd.converter.supplier.animl.fragment.test | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: AnIML WSD Test | ||
Bundle-SymbolicName: net.openchrom.wsd.converter.supplier.animl.fragment.test | ||
Bundle-Version: 1.5.0.qualifier | ||
Bundle-Vendor: OpenChrom | ||
Fragment-Host: net.openchrom.wsd.converter.supplier.animl;bundle-version="1.5.0" | ||
Bundle-RequiredExecutionEnvironment: JavaSE-17 | ||
Require-Bundle: org.junit;bundle-version="4.11.0", | ||
org.eclipse.chemclipse.rcp.app.test;bundle-version="0.9.0", | ||
com.sun.xml.bind.jaxb-core;bundle-version="4.0.1", | ||
com.sun.xml.bind.jaxb-impl;bundle-version="4.0.1", | ||
org.glassfish.hk2.osgi-resource-locator;bundle-version="1.0.3" |
4 changes: 4 additions & 0 deletions
4
openchrom/tests/net.openchrom.wsd.converter.supplier.animl.fragment.test/build.properties
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,4 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
. |
32 changes: 32 additions & 0 deletions
32
...supplier.animl.fragment.test/src/net/openchrom/wsd/converter/supplier/animl/AllTests.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,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2015, 2024 Lablicate GmbH. | ||
* | ||
* 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: | ||
* Dr. Philip Wenig - initial API and implementation | ||
* Dr. Alexander Kerner - initial API and implementation | ||
* Matthias Mailänder - initial API and implementation | ||
*******************************************************************************/ | ||
package net.openchrom.wsd.converter.supplier.animl; | ||
|
||
import org.eclipse.chemclipse.rcp.app.test.TestAssembler; | ||
|
||
import junit.framework.Test; | ||
import junit.framework.TestSuite; | ||
|
||
public class AllTests { | ||
|
||
public static Test suite() { | ||
|
||
TestAssembler testAssembler = new TestAssembler(Activator.getContext().getBundle().getBundleContext().getBundles()); | ||
TestSuite suite = new TestSuite("Run all tests."); | ||
String bundleAndPackageName = "net.openchrom.wsd.converter.supplier.animl"; | ||
testAssembler.assembleTests(suite, bundleAndPackageName, bundleAndPackageName, "*_Test"); // Unit | ||
testAssembler.assembleTests(suite, bundleAndPackageName, bundleAndPackageName, "*_ITest"); // Integration | ||
return suite; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...er.animl.fragment.test/src/net/openchrom/wsd/converter/supplier/animl/TestPathHelper.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,24 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020, 2024 Lablicate GmbH. | ||
* | ||
* 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: | ||
* Matthias Mailänder - initial API and implementation | ||
*******************************************************************************/ | ||
package net.openchrom.wsd.converter.supplier.animl; | ||
|
||
public class TestPathHelper extends PathResolver { | ||
|
||
/* | ||
* IMPORT | ||
*/ | ||
public static final String TESTFILE_IMPORT_DEMO = "testData/files/import/Demo.ocb"; | ||
/* | ||
* EXPORT | ||
*/ | ||
public static final String DIRECTORY_EXPORT_TEST = "testData/files/export"; | ||
} |
104 changes: 104 additions & 0 deletions
104
.../net/openchrom/wsd/converter/supplier/animl/converter/ChromatogramImportExport_ITest.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,104 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2011, 2024 Lablicate GmbH. | ||
* | ||
* 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: | ||
* Dr. Philip Wenig - initial API and implementation | ||
* Matthias Mailänder - initial API and implementation | ||
*******************************************************************************/ | ||
package net.openchrom.wsd.converter.supplier.animl.converter; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
|
||
import org.eclipse.chemclipse.processing.core.IProcessingInfo; | ||
import org.eclipse.chemclipse.processing.core.IProcessingMessage; | ||
import org.eclipse.chemclipse.wsd.converter.chromatogram.ChromatogramConverterWSD; | ||
import org.eclipse.chemclipse.wsd.model.core.IChromatogramWSD; | ||
import org.eclipse.core.runtime.NullProgressMonitor; | ||
import org.junit.Test; | ||
|
||
import net.openchrom.wsd.converter.supplier.animl.TestPathHelper; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class ChromatogramImportExport_ITest extends TestCase { | ||
|
||
protected IChromatogramWSD chromatogramImport; | ||
protected IChromatogramWSD chromatogram; | ||
protected String pathImport; | ||
protected String pathExport; | ||
protected File fileImport; | ||
protected File fileExport; | ||
protected String extensionPointImport; | ||
protected String extensionPointExportReimport; | ||
|
||
@Override | ||
protected void setUp() { | ||
|
||
/* | ||
* Import | ||
*/ | ||
pathImport = TestPathHelper.getAbsolutePath(TestPathHelper.TESTFILE_IMPORT_DEMO); | ||
extensionPointImport = "org.eclipse.chemclipse.xxd.converter.supplier.chemclipse"; | ||
/* | ||
* Export/Reimport | ||
*/ | ||
File directory = new File(TestPathHelper.DIRECTORY_EXPORT_TEST); | ||
directory.mkdir(); | ||
pathExport = TestPathHelper.getAbsolutePath(TestPathHelper.DIRECTORY_EXPORT_TEST) + File.separator + "Test.animl"; | ||
extensionPointExportReimport = "net.openchrom.wsd.converter.supplier.animl.chromatogram"; | ||
/* | ||
* Import the chromatogram. | ||
*/ | ||
fileImport = new File(this.pathImport); | ||
IProcessingInfo<IChromatogramWSD> processingInfoImport = ChromatogramConverterWSD.getInstance().convert(fileImport, this.extensionPointImport, new NullProgressMonitor()); | ||
chromatogramImport = processingInfoImport.getProcessingResult(); | ||
for(IProcessingMessage message : processingInfoImport.getMessages()) { | ||
System.out.println(message.getMessage()); | ||
} | ||
/* | ||
* Export the chromatogram. | ||
*/ | ||
fileExport = new File(this.pathExport); | ||
IProcessingInfo<File> processingInfoExport = ChromatogramConverterWSD.getInstance().convert(fileExport, chromatogramImport, this.extensionPointExportReimport, new NullProgressMonitor()); | ||
fileExport = processingInfoExport.getProcessingResult(); | ||
for(IProcessingMessage message : processingInfoExport.getMessages()) { | ||
System.out.println(message.getMessage()); | ||
} | ||
/* | ||
* Reimport the exported chromatogram. | ||
*/ | ||
chromatogramImport = null; | ||
IProcessingInfo<IChromatogramWSD> processingInfo = ChromatogramConverterWSD.getInstance().convert(fileExport, this.extensionPointExportReimport, new NullProgressMonitor()); | ||
chromatogram = processingInfo.getProcessingResult(); | ||
for(IProcessingMessage message : processingInfo.getMessages()) { | ||
System.out.println(message.getMessage()); | ||
} | ||
} | ||
|
||
@Override | ||
protected void tearDown() throws Exception { | ||
|
||
pathImport = null; | ||
pathExport = null; | ||
fileImport = null; | ||
fileExport.delete(); | ||
fileExport = null; | ||
chromatogramImport = null; | ||
chromatogram = null; | ||
super.tearDown(); | ||
} | ||
|
||
@Test | ||
public void testReimport() { | ||
|
||
assertNotNull(chromatogram); | ||
assertEquals(4950, chromatogram.getNumberOfScans()); | ||
assertEquals(280f, new ArrayList<>(chromatogram.getWavelengths()).get(0)); | ||
} | ||
} |
Binary file added
BIN
+337 KB
...s/net.openchrom.wsd.converter.supplier.animl.fragment.test/testData/files/import/Demo.ocb
Binary file not shown.