-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from ideas-into-software/emf-ods-exporter-sods
Replaced FastODS with SODS
- Loading branch information
Showing
55 changed files
with
3,227 additions
and
9 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -4,5 +4,4 @@ generated/ | |
/.metadata/ | ||
/build/ | ||
cnf/release/ | ||
cnf/local/ | ||
src-gen |
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
Binary file not shown.
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 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<repository xmlns="http://www.osgi.org/xmlns/repository/v1.0.0" name="Local" increment="1679853698364"> | ||
<resource> | ||
<capability namespace="osgi.identity"> | ||
<attribute name="license" value=""The Unlicense";link="https://github.com/miachm/SODS/blob/master/LICENSE""/> | ||
<attribute name="osgi.identity" value="com.github.miachm.sods"/> | ||
<attribute name="documentation" value="https://github.com/miachm/SODS"/> | ||
<attribute name="description" value="A library for load/save ODS files in java."/> | ||
<attribute name="type" value="osgi.bundle"/> | ||
<attribute name="version" value="1.5.3" type="Version"/> | ||
</capability> | ||
<capability namespace="osgi.wiring.package"> | ||
<attribute name="bundle-symbolic-name" value="com.github.miachm.sods"/> | ||
<attribute name="bundle-version" value="1.5.3" type="Version"/> | ||
<attribute name="osgi.wiring.package" value="com.github.miachm.sods"/> | ||
<attribute name="version" value="1.5.3" type="Version"/> | ||
<attribute name="bnd.hashes" value="1324511984,1731897767,2096514,65290051,2023997302,822061019,1624016101,-266320387,-1291886874,520469601,1895597947,351111864,-1115736232,82941713,-1440044159,-1284638927,228265771,-1821040144,-70786291,861476502,677306575,1812804717,2479866,78727453,1567574187,82362,97316887,79850815,1620534404,-482667636,1193265721,2039393584,80227729,465601004,477953699,1916493886,924543180,-1736520349,355567514,1511059808,-1059699121,-1060180405" type="List<Long>"/> | ||
</capability> | ||
<capability namespace="osgi.wiring.bundle"> | ||
<attribute name="bundle-version" value="1.5.3" type="Version"/> | ||
<attribute name="osgi.wiring.bundle" value="com.github.miachm.sods"/> | ||
</capability> | ||
<capability namespace="osgi.wiring.host"> | ||
<attribute name="bundle-version" value="1.5.3" type="Version"/> | ||
<attribute name="osgi.wiring.host" value="com.github.miachm.sods"/> | ||
</capability> | ||
<capability namespace="osgi.content"> | ||
<attribute name="size" value="146610" type="Long"/> | ||
<attribute name="mime" value="application/vnd.osgi.bundle"/> | ||
<attribute name="url" value="com.github.miachm.sods/com.github.miachm.sods-1.5.3.jar"/> | ||
<attribute name="osgi.content" value="55A14104C48686365F5531CB8A95CF8FC2EF5D0A45775A65EA7AC08B424A9205"/> | ||
</capability> | ||
<requirement namespace="osgi.wiring.package"> | ||
<directive name="filter" value="(osgi.wiring.package=javax.xml.namespace)"/> | ||
<attribute name="osgi.wiring.package" value="javax.xml.namespace"/> | ||
</requirement> | ||
<requirement namespace="osgi.wiring.package"> | ||
<directive name="filter" value="(osgi.wiring.package=javax.xml.stream)"/> | ||
<attribute name="osgi.wiring.package" value="javax.xml.stream"/> | ||
</requirement> | ||
<requirement namespace="osgi.ee"> | ||
<directive name="filter" value="(&(osgi.ee=JavaSE)(version=1.8))"/> | ||
</requirement> | ||
</resource> | ||
</repository> |
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,11 @@ | ||
<?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-11"> | ||
<attributes> | ||
<attribute name="module" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="aQute.bnd.classpath.container"/> | ||
<classpathentry kind="src" output="bin" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</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,2 @@ | ||
/bin/ | ||
/bin_test/ |
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.gecko.emf.exporter.ods.tests</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>bndtools.core.bndbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>bndtools.core.bndnature</nature> | ||
</natures> | ||
</projectDescription> |
6 changes: 6 additions & 0 deletions
6
org.gecko.emf.exporter.ods.tests/.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,6 @@ | ||
eclipse.preferences.version=1 | ||
encoding//.settings/org.eclipse.core.resources.prefs=UTF-8 | ||
encoding//.settings/org.eclipse.jdt.core.prefs=UTF-8 | ||
encoding//.settings/org.eclipse.jdt.ui.prefs=UTF-8 | ||
encoding/bnd.bnd=UTF-8 | ||
encoding/test.bndrun=UTF-8 |
14 changes: 14 additions & 0 deletions
14
org.gecko.emf.exporter.ods.tests/.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,14 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=11 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning | ||
org.eclipse.jdt.core.compiler.release=enabled | ||
org.eclipse.jdt.core.compiler.source=11 |
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,17 @@ | ||
-enable-junit5: true | ||
-library: enable-emf | ||
|
||
javac.source: 11 | ||
javac.target: 11 | ||
|
||
Bundle-Version: 1.0.0.SNAPSHOT | ||
|
||
-buildpath: \ | ||
org.gecko.emf.osgi.component,\ | ||
org.eclipse.emf.ecore.xmi,\ | ||
org.eclipse.emf.ecore,\ | ||
org.gecko.emf.osgi.example.model.basic,\ | ||
org.gecko.emf.exporter;version=latest,\ | ||
org.apache.commons.commons-text,\ | ||
org.gecko.emf.util.model,\ | ||
com.github.miachm.sods |
141 changes: 141 additions & 0 deletions
141
org.gecko.emf.exporter.ods.tests/src/org/gecko/emf/ods/tests/EMFODSExporterTest.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,141 @@ | ||
/** | ||
* Copyright (c) 2012 - 2023 Data In Motion and others. | ||
* All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* Contributors: | ||
* Data In Motion - initial API and implementation | ||
*/ | ||
package org.gecko.emf.ods.tests; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.gecko.emf.ods.tests.helper.EMFODSExporterTestHelper.createBasicPackageResourceSet; | ||
import static org.gecko.emf.ods.tests.helper.EMFODSExporterTestHelper.createBusinessPerson; | ||
import static org.gecko.emf.ods.tests.helper.EMFODSExporterTestHelper.createFlintstonesFamily; | ||
import static org.gecko.emf.ods.tests.helper.EMFODSExporterTestHelper.createRequest; | ||
import static org.gecko.emf.ods.tests.helper.EMFODSExporterTestHelper.createSimpsonFamily; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
import java.io.OutputStream; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import org.eclipse.emf.common.util.URI; | ||
import org.eclipse.emf.ecore.resource.Resource; | ||
import org.eclipse.emf.ecore.resource.ResourceSet; | ||
import org.gecko.emf.exporter.EMFExportOptions; | ||
import org.gecko.emf.exporter.EMFExporter; | ||
import org.gecko.emf.osgi.example.model.basic.BasicFactory; | ||
import org.gecko.emf.osgi.example.model.basic.BasicPackage; | ||
import org.gecko.emf.osgi.example.model.basic.BusinessPerson; | ||
import org.gecko.emf.osgi.example.model.basic.Family; | ||
import org.gecko.emf.utilities.Request; | ||
import org.gecko.emf.utilities.UtilitiesFactory; | ||
import org.junit.jupiter.api.MethodOrderer; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.junit.platform.commons.annotation.Testable; | ||
import org.osgi.framework.ServiceReference; | ||
import org.osgi.test.common.annotation.InjectService; | ||
import org.osgi.test.common.service.ServiceAware; | ||
import org.osgi.test.junit5.context.BundleContextExtension; | ||
import org.osgi.test.junit5.service.ServiceExtension; | ||
|
||
/** | ||
* EMF ODS exporter integration test. | ||
* | ||
* @author Michal H. Siemaszko | ||
*/ | ||
@Testable | ||
@ExtendWith(BundleContextExtension.class) | ||
@ExtendWith(ServiceExtension.class) | ||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) | ||
public class EMFODSExporterTest { | ||
|
||
@Order(value = -1) | ||
@Test | ||
public void testServices( | ||
@InjectService(cardinality = 1, timeout = 4000, filter = "(component.name=EMFODSExporter)") ServiceAware<EMFExporter> emfOdsExporterAware) { | ||
|
||
assertThat(emfOdsExporterAware.getServices()).hasSize(1); | ||
ServiceReference<EMFExporter> emfOdsExporterReference = emfOdsExporterAware.getServiceReference(); | ||
assertThat(emfOdsExporterReference).isNotNull(); | ||
} | ||
|
||
@Test | ||
public void testExportBasicPackageResourceToOds( | ||
@InjectService(cardinality = 1, timeout = 4000, filter = "(component.name=EMFODSExporter)") ServiceAware<EMFExporter> emfOdsExporterAware, | ||
@InjectService BasicFactory basicFactory, @InjectService BasicPackage basicPackage) throws Exception { | ||
|
||
assertThat(emfOdsExporterAware.getServices()).hasSize(1); | ||
EMFExporter emfOdsExporterService = emfOdsExporterAware.getService(); | ||
assertThat(emfOdsExporterService).isNotNull(); | ||
|
||
ResourceSet resourceSet = createBasicPackageResourceSet(basicPackage); | ||
Resource xmiResource = resourceSet.createResource(URI.createURI("basicPackageExporter.test")); | ||
assertNotNull(xmiResource); | ||
|
||
Family simpsonFamily = createSimpsonFamily(basicFactory); | ||
xmiResource.getContents().add(simpsonFamily); | ||
|
||
Family flintstonesFamily = createFlintstonesFamily(basicFactory); | ||
xmiResource.getContents().add(flintstonesFamily); | ||
|
||
BusinessPerson businessPerson = createBusinessPerson(basicFactory); | ||
xmiResource.getContents().add(businessPerson); | ||
|
||
Path filePath = Files.createTempFile("testBasicPackageExport", ".ods"); | ||
|
||
OutputStream fileOutputStream = Files.newOutputStream(filePath); | ||
|
||
// @formatter:off | ||
emfOdsExporterService.exportResourceTo(xmiResource, fileOutputStream, | ||
Map.of( | ||
EMFExportOptions.OPTION_LOCALE, Locale.GERMANY, | ||
EMFExportOptions.OPTION_EXPORT_NONCONTAINMENT, true, | ||
EMFExportOptions.OPTION_EXPORT_METADATA, true, | ||
EMFExportOptions.OPTION_ADJUST_COLUMN_WIDTH, true, | ||
EMFExportOptions.OPTION_GENERATE_LINKS, true, | ||
EMFExportOptions.OPTION_ADD_MAPPING_TABLE, true | ||
) | ||
); | ||
// @formatter:on | ||
} | ||
|
||
@Test | ||
public void testExportUtilitiesPackageResourceToOds( | ||
@InjectService(cardinality = 1, timeout = 4000, filter = "(component.name=EMFODSExporter)") ServiceAware<EMFExporter> emfOdsExporterAware) | ||
throws Exception { | ||
|
||
assertThat(emfOdsExporterAware.getServices()).hasSize(1); | ||
EMFExporter emfOdsExporterService = emfOdsExporterAware.getService(); | ||
assertThat(emfOdsExporterService).isNotNull(); | ||
|
||
Request request = createRequest(UtilitiesFactory.eINSTANCE); | ||
|
||
Path filePath = Files.createTempFile("testUtilitiesPackageExport", ".ods"); | ||
|
||
OutputStream fileOutputStream = Files.newOutputStream(filePath); | ||
|
||
// @formatter:off | ||
emfOdsExporterService.exportEObjectsTo(List.of(request), fileOutputStream, | ||
Map.of( | ||
EMFExportOptions.OPTION_LOCALE, Locale.GERMANY, | ||
EMFExportOptions.OPTION_EXPORT_NONCONTAINMENT, true, | ||
EMFExportOptions.OPTION_EXPORT_METADATA, true, | ||
EMFExportOptions.OPTION_ADJUST_COLUMN_WIDTH, true, | ||
EMFExportOptions.OPTION_GENERATE_LINKS, true, | ||
EMFExportOptions.OPTION_ADD_MAPPING_TABLE, true | ||
) | ||
); | ||
// @formatter:on | ||
} | ||
} |
Oops, something went wrong.