Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-5523

Integration tests fail in plugin template

    XMLWordPrintable

Details

    Description

      Plugin, newly created by atlas-create-stash-plugin command has its integration tests faile, when run though a atlas-integration-test program.

      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running it.com.pbaranchikov.MyComponentWiredTest
      SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
      SLF4J: Defaulting to no-operation (NOP) logger implementation
      SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.405 sec <<< FAILURE!
      it.com.pbaranchikov.MyComponentWiredTest  Time elapsed: 1.405 sec  <<< ERROR!
      java.lang.NoClassDefFoundError: com/atlassian/upm/api/util/Option
              at com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.runViaRestCall(AtlassianPluginsTestRunner.java:114)
              at com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.run(AtlassianPluginsTestRunner.java:75)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
              at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
              at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
      Caused by: java.lang.ClassNotFoundException: com.atlassian.upm.api.util.Option
              at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
              at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
              ... 14 more
      

      To avoid this error I am to add additional dependency

              <dependency>
                  <groupId>com.atlassian.upm</groupId>
                  <artifactId>upm-api</artifactId>
                  <version>2.1.4</version>
                  <scope>test</scope>
              </dependency>
      

      After this, I get new errors

      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running it.com.pbaranchikov.MyComponentWiredTest
      SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
      SLF4J: Defaulting to no-operation (NOP) logger implementation
      SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.618 sec <<< FAILURE!
      No tests found in class [it.com.pbaranchikov.MyComponentWiredTest]  Time elapsed: 0.617 sec  <<< ERROR!
      java.lang.Exception: No tests found in class [it.com.pbaranchikov.MyComponentWiredTest]
              at com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.runViaRestCall(AtlassianPluginsTestRunner.java:125)
              at com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner.run(AtlassianPluginsTestRunner.java:75)
              at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
              at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
              at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
              at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
              at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
              at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
              at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
      

      During next iteration I;ve changed my pom.xml, as mentioned in Asynchronous startup section of API changelog the following way:

                  <plugin>
                      <groupId>com.atlassian.maven.plugins</groupId>
                      <artifactId>maven-stash-plugin</artifactId>
                      <version>${amps.version}</version>
                      <extensions>true</extensions>
                      <configuration>
                          <products>
                              <product>
                                  <id>stash</id>
                                  <instanceId>stash</instanceId>
                                  <version>${stash.version}</version>
                                  <dataVersion>${stash.data.version}</dataVersion>
                                  <systemPropertyVariables>
                                      <!-- Force Stash to start up synchronously -->
                                      <johnson.spring.lifecycle.synchronousStartup>true</johnson.spring.lifecycle.synchronousStartup>
                                  </systemPropertyVariables>                        
                              </product>..
                          </products>
                      </configuration>
                  </plugin>
      

      This change have not fixed enything at all.

      I suppose, that plugin, created by Atlassian SDK should work out-of-the-box.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              c2c752621398 Pavel Baranchikov
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: