Code Monkey home page Code Monkey logo

arquillian-extension-liferay's Introduction

Obsolete

We don't maintain this code base anymore. Current development takes place in liferay-labs/arquillian-liferay, so feel free to check it out!

Arquillian Liferay

Arquillian Extension for Liferay Portal Server. OSGi incontainer deployment.

What is this?

Arquillian extension for Liferay is a set of tools to help developers test their Liferay plugins.

It consists of:

  • Arquillian Remote Container for Liferay (OSGi based)
  • Arquillian Deployment Scenario Generator for OSGi SDK plugins based on BND
  • Arquillian Deployment Scenario Generator for legacy Maven plugins

How to use it?

We have defined a complete example of how to use it in arquillian-extension-liferay-example

##Build Status

Build Status

codecov.io

Testing Pull Requests

If you want any pull request you receive to be automatically tested by Travis CI, please set up your job directly in Travis.

  • Go to http://travis-ci.org/profile
  • Enable Travis for arquillian-extension-liferay Github repository
  • Click on the Settings icon.
  • Enable 'Build pull requests' option element.

With those simple steps pulls will be tested against one of the most popular Open Source CI systems nowadays.

Keeping Travis CI up-to-date

Anytime you add a dependency on the build system, verify that it is properly configured in the Travis CI descriptor, the .travis.yml file, so that pulls there don't get broken.

arquillian-extension-liferay's People

Contributors

aslakknutsen avatar bartoszmajsak avatar cgoncas avatar csierra avatar gamerson avatar mdelapenya avatar shuyangzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arquillian-extension-liferay's Issues

multiple deployments error

I'm trying to use this extension in a multi-project gradle build here: https://github.com/gamerson/arquillian-workspace-example

When I run the testIntegration task of the sample-portlet module, it is configured to use 2 deployments, see here: https://github.com/gamerson/arquillian-workspace-example/blob/master/modules/sample-portlet/src/testIntegration/java/sample/portlet/test/SamplePortletFunctionalTest.java#L50-L62

I'm not sure if this is using arquillian correctly, but it seems to error

:modules:sample-portlet:compileTestIntegrationJava
:modules:sample-portlet:processTestIntegrationResources UP-TO-DATE
:modules:sample-portlet:testIntegrationClasses
:modules:sample-portlet:testIntegration

sample.portlet.test.SamplePortletFunctionalTest STANDARD_ERROR
    SLF4J: The requested version 1.5.11 by your slf4j binding is not compatible with [1.6, 1.7]
    SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
    Dec 02, 2016 9:49:00 PM org.jboss.arquillian.drone.webdriver.factory.remote.reusable.ReusedSessionPermanentFileStorage readStore
    INFO: Reused session store is not available at /Users/greg/.drone-webdriver-session-store, a new one will be created.
21:49:01,707 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:02,162 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:02,272 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:02,473 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
    log4j:WARN No appenders could be found for logger (org.jboss.arquillian.container.test.spi.client.deployment.ApplicationArchiveProcessor).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
