Tag Archives: forge

Enable Arquillian on an existing Java EE project, using Forge Addon (Tech Tip #54)

Tech Tip #34 explained how to create a testable Java EE 7 application. This is useful if you are starting a new application. But what if you already have an application and Arquillian-enable it ?

That’s where Forge and Forge-Arquillian add-on comes in handy. That’s how I added support for Arquillian in javaee7-simple-sample. The updated source code is at github.com/arun-gupta/javaee7-continuous-delivery.

Lets see what was done!

  1. Download and install Forge. You can download ZIP and unzip in your favorite location, or just use the following command that does it for you:
  2. Clone the simple-javaee7-sample repo
  3. Change the directory to javaee7-simple-sample and start Forge:
  4. Install the Forge-Arquillian add-on:
  5. Configure Arquillian add-on and install WildFly adapter:
    The list of adapters is diverse as shown:
    This allows you to configure the container of your choice. This will add the following profile to your “pom.xml”:
    The profile includes the “wildfly-arquillian-container-remote” dependency which allows Arquillian to connect with a WildFly running in remote “mode”. The default host is “localhost” and port is “8080”. The “maven-surefire-plugin” is passed a “arquillian.launch” configuration property with the value “arquillian-wildfly-remote”. This is matched with a “container” qualifier in the generated “arquillian.xml”.

    “arquillian.xml” is used to define configuration settings to locate or communicate with the container. In our case, WildFly is running on default host and port and so there is no need to update this file. The important part to note is that the “container” qualifier matches with the “arquillian.launch” qualifier value.

    This file. More details about this configuration file are available here.

  6. Until FORGE-2148 is fixed, you also need to add a JAX-RS implementation as well, and the corresponding JAXB provider. This test is using RESTEasy and so the following needs to be added:

    This can be added either in the profile or project-wide dependencies.

And now you are ready to test!

Download WildFly 8.1 and unzip. Start the server as:

Run the tests:

And now you’ve Arquillian-enabled your existing project!

Once again, the complete source code is available at github.com/arun-gupta/javaee7-continuous-delivery.

File any issues here.

Enjoy!

Adding Java EE 7 Batch Addon to JBoss Forge ? – Part 6 (Tech Tip #40)

This is the sixth part (part 1part 2, part 3, part 4, part 5) of a multi-part video series where Lincoln Baxter (@lincolnthree) and I are interactively building a Forge addon to add Java EE 7 Batch functionality.

Part 1 showed how to get started with creating an addon, add relevant POM dependencies, build and install the addon using Forge shell, add a new command batch-new-jobxml, and add --reader--processor--writer parameters to the newly added command.

Part 2 showed how to identify classes for each CLI parameter that already honor the contract required by the Batch specification.

Part 3 showed how parameters can be made required, created templates for reader, processor, and writer, validated the specified parameters.

Part 4 added a new test for the command and showed how Forge can be used in debug mode.

Part 5 fixed a bug reported by a community member and started work to make processor validation optional.

This part shows:

  • Upgrade from Forge 2.6.0 to 2.7.1
  • Fix the failing test
  • Reader, processor, and writer files are now templates instead of source files
  • Reader, processor, and writer are injected appropriately in test’s temp project

Enjoy!

As always, the evolving source code is available at github.com/javaee-samples/forge-addons. The debugging will continue in the next episode.

Adding Java EE 7 Batch Addon to JBoss Forge ? – Part 5 (Tech Tip #38)

This is the fifth part (part 1part 2, part 3, part 4) of a multi-part video series where Lincoln Baxter (@lincolnthree) and I are interactively building a Forge addon to add Java EE 7 Batch functionality.

Part 1 showed how to get started with creating an addon, add relevant POM dependencies, build and install the addon using Forge shell, add a new command batch-new-jobxml, and add --reader--processor--writer parameters to the newly added command.

Part 2 showed how to identify classes for each CLI parameter that already honor the contract required by the Batch specification.

Part 3 showed how parameters can be made required, created templates for reader, processor, and writer, validated the specified parameters.

Part 4 added a new test for the command and showed how Forge can be used in debug mode.

This part shows:

  • Fix a bug reported by a community member
  • Started work another issue to make processor validation optional

Enjoy!

As always, the evolving source code is available at github.com/javaee-samples/forge-addons. The debugging will continue in the next episode.

Adding Java EE 7 Batch Addon to JBoss Forge ? – Part 4 (Tech Tip #30)

This is the fourth part (part 1part 2, part 3) of a multi-part video series where Lincoln Baxter (@lincolnthree) and I are interactively building a Forge addon to add Java EE 7 Batch functionality.

Part 1 showed how to get started with creating an addon, add relevant POM dependencies, build and install the addon using Forge shell, add a new command batch-new-jobxml, and add --reader--processor--writer parameters to the newly added command.

Part 2 showed how to identify classes for each CLI parameter that already honor the contract required by the Batch specification.

Part 3 showed how parameters can be made required, created templates for reader, processor, and writer, validated the specified parameters.

This part shows:

  • Fixed the issues from part 3 and generates new JobXML when reader, processor, and writer are specified
  • Added a new test to test the command
  • How Forge can be used in debug mode to debug add ons

Enjoy!

As always, the evolving source code is available at github.com/javaee-samples/forge-addons. The test code debugging will continue in the next episode.

Adding Java EE 7 Batch Addon to JBoss Forge ? – Part 3 (Tech Tip #26)

This is the third part (part 1, part 2) of a multi-part video series where Lincoln Baxter (@lincolnthree) and I are interactively building a Forge addon to add Java EE 7 Batch functionality.

Part 1 showed how to get started with creating an addon, add relevant POM dependencies, build and install the addon using Forge shell, add a new command batch-new-jobxml, and add --reader--processor--writer parameters to the newly added command. Part 2 showed how to identify classes for each CLI parameter that already honor the contract required by the Batch specification. This part shows how:

  • Parameters can be made required
  • Add an attribute to accept jobXML name
  • Check that the reader, processor, and writer are annotated with @Named
  • Create templates for reader, processor, writer, and jobXML
  • Use templating language to replace the name of chosen reader, processor, writer

Enjoy!

As earlier, the evolving source code is available at github.com/javaee-samples/forge-addons. The source code is compiling fine but not serving the intended purpose yet. It will be further debugged in the next episode, coming later this week.

Adding Java EE 7 Batch Addon to JBoss Forge ? – Part 2 (Tech Tip #24)

This is the second part (part 1) of a multi-part video series where Lincoln Baxter (@lincolnthree) and I are interactively building a Forge addon to adding Java EE 7 Batch functionality.

Part 1 showed how to get started with creating an addon, add relevant POM dependencies, build and install the addon using Forge shell, and add parameters to the addon. This part shows how to add some meaningful semantics to those parameters.

Java EE 7 Batch define item-oriented processing where an item is read, optionally processed, and then written. Items could be read from an input source, CSV file, JMS destination, REST endpoint, database, or any other source. Similarly items can be written to an output stream, database, or some where else. This logic of reading, processing, and writing is captured in beans that are packaged in your WAR file. These beans need to either extend from a specific interface or extend an abstract class. For example item reader needs to either implement ItemReader interface or extends AbstractItemReader abstract class. Similarly item writer needs to either implement ItemWriter interface or extend <code<AbstractItemWriter abstract class. Item processor need to implement ItemProcessor interface.

Part 1 showed how to add --reader, --processor, --writer parameters to the newly added batch-new-jobxml command. This part will show how to identify classes for each CLI parameter that already honor the contract required by the Batch specification.

Enjoy!

As earlier, the evolving source code is available at github.com/javaee-samples/forge-addons.

The timing for the next recording is unknown at this time because of my travel schedule, but sometime next week.

Adding Java EE 7 Batch Addon to JBoss Forge – Part 1 (Tech Tip #22)

JBoss Forge is the fastest way to build your Java EE applications, and not even tied to a particular IDE or an Application Server. Tech Tip #17 explained how to build a simple Java EE application rapidly, and deploy it on WildFly. JBoss Developer Studio provide a very neat integration with Forge as well. The instructions from the video are also explained in a text-based script here.

Forge is built with an extensible architecture where third-party addons can be easily installed to enable new functionality that does not exist in the Forge itself. A large variety of addons (nee plugins) are already available such as Arquillian, RichFaces, JRebel, OpenShift, Spring, TomEE, AngularJS, Netty, and a lot more.

Now, you’ve used Forge, found some functionality missing, fortunately somebody already created a addon and so could use that. But now you need some functionality and there is no addon available for that. So you’ll need to create an addon. How do you start ?

Lincoln Baxter (@lincolnthree) and I are starting a multi-part video series where we are going to interactively build a addon for adding Java EE 7 Batch functionality to Forge. The first video is available and shows:

  • Get started with creating a plugin basic structure
  • Add relevant dependencies
  • Build and install the addon
  • Add parameters to the addon

We plan to record the next session next Friday-ish. Let us know if you’d like to join us on G+ hangout and will share the coordinates.

The evolving source code is available at github.com/javaee-samples/forge-addons.

Enjoy!

 

Rapid Java EE Application Development using Forge 2 (Tech Tip #17)

How do you rapidly build Java EE applications in an IDE-agnostic way ?

JBoss Forge is your answer!

This short video shows how to:

  • Rapidly build a Java EE application from scratch using Forge 2 CLI
  • Create JPA entities and add properties to them
  • Add Bean Validation constraints
  • Create JSF scaffolds and REST endpoints
  • Deploy the application on JBoss EAP running in OpenShift

Complete detailed instructions followed in this screencast are available here.

Enjoy!

 

Lincoln Baxter: JBoss Forge at DevNation 2014

Lincoln Baxter (@lincolnthree), Principal Software Engineer at Red Hat will be speaking at DevNation.

lincoln-baxter

Here is what he had to say about his session …

What sessions are you giving at DevNation ?

Tools worth sharing: Take back your IDE with Forge
Tuesday, 4/15, 4:50pm

What are three takeaways from your session ?

  1. How Forge can help you be more productive.
  2. How Forge can help you share your technology and ideas.
  3. How Forge is changing how we interact with development tools.

What do you find most exciting about DevNation ?

The fact that so many different communities and technologies will be coming together to present in one place. This is the best time to share ideas, cross-pollinate, and prototype cool new features! I love the collaborative atmosphere and chance to get to meet new people, see what people think about the work we are doing, and figure out how to make their lives a little easier.

What sessions are you looking forward to attend ?

  • Beer & BoF – Tools for JBoss migrations – Robb Greathouse (Room 220)
  • Hacknight (Room 224)
  • Wake me up: The tale of a startup – Langdon White (Room 208)

Do you want to learn more about how to get started with JBoss Forge ?

Register for DevNation today!