FYI:
public class MockServerDeployer {
private WebArchive mockServerWebArchive;
@Inject
private Instance<DeploymentDescription> descriptionInstance;
@Inject
@DeploymentScoped
private InstanceProducer<DeploymentDescription> descriptionInstanceProducer;
public void executeBeforeDeploy(@Observes BeforeDeploy event)
throws DeploymentException {
if(mockServerWebArchive == null){
resolveMockServerArchive();
}
DeployableContainer<?> deployableContainer =
event.getDeployableContainer();
final DeploymentDescription old = descriptionInstance.get();
try {
descriptionInstanceProducer.set(new
DeploymentDescription(mockServerWebArchive.getName(),
mockServerWebArchive).shouldBeTestable(false));
deployableContainer.deploy(this.mockServerWebArchive);
} finally {
descriptionInstanceProducer.set(old);
}
}
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014-04-29 13:01 GMT+02:00 Romain Manni-Bucau <[email protected]>:
> you can inject the arquillian producer and produce it then reset it to
> previously initialized value no?
>
> well if you can't you can't rely on it at all IMO since it inherit
> from previous context and it can lead to a lot of side effect.
>
>
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
> 2014-04-29 12:47 GMT+02:00 Àlex Soto <[email protected]>:
>> Although I put the descriptor as not managed it stills throws the
>> application cannot be deployed as it contains deployment -ids .... Exception
>>
>> Enviat des del meu iPhone
>>
>> El 29/04/2014, a les 11.56, Romain Manni-Bucau <[email protected]> va
>> escriure:
>>> Ok
>>>
>>> that's because the mock-server is testable so test class is added to
>>> both war as a managed bean with the same name. Just make the
>>> DeploymentDescription of the mock-server not testable from your
>>> extension.
>>>
>>> Side note: not initializing/resetting it make deployments not
>>> consistent since your deployment inherits from the last test
>>> deployment
>>>
>>>
>>> Romain Manni-Bucau
>>> Twitter: @rmannibucau
>>> Blog: http://rmannibucau.wordpress.com/
>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> Github: https://github.com/rmannibucau
>>>
>>>
>>> 2014-04-29 10:50 GMT+02:00 Alex Soto <[email protected]>:
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.util.JarExtractor extract
>>>> INFO: Extracting jar:
>>>> /tmp/arquillian-tomee-app-working-dir/0/f558050e-f853-40da-baa4-fa9e17c2c629.war
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.util.JarExtractor extract
>>>> INFO: Extracted path:
>>>> /tmp/arquillian-tomee-app-working-dir/0/f558050e-f853-40da-baa4-fa9e17c2c629
>>>> Apr 29, 2014 10:47:46 AM org.apache.tomee.catalina.TomcatWebAppBuilder
>>>> deployWebApps
>>>> INFO: using default host: localhost
>>>> Apr 29, 2014 10:47:46 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
>>>> INFO: ------------------------- localhost ->
>>>> /f558050e-f853-40da-baa4-fa9e17c2c629
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.config.ConfigurationFactory
>>>> configureApplication
>>>> INFO: Configuring enterprise application:
>>>> /tmp/arquillian-tomee-app-working-dir/0/f558050e-f853-40da-baa4-fa9e17c2c629
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.config.ConfigurationFactory
>>>> configureService
>>>> INFO: Configuring Service(id=Default Managed Container, type=Container,
>>>> provider-id=Default Managed Container)
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.config.AutoConfig
>>>> createContainer
>>>> INFO: Auto-creating a container for bean
>>>> f558050e-f853-40da-baa4-fa9e17c2c629.Comp1777833712:
>>>> Container(type=MANAGED, id=Default Managed Container)
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.assembler.classic.Assembler
>>>> createRecipe
>>>> INFO: Creating Container(id=Default Managed Container)
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.core.managed.SimplePassivater
>>>> init
>>>> INFO: Using directory /tmp for stateful session passivation
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.config.AppInfoBuilder build
>>>> INFO: Enterprise application
>>>> "/tmp/arquillian-tomee-app-working-dir/0/f558050e-f853-40da-baa4-fa9e17c2c629"
>>>> loaded.
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.assembler.classic.Assembler
>>>> createApplication
>>>> INFO: Assembling app:
>>>> /tmp/arquillian-tomee-app-working-dir/0/f558050e-f853-40da-baa4-fa9e17c2c629
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.cdi.CdiBuilder initSingleton
>>>> INFO: Existing thread singleton service in SystemInstance():
>>>> org.apache.openejb.cdi.ThreadSingletonServiceImpl@138bd16f
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.cdi.OpenEJBLifecycle
>>>> startApplication
>>>> INFO: OpenWebBeans Container is starting...
>>>> Apr 29, 2014 10:47:46 AM org.apache.webbeans.plugins.PluginLoader startUp
>>>> INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
>>>> Apr 29, 2014 10:47:46 AM org.apache.webbeans.plugins.PluginLoader startUp
>>>> INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
>>>> Apr 29, 2014 10:47:46 AM org.apache.webbeans.config.BeansDeployer
>>>> validateInjectionPoints
>>>> INFO: All injection points were validated successfully.
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.cdi.OpenEJBLifecycle
>>>> startApplication
>>>> INFO: OpenWebBeans Container has started, it took 66 ms.
>>>> Apr 29, 2014 10:47:46 AM org.apache.openejb.assembler.classic.Assembler
>>>> createApplication
>>>> INFO: Deployed
>>>> Application(path=/tmp/arquillian-tomee-app-working-dir/0/f558050e-f853-40da-baa4-fa9e17c2c629)
>>>> Apr 29, 2014 10:47:48 AM org.apache.openejb.util.JarExtractor extract
>>>> INFO: Extracting jar:
>>>> /tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8.war
>>>> Apr 29, 2014 10:47:48 AM org.apache.openejb.util.JarExtractor extract
>>>> INFO: Extracted path:
>>>> /tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8
>>>> Apr 29, 2014 10:47:48 AM org.apache.tomee.catalina.TomcatWebAppBuilder
>>>> deployWebApps
>>>> INFO: using default host: localhost
>>>> Apr 29, 2014 10:47:48 AM org.apache.tomee.catalina.TomcatWebAppBuilder init
>>>> INFO: ------------------------- localhost -> /mockserver-war-2.8
>>>> Apr 29, 2014 10:47:48 AM org.apache.catalina.loader.WebappClassLoader
>>>> validateJarFile
>>>> INFO:
>>>> validateJarFile(/tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8/WEB-INF/lib/javax.servlet-api-3.0.1.jar)
>>>> - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
>>>> javax/servlet/Servlet.class
>>>> Apr 29, 2014 10:47:48 AM org.apache.openejb.config.ConfigurationFactory
>>>> configureApplication
>>>> INFO: Configuring enterprise application:
>>>> /tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8
>>>> Apr 29, 2014 10:47:48 AM org.apache.openejb.config.AppInfoBuilder build
>>>> INFO: Enterprise application
>>>> "/tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8" loaded.
>>>> Apr 29, 2014 10:47:48 AM org.apache.openejb.assembler.classic.Assembler
>>>> createApplication
>>>> INFO: Assembling app:
>>>> /tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8
>>>> Apr 29, 2014 10:47:48 AM org.apache.openejb.assembler.classic.Assembler
>>>> createApplication
>>>> SEVERE: Application cannot be deployed as it contains deployment-ids which
>>>> are in use: app: /tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8
>>>> Apr 29, 2014 10:47:48 AM org.apache.openejb.assembler.classic.Assembler
>>>> createApplication
>>>> SEVERE: DeploymentId already used:
>>>> org.jboss.arquillian.moco.MocoExtensionTestCase
>>>> Apr 29, 2014 10:47:48 AM org.apache.tomee.catalina.TomcatWebAppBuilder
>>>> startInternal
>>>> SEVERE: Unable to deploy collapsed ear in war
>>>> StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/mockserver-war-2.8]
>>>> org.apache.openejb.DuplicateDeploymentIdException: Application cannot be
>>>> deployed as it contains deployment-ids which are in use: app:
>>>> /tmp/arquillian-tomee-app-working-dir/1/mockserver-war-2.8
>>>>
>>>>
>>>> 2014-04-29 10:43 GMT+02:00 Romain Manni-Bucau <[email protected]>:
>>>>
>>>>> yeah logs would be nice before digging further
>>>>>
>>>>>
>>>>> Romain Manni-Bucau
>>>>> Twitter: @rmannibucau
>>>>> Blog: http://rmannibucau.wordpress.com/
>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>>> Github: https://github.com/rmannibucau
>>>>>
>>>>>
>>>>> 2014-04-29 10:41 GMT+02:00 Àlex Soto <[email protected]>:
>>>>>> Well both wars have different names I will try with startup event you
>>>>> Can see some code, not the latest one on
>>>>> github.com/arquillian/arquillian-extension-moco the class
>>>>> MockServerDeployer
>>>>>>
>>>>>> If you want I Can send you the logs
>>>>>>
>>>>>> Enviat des del meu iPhone
>>>>>>
>>>>>> El 29/04/2014, a les 10.10, Romain Manni-Bucau <[email protected]>
>>>>> va escriure:
>>>>>>> Hi
>>>>>>>
>>>>>>> hmm depends actually how you deploy it. Do you put same names? We can
>>>>>>> deploy multiple wars if one is not managed by arquillian more or less.
>>>>>>> Typically I used deploy on startup feature a lot for it.
>>>>>>>
>>>>>>>
>>>>>>> Romain Manni-Bucau
>>>>>>> Twitter: @rmannibucau
>>>>>>> Blog: http://rmannibucau.wordpress.com/
>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>>>>> Github: https://github.com/rmannibucau
>>>>>>>
>>>>>>>
>>>>>>> 2014-04-29 9:45 GMT+02:00 Alex Soto <[email protected]>:
>>>>>>>> Hello I am developing an arquillian extension that basically deploys
>>>>> two
>>>>>>>> WAR files, the first one automatically and the second one is created
>>>>> by the
>>>>>>>> user using @Deployment.
>>>>>>>>
>>>>>>>> Basically the extensions listens for AfterDeploy annotation and it
>>>>> uses the
>>>>>>>> current org.jboss.arquillian.container.spi.Container instance to call
>>>>> the
>>>>>>>> deploy method passing as argument one war file resolved by Shrinkwrap
>>>>> Maven
>>>>>>>> resolver.
>>>>>>>>
>>>>>>>> The problem is that when I run the extension with Embedded TomEE next
>>>>>>>> exception is thrown: Application cannot be deployed as it contains
>>>>>>>> deployment-ids which are in use and points to the WAR deployed by
>>>>>>>> extension. If instead of listening AfterDeploy event I listen the
>>>>>>>> BeforeDeploy, the WAR that cannot be deployed is the one generated by
>>>>> user
>>>>>>>> with @Deployment.
>>>>>>>>
>>>>>>>> But if I run with Remote (Managed) TomEE then it works perfectly, so it
>>>>>>>> seems like we couldn't deploy two war files in embed mode, is it
>>>>> correct?
>>>>>>>>
>>>>>>>> Thank you so much.
>>>>>>>>
>>>>>>>> --
>>>>>>>> +----------------------------------------------------------+
>>>>>>>> Alex Soto Bueno
>>>>>>>> www.lordofthejars.com
>>>>>>>> +----------------------------------------------------------+
>>>>
>>>>
>>>>
>>>> --
>>>> +----------------------------------------------------------+
>>>> Alex Soto Bueno - Computer Engineer
>>>> www.lordofthejars.com
>>>> +----------------------------------------------------------+