21:49:02,805 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:02,978 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:03,125 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:03,366 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:03,430 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:04,077 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:04,484 INFO  [elasticsearch[Dragon Man][clusterService#updateTask][T#1]][metadata:317] [Dragon Man] [liferay-20116] update_mapping [LiferayDocumentType]
21:49:16,785 INFO  [RMI TCP Connection(2)-127.0.0.1][BundleStartStopLogger:35] STARTED sample.service_1.0.0 [489]
21:49:26,508 INFO  [RMI TCP Connection(2)-127.0.0.1][BundleStartStopLogger:38] STOPPED sample.portlet_1.0.0 [490]
21:49:26,559 INFO  [RMI TCP Connection(2)-127.0.0.1][BundleStartStopLogger:38] STOPPED sample.service_1.0.0 [489]

sample.portlet.test.SamplePortletFunctionalTest > classMethod FAILED
    java.io.IOException: Start of bundle with id 490 failed with message: Exception in com.liferay.arquillian.container.osgi.remote.activator.ArquillianBundleActivator.start() of bundle sample.portlet.

        Caused by:
        org.osgi.framework.BundleException: Exception in com.liferay.arquillian.container.osgi.remote.activator.ArquillianBundleActivator.start() of bundle sample.portlet.

            Caused by:
            javax.management.InstanceAlreadyExistsException: jboss.arquillian:service=jmx-test-runner

1 test completed, 1 failed
:modules:sample-portlet:testIntegration FAILED

Seems that the ArquillianBundleActivator is starting some jboss.arquillian:service service that already exists?

Problem in travis.yml

For example in https://travis-ci.org/cgoncas/arquillian-extension-liferay/builds/88831348 we get the error:

$ travis_wait mvn -DskipTests=true -Dmaven.javadoc.skip=true -B -Vinstall
Still running (20 of 20): mvn -DskipTests=true -Dmaven.javadoc.skip=true -B -Vinstall
Timeout (20 minutes) reached. Terminating "mvn -DskipTests=true -Dmaven.javadoc.skip=true -B -Vinstall"
The command "travis_wait mvn -DskipTests=true -Dmaven.javadoc.skip=true -B -Vinstall" failed and exited with 1 during .

what 's ${parent.version} mean?

	<dependency>
		<groupId>com.liferay.arquillian</groupId>
		<artifactId>com.liferay.arquillian.arquillian-container-liferay</artifactId>
		<version>${parent.version}</version>
		<scope>test</scope>
	</dependency>

not working in windows

not working in windows Maven home: C:\Program Files\apache-maven-3.3.3 Java version: 1.8.0_101, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_101 Default locale: en_US, platform encoding: UTF-8 OS name: "windows", version: "7.x86_64", arch: "amd64", family: "windows"

Test failure on Java 1.8

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.arquillian.container.osgi.remote.deploy.processor.test.ManifestManagerTest
[INFO] Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.181 sec <<< FAILURE! - in org.arquillian.container.osgi.remote.deploy.processor.test.ManifestManagerTest
[INFO] testPutAttributeList(org.arquillian.container.osgi.remote.deploy.processor.test.ManifestManagerTest)  Time elapsed: 0.012 sec  <<< FAILURE!
[INFO] org.junit.ComparisonFailure: expected:<com.import.example[2,com.import.example1]> but was:<com.import.example[1,com.import.example2]>
[INFO]  at org.junit.Assert.assertEquals(Assert.java:115)
[INFO]  at org.junit.Assert.assertEquals(Assert.java:144)
[INFO]  at org.arquillian.container.osgi.remote.deploy.processor.test.ManifestManagerTest.testPutAttributeList(ManifestManagerTest.java:126)
openjdk version "1.8.0_60"
OpenJDK Runtime Environment (build 1.8.0_60-b27)
OpenJDK 64-Bit Server VM (build 25.60-b23, mixed mode)

org.jboss.arquillian.container.spi.client.container.LifecycleException

org.jboss.arquillian.container.spi.client.container.LifecycleException: Error connecting to Karaf MBeanServer:
at org.jboss.arquillian.container.osgi.karaf.remote.KarafRemoteDeployableContainer.start(KarafRemoteDeployableContainer.java:77)
at org.jboss.arquillian.container.impl.ContainerImpl.start(ContainerImpl.java:199)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:163)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$8.perform(ContainerLifecycleController.java:157)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forContainer(ContainerLifecycleController.java:255)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startContainer(ContainerLifecycleController.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:77)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController$2.perform(ContainerLifecycleController.java:70)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.forEachSuiteContainer(ContainerLifecycleController.java:221)
at org.jboss.arquillian.container.impl.client.container.ContainerLifecycleController.startSuiteContainers(ContainerLifecycleController.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:67)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:145)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:116)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:75)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:115)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at org.jboss.arquillian.container.osgi.jmx.JMXDeployableContainer.getMBeanServerConnection(JMXDeployableContainer.java:355)
at org.jboss.arquillian.container.osgi.karaf.remote.KarafRemoteDeployableContainer.start(KarafRemoteDeployableContainer.java:74)
... 61 more

As a developer, I'd like to wait for an specific service with an annotation instead of writing boilerplate code each time

This code can be very easily spread through the code:

