Commit ed7725d0 authored by Romain Bioteau's avatar Romain Bioteau Committed by GitHub

tr(java11) run tests with java 11 (#1540)

* use maven toolchain plugin to run only tests with jdk11
* use jaxb-api from engine dependency
* hack context classloader due to tyyco-surefire-plugin bug
* log a warning when refreshing repository store
* add flag to run tests with java 11
* configure toolchain maven plugin
* test la-builder with java 11
* add jaxws-ri for webservice connector tests

Closes BST-14
parent b236d8b1
......@@ -562,13 +562,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
version="0.0.0"
unpack="false"/>
<plugin
id="javax.xml.bind"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="javax.annotation"
download-size="0"
......
<?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.bonitasoft.studio.bundles</groupId>
<artifactId>plugins</artifactId>
<version>7.9.0-SNAPSHOT</version>
</parent>
<groupId>org.bonitasoft.studio.bundles.plugins</groupId>
<artifactId>bonita-business-data-generator</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.bonitasoft.engine.data</groupId>
<artifactId>bonita-business-data-generator</artifactId>
<version>${engine.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>studio</shadedClassifierName>
<filters>
<!-- exclude eclipse compiler because studio already have it in classpath -->
<filter>
<artifact>org.eclipse.jdt.core.compiler:ecj</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
<filter>
<artifact>javax.xml.bind:jaxb-api</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.sun.xml.fastinfoset:FastInfoset</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
<filter>
<artifact>javax.xml.bind:jsr173_api</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.sun.xml.bind:jaxb-impl</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.sun.xml.bind:jaxb-core</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.sun.istack:istack-commons-runtime</artifact>
<excludes>
<exclude>**</exclude>
</excludes>
</filter>
<!-- exclude bonita-common because studio already have it in classpath -->
<filter>
<artifact>org.bonitasoft.engine:bonita-common</artifact>
<includes>
<include>com/bonitasoft/engine/bdm/*</include>
<include>com/bonitasoft/engine/bdm/dao/*</include>
<include>org/bonitasoft/engine/bdm/dao/*</include>
<include>org/bonitasoft/engine/bdm/lazy/*</include>
<include>org/bonitasoft/engine/bdm/model/field/*</include>
<include>org/bonitasoft/engine/bdm/serialization/*</include>
<include>org/bonitasoft/engine/bdm/validator/rule/composition/*</include>
<include>org/bonitasoft/engine/bdm/validator/rule/*</include>
<include>org/bonitasoft/engine/bdm/validator/*</include>
<include>org/bonitasoft/engine/bdm/*</include>
<include>org/bonitasoft/engine/io/IOUtils.*</include>
<include>org/bonitasoft/engine/xml/parser/*</include>
<include>*</include>
</includes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
......@@ -30,7 +30,7 @@
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.bonitasoft.engine.data</groupId>
<groupId>org.bonitasoft.studio.bundles.plugins</groupId>
<artifactId>bonita-business-data-generator</artifactId>
<version>${engine.version}</version>
<classifier>studio</classifier>
......
......@@ -25,6 +25,7 @@ import static org.mockito.Mockito.when;
import java.io.InputStream;
import org.bonitasoft.engine.bdm.BusinessObjectModelConverter;
import org.bonitasoft.engine.bdm.model.BusinessObject;
import org.bonitasoft.engine.bdm.model.BusinessObjectModel;
import org.bonitasoft.engine.bdm.model.field.FieldType;
......@@ -89,6 +90,7 @@ public class BusinessObjectModelFileStoreTest {
employee.setQualifiedName("org.bonita.Employee");
bdm.addBusinessObject(employee);
fileStoreUnderTest = spy(new BusinessObjectModelFileStore("bdm.zip", store));
doReturn(new BusinessObjectModelConverter()).when(fileStoreUnderTest).getConverter();
doReturn(iResource).when(fileStoreUnderTest).getResource();
doReturn(bdm).when(fileStoreUnderTest).getContent();
}
......
......@@ -66,13 +66,10 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
private static final String DEFINE_BDM_COMMAND_ID = "org.bonitasoft.studio.businessobject.manage";
private final BusinessObjectModelConverter converter;
private final Map<Long, BusinessObjectModel> cachedBusinessObjectModel = new HashMap<>();
public BusinessObjectModelFileStore(final String fileName, final IRepositoryStore<AbstractBDMFileStore> store) {
super(fileName, store);
converter = new BusinessObjectModelConverter();
}
@Override
......@@ -87,7 +84,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
return cachedBusinessObjectModel.get(modificationStamp);
}
try (InputStream contents = resource.getContents()) {
final BusinessObjectModel bom = converter.unmarshall(ByteStreams.toByteArray(contents));
final BusinessObjectModel bom = getConverter().unmarshall(ByteStreams.toByteArray(contents));
cachedBusinessObjectModel.clear();
cachedBusinessObjectModel.put(modificationStamp, bom);
return bom;
......@@ -97,6 +94,10 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
return null;
}
protected BusinessObjectModelConverter getConverter() {
return ((BusinessObjectModelRepositoryStore) getParentStore()).getConverter();
}
@Override
public String getDisplayName() {
return Messages.businessDataModel;
......@@ -107,7 +108,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
Assert.isNotNull(content);
Assert.isLegal(content instanceof BusinessObjectModel);
try {
final byte[] xml = converter.marshall((BusinessObjectModel) content);
final byte[] xml = getConverter().marshall((BusinessObjectModel) content);
final ByteArrayInputStream source = new ByteArrayInputStream(xml);
final IFile resource = getResource();
if (resource.exists()) {
......@@ -198,7 +199,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
@Override
public byte[] toByteArray() {
try {
return converter.zip(getContent());
return getConverter().zip(getContent());
} catch (final Exception e) {
BonitaStudioLog.error(e);
}
......
......@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Optional;
import java.util.Set;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import org.bonitasoft.engine.bdm.BusinessObjectModelConverter;
......@@ -60,6 +61,9 @@ import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.wiring.BundleWiring;
import org.xml.sax.SAXException;
import com.google.common.base.Predicate;
......@@ -81,52 +85,40 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
private static final String BDM_CLIENT_POJO_JAR_NAME = "bdm-client-pojo.jar";
private BusinessObjectModelConverter converter = new BusinessObjectModelConverter();
private BusinessObjectModelConverter converter = new CustomBusinessObjectModelConverter();
static {
extensions.add(BDM_TYPE_EXTENSION);
}
public BusinessObjectModelConverter getConverter() {
return converter;
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#createRepositoryFileStore(java.lang.String)
*/
@Override
public AbstractBDMFileStore createRepositoryFileStore(final String fileName) {
return new BusinessObjectModelFileStore(fileName, this);
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getName()
*/
@Override
public String getName() {
return STORE_NAME;
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getDisplayName()
*/
@Override
public String getDisplayName() {
return Messages.businessObjectRepositoryStoreName;
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getIcon()
*/
@Override
public Image getIcon() {
return Pics.getImage("bdm.png", BusinessObjectPlugin.getDefault());
}
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getCompatibleExtensions()
*/
@Override
public Set<String> getCompatibleExtensions() {
return extensions;
......@@ -150,7 +142,7 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
F fileStore = null;
if (BusinessObjectModelFileStore.ZIP_FILENAME.equals(fileName)) {
try {
final BusinessObjectModelConverter converter = new BusinessObjectModelConverter();
BusinessObjectModelConverter converter = getConverter();
final BusinessObjectModel businessObjectModel = converter.unzip(ByteStreams.toByteArray(inputStream));
try (InputStream is = ByteSource.wrap(converter.marshall(businessObjectModel)).openBufferedStream()) {
fileStore = superDoImportInputStream(BusinessObjectModelFileStore.BOM_FILENAME, is);
......@@ -186,6 +178,7 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
final File legacyBDM = fStore.getResource().getLocation().toFile();
BusinessObjectModel businessObjectModel;
try {
BusinessObjectModelConverter converter = getConverter();
businessObjectModel = converter.unzip(Files.toByteArray(legacyBDM));
try (InputStream is = ByteSource.wrap(converter.marshall(businessObjectModel)).openBufferedStream()) {
doImportInputStream(BusinessObjectModelFileStore.BOM_FILENAME, is);
......@@ -195,7 +188,6 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
} catch (IOException | JAXBException | SAXException e1) {
throw new MigrationException("Failed to migrate Business data model", e1);
}
fStore.getResource().delete(true, monitor);
}
}
......
/**
* Copyright (C) 2019 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2.0 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.bonitasoft.studio.businessobject.core.repository;
import java.io.IOException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import org.bonitasoft.engine.bdm.BusinessObjectModelConverter;
import org.bonitasoft.engine.bdm.model.BusinessObjectModel;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.wiring.BundleWiring;
import org.xml.sax.SAXException;
public class CustomBusinessObjectModelConverter extends BusinessObjectModelConverter {
@Override
public byte[] marshall(BusinessObjectModel bom) throws JAXBException, IOException, SAXException {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Bundle bundle = FrameworkUtil.getBundle(JAXBContext.class);
ClassLoader bundleClassloader = bundle.adapt(BundleWiring.class).getClassLoader();
//Due to some issue with tycho-surefire-plugin we need to set the proper context classloader
Thread.currentThread().setContextClassLoader(bundleClassloader);
return super.marshall(bom);
}finally {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
@Override
public BusinessObjectModel unmarshall(byte[] bomXML) throws JAXBException, IOException, SAXException {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Bundle bundle = FrameworkUtil.getBundle(JAXBContext.class);
ClassLoader bundleClassloader = bundle.adapt(BundleWiring.class).getClassLoader();
//Due to some issue with tycho-surefire-plugin we need to set the proper context classloader
Thread.currentThread().setContextClassLoader(bundleClassloader);
return super.unmarshall(bomXML);
}finally {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
}
......@@ -73,6 +73,7 @@ public class ProjectManifestFactory {
symbolicName = DEFAULT_SYMBOLIC_NAME;
}
headers.put(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, symbolicName);
headers.put("Automatic-Module-Name", symbolicName);
headers.put(org.osgi.framework.Constants.BUNDLE_VERSION, "1.0.0.qualifier");
headers.put(org.osgi.framework.Constants.BUNDLE_VENDOR, "Bonitasoft S.A.");
headers.put(org.osgi.framework.Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-1.8");
......
......@@ -340,7 +340,7 @@ public abstract class AbstractRepositoryStore<T extends IRepositoryFileStore> im
try {
folder.refreshLocal(IResource.DEPTH_INFINITE, Repository.NULL_PROGRESS_MONITOR);
} catch (final CoreException e1) {
BonitaStudioLog.error(e1);
BonitaStudioLog.warning(String.format("An error occured wihle refreshing folder %s: %s",folder.getName(),e1.getMessage()),CommonRepositoryPlugin.PLUGIN_ID);
}
}
}
......
......@@ -7,5 +7,6 @@
<classpathentry exported="true" kind="lib" path="lib/console-server.jar"/>
<classpathentry exported="true" kind="lib" path="lib/console-common.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-lang3.jar"/>
<classpathentry kind="lib" path="lib/jaxb-api.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Manifest-Version: 1.0
Bundle-ClassPath: .,lib/bonita-client.jar,lib/jaxb-impl.jar,lib/jaxb-cor
e.jar,lib/istack-commons-runtime.jar,lib/FastInfoset.jar,lib/httpclient
.jar,lib/httpcore.jar,lib/commons-logging.jar,lib/xstream.jar,lib/xmlpu
ll.jar,lib/xpp3_min.jar,lib/httpmime.jar,lib/commons-codec.jar,lib/boni
ta-common.jar,lib/commons-io.jar,lib/jackson-databind.jar,lib/jackson-c
ore.jar,lib/slf4j-api.jar,lib/commons-lang3.jar,lib/jackson-annotations
.jar,lib/console-server.jar,lib/console-common.jar
Bundle-ClassPath: .,lib/bonita-client.jar,lib/jaxb-api.jar,lib/jaxb-impl
.jar,lib/jaxb-core.jar,lib/istack-commons-runtime.jar,lib/FastInfoset.j
ar,lib/httpclient.jar,lib/httpcore.jar,lib/commons-logging.jar,lib/xstr
eam.jar,lib/xmlpull.jar,lib/xpp3_min.jar,lib/httpmime.jar,lib/commons-c
odec.jar,lib/bonita-common.jar,lib/commons-io.jar,lib/jackson-databind.
jar,lib/jackson-core.jar,lib/slf4j-api.jar,lib/commons-lang3.jar,lib/ja
ckson-annotations.jar,lib/console-server.jar,lib/console-common.jar
Bundle-ManifestVersion: 2
Bundle-Name: Bonita Community Tomcat Bundle
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
......@@ -19,28 +19,29 @@ Embed-Directory: lib
Embed-StripVersion: true
Embed-Transitive: true
Embedded-Artifacts: lib/bonita-client.jar;g="org.bonitasoft.engine";a="b
onita-client";v="7.9.0-SNAPSHOT",lib/jaxb-impl.jar;g="com.sun.xml.bind"
;a="jaxb-impl";v="2.2.7",lib/jaxb-core.jar;g="com.sun.xml.bind";a="jaxb
-core";v="2.2.7",lib/istack-commons-runtime.jar;g="com.sun.istack";a="i
stack-commons-runtime";v="2.16",lib/FastInfoset.jar;g="com.sun.xml.fast
infoset";a="FastInfoset";v="1.2.12",lib/httpclient.jar;g="org.apache.ht
tpcomponents";a="httpclient";v="4.5.2",lib/httpcore.jar;g="org.apache.h
ttpcomponents";a="httpcore";v="4.4.4",lib/commons-logging.jar;g="common
s-logging";a="commons-logging";v="1.2",lib/xstream.jar;g="com.thoughtwo
rks.xstream";a="xstream";v="1.4.10",lib/xmlpull.jar;g="xmlpull";a="xmlp
ull";v="1.1.3.1",lib/xpp3_min.jar;g="xpp3";a="xpp3_min";v="1.1.4c",lib/
httpmime.jar;g="org.apache.httpcomponents";a="httpmime";v="4.5.2",lib/c
ommons-codec.jar;g="commons-codec";a="commons-codec";v="1.7",lib/bonita
-common.jar;g="org.bonitasoft.engine";a="bonita-common";v="7.9.0-SNAPSH
OT",lib/commons-io.jar;g="commons-io";a="commons-io";v="2.5",lib/jackso
n-databind.jar;g="com.fasterxml.jackson.core";a="jackson-databind";v="2
.9.0",lib/jackson-core.jar;g="com.fasterxml.jackson.core";a="jackson-co
re";v="2.9.0",lib/slf4j-api.jar;g="org.slf4j";a="slf4j-api";v="1.7.25",
lib/commons-lang3.jar;g="org.apache.commons";a="commons-lang3";v="3.3.2
",lib/jackson-annotations.jar;g="com.fasterxml.jackson.core";a="jackson
-annotations";v="2.9.0",lib/console-server.jar;g="org.bonitasoft.consol
e";a="console-server";v="7.9.0-SNAPSHOT";c="classes",lib/console-common
.jar;g="org.bonitasoft.console";a="console-common";v="7.9.0-SNAPSHOT"
onita-client";v="7.9.0-SNAPSHOT",lib/jaxb-api.jar;g="javax.xml.bind";a=
"jaxb-api";v="2.2.7",lib/jaxb-impl.jar;g="com.sun.xml.bind";a="jaxb-imp
l";v="2.2.7",lib/jaxb-core.jar;g="com.sun.xml.bind";a="jaxb-core";v="2.
2.7",lib/istack-commons-runtime.jar;g="com.sun.istack";a="istack-common
s-runtime";v="2.16",lib/FastInfoset.jar;g="com.sun.xml.fastinfoset";a="
FastInfoset";v="1.2.12",lib/httpclient.jar;g="org.apache.httpcomponents
";a="httpclient";v="4.5.2",lib/httpcore.jar;g="org.apache.httpcomponent
s";a="httpcore";v="4.4.4",lib/commons-logging.jar;g="commons-logging";a
="commons-logging";v="1.2",lib/xstream.jar;g="com.thoughtworks.xstream"
;a="xstream";v="1.4.10",lib/xmlpull.jar;g="xmlpull";a="xmlpull";v="1.1.
3.1",lib/xpp3_min.jar;g="xpp3";a="xpp3_min";v="1.1.4c",lib/httpmime.jar
;g="org.apache.httpcomponents";a="httpmime";v="4.5.2",lib/commons-codec
.jar;g="commons-codec";a="commons-codec";v="1.7",lib/bonita-common.jar;
g="org.bonitasoft.engine";a="bonita-common";v="7.9.0-SNAPSHOT",lib/comm
ons-io.jar;g="commons-io";a="commons-io";v="2.5",lib/jackson-databind.j
ar;g="com.fasterxml.jackson.core";a="jackson-databind";v="2.9.0",lib/ja
ckson-core.jar;g="com.fasterxml.jackson.core";a="jackson-core";v="2.9.0
",lib/slf4j-api.jar;g="org.slf4j";a="slf4j-api";v="1.7.25",lib/commons-
lang3.jar;g="org.apache.commons";a="commons-lang3";v="3.3.2",lib/jackso
n-annotations.jar;g="com.fasterxml.jackson.core";a="jackson-annotations
";v="2.9.0",lib/console-server.jar;g="org.bonitasoft.console";a="consol
e-server";v="7.9.0-SNAPSHOT";c="classes",lib/console-common.jar;g="org.
bonitasoft.console";a="console-common";v="7.9.0-SNAPSHOT"
Export-Package: org.bonitasoft.console.common.server.preferences.constan
ts;version="0.0.0",org.bonitasoft.console.common.server.preferences.pro
perties;version="0.0.0",org.bonitasoft.console.common.server.sso;versio
......@@ -112,43 +113,48 @@ Export-Package: org.bonitasoft.console.common.server.preferences.constan
.theme.exception;version="0.0.0",org.bonitasoft.engine.theme.impl;versi
on="0.0.0",org.bonitasoft.engine.util;version="0.0.0",org.bonitasoft.en
gine.xml;version="0.0.0",org.bonitasoft.engine.xml.parser;version="0.0.
0"
0",javax.xml.bind;version="2.2.0",javax.xml.bind.annotation;version="2.
2.0",javax.xml.bind.annotation.adapters;version="2.2.0",javax.xml.bind.
attachment;version="2.2.0",javax.xml.bind.helpers;version="2.2.0",javax
.xml.bind.util;version="2.2.0"
Include-Resource: , lib/bonita-client.jar=/home/romain/.m2/repository/or
g/bonitasoft/engine/bonita-client/7.9.0-SNAPSHOT/bonita-client-7.9.0-SN
APSHOT.jar,lib/jaxb-impl.jar=/home/romain/.m2/repository/com/sun/xml/bi
nd/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar,lib/jaxb-core.jar=/home/romain/.
m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/jaxb-core-2.2.7.jar,lib/
istack-commons-runtime.jar=/home/romain/.m2/repository/com/sun/istack/i
stack-commons-runtime/2.16/istack-commons-runtime-2.16.jar,lib/FastInfo
set.jar=/home/romain/.m2/repository/com/sun/xml/fastinfoset/FastInfoset
/1.2.12/FastInfoset-1.2.12.jar,lib/httpclient.jar=/home/romain/.m2/repo
sitory/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.jar,
lib/httpcore.jar=/home/romain/.m2/repository/org/apache/httpcomponents/
httpcore/4.4.4/httpcore-4.4.4.jar,lib/commons-logging.jar=/home/romain/
.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.
jar,lib/xstream.jar=/home/romain/.m2/repository/com/thoughtworks/xstrea
m/xstream/1.4.10/xstream-1.4.10.jar,lib/xmlpull.jar=/home/romain/.m2/re
pository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar,lib/xpp3_min.jar=/
home/romain/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar,lib
/httpmime.jar=/home/romain/.m2/repository/org/apache/httpcomponents/htt
pmime/4.5.2/httpmime-4.5.2.jar,lib/commons-codec.jar=/home/romain/.m2/r
epository/commons-codec/commons-codec/1.7/commons-codec-1.7.jar,lib/bon
ita-common.jar=/home/romain/.m2/repository/org/bonitasoft/engine/bonita
-common/7.9.0-SNAPSHOT/bonita-common-7.9.0-SNAPSHOT.jar,lib/commons-io.
jar=/home/romain/.m2/repository/commons-io/commons-io/2.5/commons-io-2.
5.jar,lib/jackson-databind.jar=/home/romain/.m2/repository/com/fasterxm
l/jackson/core/jackson-databind/2.9.0/jackson-databind-2.9.0.jar,lib/ja
ckson-core.jar=/home/romain/.m2/repository/com/fasterxml/jackson/core/j
ackson-core/2.9.0/jackson-core-2.9.0.jar,lib/slf4j-api.jar=/home/romain
/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar,lib/com
mons-lang3.jar=/home/romain/.m2/repository/org/apache/commons/commons-l
ang3/3.3.2/commons-lang3-3.3.2.jar,lib/jackson-annotations.jar=/home/ro
main/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.
0/jackson-annotations-2.9.0.jar,lib/console-server.jar=/home/romain/.m2
/repository/org/bonitasoft/console/console-server/7.9.0-SNAPSHOT/consol
e-server-7.9.0-SNAPSHOT-classes.jar,lib/console-common.jar=/home/romain
/.m2/repository/org/bonitasoft/console/console-common/7.9.0-SNAPSHOT/co
nsole-common-7.9.0-SNAPSHOT.jar,javadoc.zip,plugin.xml,tomcat=tomcat
APSHOT.jar,lib/jaxb-api.jar=/home/romain/.m2/repository/javax/xml/bind/
jaxb-api/2.2.7/jaxb-api-2.2.7.jar,lib/jaxb-impl.jar=/home/romain/.m2/re
pository/com/sun/xml/bind/jaxb-impl/2.2.7/jaxb-impl-2.2.7.jar,lib/jaxb-
core.jar=/home/romain/.m2/repository/com/sun/xml/bind/jaxb-core/2.2.7/j
axb-core-2.2.7.jar,lib/istack-commons-runtime.jar=/home/romain/.m2/repo
sitory/com/sun/istack/istack-commons-runtime/2.16/istack-commons-runtim
e-2.16.jar,lib/FastInfoset.jar=/home/romain/.m2/repository/com/sun/xml/
fastinfoset/FastInfoset/1.2.12/FastInfoset-1.2.12.jar,lib/httpclient.ja
r=/home/romain/.m2/repository/org/apache/httpcomponents/httpclient/4.5.
2/httpclient-4.5.2.jar,lib/httpcore.jar=/home/romain/.m2/repository/org
/apache/httpcomponents/httpcore/4.4.4/httpcore-4.4.4.jar,lib/commons-lo
gging.jar=/home/romain/.m2/repository/commons-logging/commons-logging/1
.2/commons-logging-1.2.jar,lib/xstream.jar=/home/romain/.m2/repository/
com/thoughtworks/xstream/xstream/1.4.10/xstream-1.4.10.jar,lib/xmlpull.
jar=/home/romain/.m2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1
.jar,lib/xpp3_min.jar=/home/romain/.m2/repository/xpp3/xpp3_min/1.1.4c/
xpp3_min-1.1.4c.jar,lib/httpmime.jar=/home/romain/.m2/repository/org/ap
ache/httpcomponents/httpmime/4.5.2/httpmime-4.5.2.jar,lib/commons-codec
.jar=/home/romain/.m2/repository/commons-codec/commons-codec/1.7/common
s-codec-1.7.jar,lib/bonita-common.jar=/home/romain/.m2/repository/org/b
onitasoft/engine/bonita-common/7.9.0-SNAPSHOT/bonita-common-7.9.0-SNAPS
HOT.jar,lib/commons-io.jar=/home/romain/.m2/repository/commons-io/commo
ns-io/2.5/commons-io-2.5.jar,lib/jackson-databind.jar=/home/romain/.m2/
repository/com/fasterxml/jackson/core/jackson-databind/2.9.0/jackson-da
tabind-2.9.0.jar,lib/jackson-core.jar=/home/romain/.m2/repository/com/f
asterxml/jackson/core/jackson-core/2.9.0/jackson-core-2.9.0.jar,lib/slf
4j-api.jar=/home/romain/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j
-api-1.7.25.jar,lib/commons-lang3.jar=/home/romain/.m2/repository/org/a
pache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar,lib/jackson-a
nnotations.jar=/home/romain/.m2/repository/com/fasterxml/jackson/core/j
ackson-annotations/2.9.0/jackson-annotations-2.9.0.jar,lib/console-serv
er.jar=/home/romain/.m2/repository/org/bonitasoft/console/console-serve
r/7.9.0-SNAPSHOT/console-server-7.9.0-SNAPSHOT-classes.jar,lib/console-
common.jar=/home/romain/.m2/repository/org/bonitasoft/console/console-c
ommon/7.9.0-SNAPSHOT/console-common-7.9.0-SNAPSHOT.jar,javadoc.zip,plug
in.xml,tomcat=tomcat
Private-Package: lib,tomcat,tomcat.server,tomcat.server.bin,tomcat.serve
r.conf.Catalina.localhost,tomcat.server.conf,tomcat.server.lib,tomcat.s
erver.lib.bonita,tomcat.server.logs,tomcat.server.temp,tomcat.server.we
......@@ -336,4 +342,5 @@ Private-Package: lib,tomcat,tomcat.server,tomcat.server.bin,tomcat.serve
ent.data.item.template,org.bonitasoft.web.toolkit.client.ui,org.bonitas
oft.web.toolkit.client.ui.utils,org.bonitasoft.web.toolkit.client.ui.ut
ils.dateformat
Require-Bundle: javax.activation;bundle-version="1.1.0"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
......@@ -32,10 +32,6 @@
<groupId>javax.xml.bind</groupId>
<artifactId>jsr173_api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......@@ -47,10 +43,6 @@
<groupId>javax.xml.bind</groupId>
<artifactId>jsr173_api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......@@ -279,7 +271,8 @@
org.bonitasoft.console.common.server.sso;version="0.0.0",
!org.bonitasoft.engine.*.impl.db;version="0.0.0",
!org.bonitasoft.engine.*.impl.db.archive;version="0.0.0",
org.bonitasoft.engine.*;version="0.0.0"
org.bonitasoft.engine.*;version="0.0.0",
javax.xml.bind.*;version="2.2.0"
</_exportcontents>
<_nouses>true</_nouses>
<Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
......@@ -298,6 +291,7 @@
<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
<Import-Package>!*</Import-Package>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Require-Bundle>javax.activation;bundle-version="1.1.0"</Require-Bundle>
</instructions>
</configuration>
<executions>
......
......@@ -20,6 +20,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBContext;
import org.bonitasoft.engine.bpm.bar.BusinessArchive;
import org.bonitasoft.engine.bpm.bar.BusinessArchiveFactory;
import org.bonitasoft.studio.common.jface.FileActionDialog;
......@@ -34,6 +36,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.wiring.BundleWiring;
/**
* @author Romain Bioteau
......@@ -110,7 +115,19 @@ public class ExportBarOperation implements IRunnableWithProgress {
IProgressMonitor.UNKNOWN);
try {
final BusinessArchive bar = getBarExporter().createBusinessArchive(process, configurationId);
writeBusinessArchiveToFile(outputFile, bar);
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Bundle bundle = FrameworkUtil.getBundle(JAXBContext.class);
if(bundle != null ) {
ClassLoader bundleClassloader = bundle.adapt(BundleWiring.class).getClassLoader();
//Due to some issue with tycho-surefire-plugin we need to set the proper context classloader
Thread.currentThread().setContextClassLoader(bundleClassloader);
}
writeBusinessArchiveToFile(outputFile, bar);
} finally {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
generatedBars.add(outputFile);
} catch (final Exception ex) {
BonitaStudioLog.error(ex);
......
......@@ -28,24 +28,27 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.bonitasoft.engine.business.application.ApplicationState;
import org.bonitasoft.engine.business.application.exporter.ApplicationNodeContainerConverter;
import org.bonitasoft.engine.business.application.xml.ApplicationNodeBuilder;
import org.bonitasoft.engine.business.application.xml.ApplicationNodeContainer;
import org.bonitasoft.studio.common.repository.Repository;
import org.bonitasoft.studio.common.repository.model.IRepositoryStore;
import org.bonitasoft.studio.la.application.repository.ApplicationFileStore;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
public class ApplicationFileStoreTest {
private InputStream resourceAsStream;
private ApplicationRepositoryStore store;
@Before
public void openStreams() throws Exception {
resourceAsStream = ApplicationFileStoreTest.class.getResourceAsStream("/myApp.xml");
store = mock(ApplicationRepositoryStore.class);
Mockito.when(store.getConverter()).thenReturn(new ApplicationNodeContainerConverter());
}
@After
......@@ -55,7 +58,7 @@ public class ApplicationFileStoreTest {
@Test
public void should_retrieve_model_from_application_xml_file() throws Exception {