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/>. ...@@ -562,13 +562,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="javax.xml.bind"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="javax.annotation" id="javax.annotation"
download-size="0" 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 @@ ...@@ -30,7 +30,7 @@
<configuration> <configuration>
<artifactItems> <artifactItems>
<artifactItem> <artifactItem>
<groupId>org.bonitasoft.engine.data</groupId> <groupId>org.bonitasoft.studio.bundles.plugins</groupId>
<artifactId>bonita-business-data-generator</artifactId> <artifactId>bonita-business-data-generator</artifactId>
<version>${engine.version}</version> <version>${engine.version}</version>
<classifier>studio</classifier> <classifier>studio</classifier>
......
...@@ -25,6 +25,7 @@ import static org.mockito.Mockito.when; ...@@ -25,6 +25,7 @@ import static org.mockito.Mockito.when;
import java.io.InputStream; import java.io.InputStream;
import org.bonitasoft.engine.bdm.BusinessObjectModelConverter;
import org.bonitasoft.engine.bdm.model.BusinessObject; import org.bonitasoft.engine.bdm.model.BusinessObject;
import org.bonitasoft.engine.bdm.model.BusinessObjectModel; import org.bonitasoft.engine.bdm.model.BusinessObjectModel;
import org.bonitasoft.engine.bdm.model.field.FieldType; import org.bonitasoft.engine.bdm.model.field.FieldType;
...@@ -89,6 +90,7 @@ public class BusinessObjectModelFileStoreTest { ...@@ -89,6 +90,7 @@ public class BusinessObjectModelFileStoreTest {
employee.setQualifiedName("org.bonita.Employee"); employee.setQualifiedName("org.bonita.Employee");
bdm.addBusinessObject(employee); bdm.addBusinessObject(employee);
fileStoreUnderTest = spy(new BusinessObjectModelFileStore("bdm.zip", store)); fileStoreUnderTest = spy(new BusinessObjectModelFileStore("bdm.zip", store));
doReturn(new BusinessObjectModelConverter()).when(fileStoreUnderTest).getConverter();
doReturn(iResource).when(fileStoreUnderTest).getResource(); doReturn(iResource).when(fileStoreUnderTest).getResource();
doReturn(bdm).when(fileStoreUnderTest).getContent(); doReturn(bdm).when(fileStoreUnderTest).getContent();
} }
......
...@@ -66,13 +66,10 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement ...@@ -66,13 +66,10 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
private static final String DEFINE_BDM_COMMAND_ID = "org.bonitasoft.studio.businessobject.manage"; 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<>(); private final Map<Long, BusinessObjectModel> cachedBusinessObjectModel = new HashMap<>();
public BusinessObjectModelFileStore(final String fileName, final IRepositoryStore<AbstractBDMFileStore> store) { public BusinessObjectModelFileStore(final String fileName, final IRepositoryStore<AbstractBDMFileStore> store) {
super(fileName, store); super(fileName, store);
converter = new BusinessObjectModelConverter();
} }
@Override @Override
...@@ -87,7 +84,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement ...@@ -87,7 +84,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
return cachedBusinessObjectModel.get(modificationStamp); return cachedBusinessObjectModel.get(modificationStamp);
} }
try (InputStream contents = resource.getContents()) { try (InputStream contents = resource.getContents()) {
final BusinessObjectModel bom = converter.unmarshall(ByteStreams.toByteArray(contents)); final BusinessObjectModel bom = getConverter().unmarshall(ByteStreams.toByteArray(contents));
cachedBusinessObjectModel.clear(); cachedBusinessObjectModel.clear();
cachedBusinessObjectModel.put(modificationStamp, bom); cachedBusinessObjectModel.put(modificationStamp, bom);
return bom; return bom;
...@@ -97,6 +94,10 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement ...@@ -97,6 +94,10 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
return null; return null;
} }
protected BusinessObjectModelConverter getConverter() {
return ((BusinessObjectModelRepositoryStore) getParentStore()).getConverter();
}
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return Messages.businessDataModel; return Messages.businessDataModel;
...@@ -107,7 +108,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement ...@@ -107,7 +108,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
Assert.isNotNull(content); Assert.isNotNull(content);
Assert.isLegal(content instanceof BusinessObjectModel); Assert.isLegal(content instanceof BusinessObjectModel);
try { try {
final byte[] xml = converter.marshall((BusinessObjectModel) content); final byte[] xml = getConverter().marshall((BusinessObjectModel) content);
final ByteArrayInputStream source = new ByteArrayInputStream(xml); final ByteArrayInputStream source = new ByteArrayInputStream(xml);
final IFile resource = getResource(); final IFile resource = getResource();
if (resource.exists()) { if (resource.exists()) {
...@@ -198,7 +199,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement ...@@ -198,7 +199,7 @@ public class BusinessObjectModelFileStore extends AbstractBDMFileStore implement
@Override @Override
public byte[] toByteArray() { public byte[] toByteArray() {
try { try {
return converter.zip(getContent()); return getConverter().zip(getContent());
} catch (final Exception e) { } catch (final Exception e) {
BonitaStudioLog.error(e); BonitaStudioLog.error(e);
} }
......
...@@ -29,6 +29,7 @@ import java.util.List; ...@@ -29,6 +29,7 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import org.bonitasoft.engine.bdm.BusinessObjectModelConverter; import org.bonitasoft.engine.bdm.BusinessObjectModelConverter;
...@@ -60,6 +61,9 @@ import org.eclipse.jdt.core.ITypeHierarchy; ...@@ -60,6 +61,9 @@ import org.eclipse.jdt.core.ITypeHierarchy;
import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.swt.graphics.Image; 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 org.xml.sax.SAXException;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
...@@ -81,52 +85,40 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore> ...@@ -81,52 +85,40 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
private static final String BDM_CLIENT_POJO_JAR_NAME = "bdm-client-pojo.jar"; private static final String BDM_CLIENT_POJO_JAR_NAME = "bdm-client-pojo.jar";
private BusinessObjectModelConverter converter = new BusinessObjectModelConverter(); private BusinessObjectModelConverter converter = new CustomBusinessObjectModelConverter();
static { static {
extensions.add(BDM_TYPE_EXTENSION); extensions.add(BDM_TYPE_EXTENSION);
} }
/*
* (non-Javadoc) public BusinessObjectModelConverter getConverter() {
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#createRepositoryFileStore(java.lang.String) return converter;
*/ }
@Override @Override
public AbstractBDMFileStore createRepositoryFileStore(final String fileName) { public AbstractBDMFileStore createRepositoryFileStore(final String fileName) {
return new BusinessObjectModelFileStore(fileName, this); return new BusinessObjectModelFileStore(fileName, this);
} }
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getName()
*/
@Override @Override
public String getName() { public String getName() {
return STORE_NAME; return STORE_NAME;
} }
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getDisplayName()
*/
@Override @Override
public String getDisplayName() { public String getDisplayName() {
return Messages.businessObjectRepositoryStoreName; return Messages.businessObjectRepositoryStoreName;
} }
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getIcon()
*/
@Override @Override
public Image getIcon() { public Image getIcon() {
return Pics.getImage("bdm.png", BusinessObjectPlugin.getDefault()); return Pics.getImage("bdm.png", BusinessObjectPlugin.getDefault());
} }
/*
* (non-Javadoc)
* @see org.bonitasoft.studio.common.repository.model.IRepositoryStore#getCompatibleExtensions()
*/
@Override @Override
public Set<String> getCompatibleExtensions() { public Set<String> getCompatibleExtensions() {
return extensions; return extensions;
...@@ -150,7 +142,7 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore> ...@@ -150,7 +142,7 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
F fileStore = null; F fileStore = null;
if (BusinessObjectModelFileStore.ZIP_FILENAME.equals(fileName)) { if (BusinessObjectModelFileStore.ZIP_FILENAME.equals(fileName)) {
try { try {
final BusinessObjectModelConverter converter = new BusinessObjectModelConverter(); BusinessObjectModelConverter converter = getConverter();
final BusinessObjectModel businessObjectModel = converter.unzip(ByteStreams.toByteArray(inputStream)); final BusinessObjectModel businessObjectModel = converter.unzip(ByteStreams.toByteArray(inputStream));
try (InputStream is = ByteSource.wrap(converter.marshall(businessObjectModel)).openBufferedStream()) { try (InputStream is = ByteSource.wrap(converter.marshall(businessObjectModel)).openBufferedStream()) {
fileStore = superDoImportInputStream(BusinessObjectModelFileStore.BOM_FILENAME, is); fileStore = superDoImportInputStream(BusinessObjectModelFileStore.BOM_FILENAME, is);
...@@ -186,6 +178,7 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore> ...@@ -186,6 +178,7 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
final File legacyBDM = fStore.getResource().getLocation().toFile(); final File legacyBDM = fStore.getResource().getLocation().toFile();
BusinessObjectModel businessObjectModel; BusinessObjectModel businessObjectModel;
try { try {
BusinessObjectModelConverter converter = getConverter();
businessObjectModel = converter.unzip(Files.toByteArray(legacyBDM)); businessObjectModel = converter.unzip(Files.toByteArray(legacyBDM));
try (InputStream is = ByteSource.wrap(converter.marshall(businessObjectModel)).openBufferedStream()) { try (InputStream is = ByteSource.wrap(converter.marshall(businessObjectModel)).openBufferedStream()) {
doImportInputStream(BusinessObjectModelFileStore.BOM_FILENAME, is); doImportInputStream(BusinessObjectModelFileStore.BOM_FILENAME, is);
...@@ -195,7 +188,6 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore> ...@@ -195,7 +188,6 @@ public class BusinessObjectModelRepositoryStore<F extends AbstractBDMFileStore>
} catch (IOException | JAXBException | SAXException e1) { } catch (IOException | JAXBException | SAXException e1) {
throw new MigrationException("Failed to migrate Business data model", e1); throw new MigrationException("Failed to migrate Business data model", e1);
} }
fStore.getResource().delete(true, monitor); 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 { ...@@ -73,6 +73,7 @@ public class ProjectManifestFactory {
symbolicName = DEFAULT_SYMBOLIC_NAME; symbolicName = DEFAULT_SYMBOLIC_NAME;
} }
headers.put(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, symbolicName); 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_VERSION, "1.0.0.qualifier");
headers.put(org.osgi.framework.Constants.BUNDLE_VENDOR, "Bonitasoft S.A."); headers.put(org.osgi.framework.Constants.BUNDLE_VENDOR, "Bonitasoft S.A.");
headers.put(org.osgi.framework.Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-1.8"); headers.put(org.osgi.framework.Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "JavaSE-1.8");
......
...@@ -340,7 +340,7 @@ public abstract class AbstractRepositoryStore<T extends IRepositoryFileStore> im ...@@ -340,7 +340,7 @@ public abstract class AbstractRepositoryStore<T extends IRepositoryFileStore> im
try { try {
folder.refreshLocal(IResource.DEPTH_INFINITE, Repository.NULL_PROGRESS_MONITOR); folder.refreshLocal(IResource.DEPTH_INFINITE, Repository.NULL_PROGRESS_MONITOR);
} catch (final CoreException e1) { } 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 @@ ...@@ -7,5 +7,6 @@
<classpathentry exported="true" kind="lib" path="lib/console-server.jar"/> <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/console-common.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-lang3.jar"/> <classpathentry exported="true" kind="lib" path="lib/commons-lang3.jar"/>
<classpathentry kind="lib" path="lib/jaxb-api.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
...@@ -31,10 +31,6 @@ ...@@ -31,10 +31,6 @@
<exclusion> <exclusion>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jsr173_api</artifactId> <artifactId>jsr173_api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
...@@ -46,10 +42,6 @@ ...@@ -46,10 +42,6 @@
<exclusion> <exclusion>
<groupId>javax.xml.bind</groupId> <groupId>javax.xml.bind</groupId>
<artifactId>jsr173_api</artifactId> <artifactId>jsr173_api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
...@@ -279,7 +271,8 @@ ...@@ -279,7 +271,8 @@
org.bonitasoft.console.common.server.sso;version="0.0.0", org.bonitasoft.console.common.server.sso;version="0.0.0",
!org.bonitasoft.engine.*.impl.db;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.*.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> </_exportcontents>
<_nouses>true</_nouses> <_nouses>true</_nouses>
<Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName> <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
...@@ -298,6 +291,7 @@ ...@@ -298,6 +291,7 @@
<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath> <Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
<Import-Package>!*</Import-Package> <Import-Package>!*</Import-Package>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Require-Bundle>javax.activation;bundle-version="1.1.0"</Require-Bundle>
</instructions> </instructions>
</configuration> </configuration>
<executions> <executions>
......
...@@ -20,6 +20,8 @@ import java.io.IOException; ...@@ -20,6 +20,8 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.xml.bind.JAXBContext;
import org.bonitasoft.engine.bpm.bar.BusinessArchive; import org.bonitasoft.engine.bpm.bar.BusinessArchive;
import org.bonitasoft.engine.bpm.bar.BusinessArchiveFactory; import org.bonitasoft.engine.bpm.bar.BusinessArchiveFactory;
import org.bonitasoft.studio.common.jface.FileActionDialog; import org.bonitasoft.studio.common.jface.FileActionDialog;
...@@ -34,6 +36,9 @@ import org.eclipse.core.runtime.IProgressMonitor; ...@@ -34,6 +36,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
import org.eclipse.jface.operation.IRunnableWithProgress; 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 * @author Romain Bioteau
...@@ -110,7 +115,19 @@ public class ExportBarOperation implements IRunnableWithProgress { ...@@ -110,7 +115,19 @@ public class ExportBarOperation implements IRunnableWithProgress {
IProgressMonitor.UNKNOWN); IProgressMonitor.UNKNOWN);
try { try {
final BusinessArchive bar = getBarExporter().createBusinessArchive(process, configurationId); final BusinessArchive bar = getBarExporter().createBusinessArchive(process, configurationId);
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); writeBusinessArchiveToFile(outputFile, bar);
} finally {
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
generatedBars.add(outputFile); generatedBars.add(outputFile);
} catch (final Exception ex) { } catch (final Exception ex) {
BonitaStudioLog.error(ex); BonitaStudioLog.error(ex);
......
...@@ -28,24 +28,27 @@ import java.io.ByteArrayInputStream; ...@@ -28,24 +28,27 @@ import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
import org.bonitasoft.engine.business.application.ApplicationState; 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.ApplicationNodeBuilder;
import org.bonitasoft.engine.business.application.xml.ApplicationNodeContainer; import org.bonitasoft.engine.business.application.xml.ApplicationNodeContainer;
import org.bonitasoft.studio.common.repository.Repository; 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.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.mockito.Mockito;
public class ApplicationFileStoreTest { public class ApplicationFileStoreTest {