@Override
public void start(BundleContext bundleContext) throws Exception {
    ServiceReference<ConfigurationAdmin> serviceReference =
        bundleContext.getServiceReference(ConfigurationAdmin.class);

    try {
        ConfigurationAdmin configurationAdmin = bundleContext.getService(
            serviceReference);

        _jcrConfiguration = configurationAdmin.getConfiguration(
            "com.liferay.portal.store.jcr.configuration." +
                "JCRStoreConfiguration");

        Dictionary<String, Object> properties = new Hashtable<>();

        properties.put("initializeOnStartup", Boolean.TRUE);
        properties.put("jackrabbitConfigFilePath", "repository.xml");
        properties.put("jackrabbitCredentialsPassword", "none");
        properties.put("jackrabbitCredentialsUsername", "none");
        properties.put("jackrabbitRepositoryHome", "home");
        properties.put("jackrabbitRepositoryRoot", "data/jackrabbit");
        properties.put("moveVersionLabels", Boolean.FALSE);
        properties.put("nodeDocumentlibrary", "documentlibrary");
        properties.put("workspaceName", "liferay");
        properties.put("wrapSession", Boolean.TRUE);

        _jcrConfiguration.update(properties);

        Filter filter = bundleContext.createFilter(
            "(&(objectClass=" + Store.class.getName() +
                ")(store.type=com.liferay.portal.store.jcr.JCRStore))");

        ServiceTracker<?, ?> serviceTracker = new ServiceTracker<>(
            bundleContext, filter, null);

        serviceTracker.open();

        Object jcrStore = serviceTracker.waitForService(10000);

        serviceTracker.close();

        if (jcrStore == null) {
            _jcrConfiguration.delete();

            throw new IllegalStateException(
                "JCRStore was not registered within 10 seconds");
        }
    }
    finally {
        bundleContext.ungetService(serviceReference);
    }
}

Could it be possible to have a WaitForService annotation so that this code is not written N times?

Filter filter = bundleContext.createFilter(
    "(&(objectClass=" + MyService.class.getName() +")(my.property=my.value))");

ServiceTracker<?, ?> serviceTracker = new ServiceTracker<>(
    bundleContext, filter, null);

serviceTracker.open();

Object service = serviceTracker.waitForService(10000);

serviceTracker.close();

if (service == null) {
    _configuration.delete();

    throw new IllegalStateException(
        "Service was not registered within 10 seconds");
}

Maven importer is not creating the war properly

WebArchive archive =
    ShrinkWrap.create(MavenImporter.class).loadPomFromFile(
        pomFile).importBuildOutput().as(WebArchive.class);

is not including runtime dependencies declared in the pom

The JMX test runner is still running when an exception is thrown on bundle activator start

My scenario is:

  • execute tests on OSGi modules. These tests need a configuration to be present before they are executed.
  • get a configuration for a service, based on PID and null location
  • create/update the configuration
  • wait for the service
  • if the service is still null after that, then throw a RuntimeException
  • re-run my test

Expected behaviour: tests are re-run without problem
Actual behavior: tests fail on re-run with this stacktrace.

