Has anyone successfully run integration tests with Jboss embedded, Seam and Maven? - unit-testing

Have been trying to get integration testing working with my seam project and the Jboss embedded container but am not having much success. Have been doing a lot of reading and have been trying what is mentioned in this JIRA but am not having any luck.
Amy currently just trying to get the 'testproject-master-JBSEAM-2371.zip' project working but am getting the following exception
ERROR [org.jboss.embedded.DeploymentScanner] Failed to deploy
org.jboss.deployers.spi.DeploymentException: No deployer recognised the structure of vfsfile:/Users/aaron/Development/eclipse_workspaces/workspace_pink/testproject-web/target/test-classes/conf/jboss-service.xml
at org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl.determineStructure(VFSStructuralDeployersImpl.java:219)
at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:77)
Has oneone had any luck with getting the Seam integration tests working using maven and NOT a seam-gen project?

I gave up on the embedded JBoss and switched with using the Maven JBoss Plugin to deploy to a JBoss instance started as a separate process. Not ideal but there were to many conflicts with our code and Maven to get around. Is there a reason you need the embedded version?
You should be able to do something like this to deploy to JBoss in the pre-integration test phase so the integration test could run against. You would still have to launch jboss before maven. Not ideal, but this is working for me.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<jbossHome>/opt/JBoss/current</jbossHome>
<port>8080</port>
</configuration>
</execution>
</executions>
</plugin>

Related

Unable to deploy Spring Boot application to Elastic Beanstalk

So I've uploaded my Jar file created with the pom file below using maven and I'm having the errors in the logs and can't figure out what the problem is. The Spring Boot both builds and runs fine locally but won't work when trying to deploy.
The logs give me this error
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
and my build in my pom file is
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
I've tried loads of different things but am coming at a loss. Any help would be appreciated.

Maven Jetty Plugin - Disable Http Trace

I have a maven project with a web.xml and run it using mvn jetty:run
How can I disable the http-tracing?
Edit: I looked here but I was unable to identify the relevant tags...
This is the relevant plugin:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.11.v20150529</version>
<configuration>
<jettyXml>src/jetty.xml</jettyXml>
</configuration>
</plugin>
Two things.
Jetty 9.2 is EOL (End of Life) - consider upgrading to something supported and stable (such as the recently released 9.4.14.v20181114)
The TRACE method in HTTP is disabled by default (via the webdefaults.xml descriptor).
The only way you can use TRACE is to both intentionally configure your webapp to use a custom default descriptor without this constraint (which your <configuration> section doesn't do), and have a Servlet that implements doTrace() or service() methods to support the TRACE method.

What is the best way to save and publish version in Cloud Foundry app?

What is the best way to save and publish git version of Cloud Foundry app?
Is it possible to specify what version string aka git revision should be added to application metadata, and how to get this information outside of app?
If you are using spring boot there are plugins for maven and gradle to git information to the build.
Maven:
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
</plugins>
</build>
Gradle:
plugins {
id "com.gorylenko.gradle-git-properties" version "1.4.17"
}
The information will then be available on /info if you are using actuators
More information:https://docs.pivotal.io/pivotalcf/1-12/console/spring-boot-actuators.html

How do I get deploy-war to work using jetty 9 maven plugin?

In jetty-9 the mvn jetty:deploy-war fails to start the web application. Maven just ends the build, while I expect it to block with a running jetty server. According to the logging output the jetty maven plugin does start a connector on port 8080, and it starts the WebAppContext. It seems to fail binding the port to the context though.
Steps to reproduce:
Create a web app: mvn archetype:generate -DinteractiveMode=false -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=jetty -DartifactId=jetty-demo
Add this plugins-section to the pom:
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
</plugin>
</plugins>
...
</build>
Execute:
mvn package
mvn jetty:deploy-war This should start the web app and then block, but it just ends the build
Using jetty-8 all works fine:
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
Note: mvn jetty:run-war works as expected in jetty 9. This is the same as deploy-war, but it triggers jetty to build the war before deployment
Reference: the jetty-9 maven plugin manual. And I debugged the jetty startup proces, but without luck so far.
The documentation you linked to tells you why.
Set the daemon parameter to false and it will block

Writing a custom feature

We would like to write our own custom extension (feature) for wso2 carbon. Is there some documentation for authoring features?
We did manage to just "hack" our way into writing a custom feature. But how do we host it? It seems Carbon is looking at some very specific repository descriptors - artifacts.jar and content.jar
How can we generate these descriptors without tying into the Carbon build. Is there some documentation describing how to setup a third party feature repository?
Creating-your-own-wso2-carbon-components webinar discusses creating carbon components, and a feature for those components. It covers quite a lot of basics, and best practices as well.
To host the created features you have written, you need to generate a p2-repository from those features. p2-repo concept comes from the underline Eclipse equinox project that WSO2 products use.
WSO2 have written its own maven plugin called carbon-p2-plugin that helps to generate a p2-repo. Here's how you can do that. Simply create a new maven project (packaging: pom), and then set the features you want to publish under the carbon-p2-plugin plugin configuration. Following is a sample pom.xml that you can use. This was copied from the p2-repo generation pom.xml of carbon 4.1.0, and I simplified it.
I have tested this pom file, it worked for me. There are two sample feature definitions. Replace those featureArtifactDef with your own feature definitions. The format is $groupId:$artifactId:$version.
When you build this via maven, maven creates the target/p2-repo directory. This contains the p2-repository which contains the complete p2-repo including artifacts.jar and content.jar. You can just use this folder to install features, or you can host it somewhere. There're no special requirements on hosting.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon</groupId>
<artifactId>carbon-features</artifactId>
<version>4.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mysample-feature-repository</artifactId>
<version>4.1.0</version>
<packaging>pom</packaging>
<name>WSO2 Carbon - Feature Repository</name>
<build>
<plugins>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<id>2-p2-repo-generation</id>
<phase>package</phase>
<goals>
<goal>p2-repo-gen</goal>
</goals>
<configuration>
<p2AgentLocation>${basedir}/target/p2-agent</p2AgentLocation>
<metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
<artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
<publishArtifacts>true</publishArtifacts>
<publishArtifactRepository>true</publishArtifactRepository>
<featureArtifacts>
<!-- change the featureArtifactDef to match your needs -->
<featureArtifactDef>
org.wso2.carbon:org.wso2.carbon.service.mgt.feature:4.1.0
</featureArtifactDef>
<featureArtifactDef>
org.wso2.carbon:org.wso2.carbon.registry.core.feature:4.1.0
</featureArtifactDef>
</featureArtifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>