[junit] Testcase: com.liferay.portal.store.jcr.test.JCRStoreTest:   Caused an ERROR
    [junit] Start of bundle with id 248 failed with message: Exception in org.arquillian.container.osgi.remote.activator.ArquillianBundleActivator.start() of bundle com.liferay.portal.store.jcr.test.
    [junit] java.io.IOException: Start of bundle with id 248 failed with message: Exception in org.arquillian.container.osgi.remote.activator.ArquillianBundleActivator.start() of bundle com.liferay.portal.store.jcr.test.
    [junit]     at org.apache.aries.jmx.framework.Framework.startBundle(Framework.java:461)
    [junit]     at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
    [junit]     at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
    [junit]     at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
    [junit]     at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
    [junit]     at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)
    [junit]     at javax.management.StandardMBean.invoke(StandardMBean.java:405)
    [junit]     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    [junit]     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    [junit]     at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
    [junit]     at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
    [junit]     at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
    [junit]     at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
    [junit]     at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
    [junit]     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
    [junit]     at sun.rmi.transport.Transport$1.run(Transport.java:177)
    [junit]     at sun.rmi.transport.Transport$1.run(Transport.java:174)
    [junit]     at java.security.AccessController.doPrivileged(Native Method)
    [junit]     at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
    [junit]     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
    [junit]     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
    [junit]     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
    [junit]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    [junit]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    [junit]     at java.lang.Thread.run(Thread.java:745)
    [junit] Caused by: org.osgi.framework.BundleException: Exception in org.arquillian.container.osgi.remote.activator.ArquillianBundleActivator.start() of bundle com.liferay.portal.store.jcr.test.
    [junit]     at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
    [junit]     at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
    [junit]     at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:941)
    [junit]     at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:318)
    [junit]     at org.eclipse.osgi.container.Module.doStart(Module.java:571)
    [junit]     at org.eclipse.osgi.container.Module.start(Module.java:439)
    [junit]     at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:392)
    [junit]     at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:411)
    [junit]     at org.apache.aries.jmx.framework.Framework.startBundle(Framework.java:459)
    [junit] Caused by: javax.management.InstanceAlreadyExistsException: jboss.arquillian:service=jmx-test-runner
    [junit]     at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
    [junit]     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
    [junit]     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
    [junit]     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
    [junit]     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
    [junit]     at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
    [junit]     at org.jboss.arquillian.protocol.jmx.JMXTestRunner.registerMBean(JMXTestRunner.java:100)
    [junit]     at org.arquillian.container.osgi.remote.activator.ArquillianBundleActivator.start(ArquillianBundleActivator.java:66)
    [junit]     at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
    [junit]     at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
    [junit]     at java.security.AccessController.doPrivileged(Native Method)
    [junit]     at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
    [junit]
    [junit]
    [junit] Test com.liferay.portal.store.jcr.test.JCRStoreTest FAILED

The bundle activator start method is:

@Override
public void start(BundleContext bundleContext) throws Exception {
    ServiceReference<ConfigurationAdmin> serviceReference =
        bundleContext.getServiceReference(ConfigurationAdmin.class);

    try {
        ConfigurationAdmin configurationAdmin = bundleContext.getService(
            serviceReference);

        _jcrConfiguration = configurationAdmin.getConfiguration(
            "com.liferay.portal.store.jcr.configuration." +
                "JCRStoreConfiguration");

        Dictionary<String, Object> properties = new Hashtable<>();

        properties.put("initializeOnStartup", Boolean.TRUE);
        properties.put("jackrabbitConfigFilePath", "repository.xml");
        properties.put("jackrabbitCredentialsPassword", "none");
        properties.put("jackrabbitCredentialsUsername", "none");
        properties.put("jackrabbitRepositoryHome", "home");
        properties.put("jackrabbitRepositoryRoot", "data/jackrabbit");
        properties.put("moveVersionLabels", Boolean.FALSE);
        properties.put("nodeDocumentlibrary", "documentlibrary");
        properties.put("workspaceName", "liferay");
        properties.put("wrapSession", Boolean.TRUE);

        _jcrConfiguration.update(properties);

        Filter filter = bundleContext.createFilter(
            "(&(objectClass=" + Store.class.getName() +
                ")(store.type=com.liferay.portal.store.jcr.JCRStore))");

        ServiceTracker<?, ?> serviceTracker = new ServiceTracker<>(
            bundleContext, filter, null);

        serviceTracker.open();

        Object jcrStore = serviceTracker.waitForService(10000);

        serviceTracker.close();

        if (jcrStore == null) {
            _jcrConfiguration.delete();

            throw new IllegalStateException(
                "JCRStore was not registered within 10 seconds");
        }
    }
    finally {
        bundleContext.ungetService(serviceReference);
    }
}

Install OSGi dependencies using a property files

You can install some dependencies in the Liferay container if you configure the property dependencyPropertyFile

<extension qualifier="liferay">
        <property name="dependencyPropertyFile">src/test/resources/test-dependencies.properties</property>
</extension>

and the file src/test/resources/test-dependencies.properties is

mvn:com.liferay.portal:portal-test:7.0.0-SNAPSHOT

support setting the JMX port via system property

currently the JMX port must be changed per test case using the arquillian.xml file.

Support a mechanism to adjust the port via system property so it can be globally set for an entire suite.

BundleClassPathObserver should observes SuiteEvent

We need that the contextClassLoader of the currentThread (when a test is been executed) was the same that the classpath of the test bundle.

Now we are doing this in the observer BundleClassPathObserver. This observer is listening to the beforeClass and AfterClass event. Will be better if we listen to the SuiteEvent event (because this event is executed before).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.