| Recent Entries |
|
10. Mar 2010
|
|||||
|
09. Mar 2010
|
|||||
|
08. Mar 2010
|
|||||
|
04. Mar 2010
|
|||||
|
03. Mar 2010
|
|||||
|
02. Mar 2010
|
|||||
|
27. Feb 2010
|
|||||
|
26. Feb 2010
|
| Seam News | (132) |
| Seam | (104) |
| Web Beans | (60) |
| Contexts and Dependency Injection | (55) |
| RichFaces | (53) |
| JBoss Tools | (52) |
| Eclipse | (45) |
| JBoss Tools Eclipse | (40) |
| JavaServer Faces | (35) |
| Weld | (31) |
| Hibernate | (24) |
| Bean Validation | (23) |
| Java EE 6 | (14) |
| News | (9) |
| Asylum | (8) |
Weld Extensions is set of portable services and utility classes for CDI which make up a good base layer for extension and application development. You can read more about the sort of portable extensions we are planning in this interview I gave.
Injectable Logger
Weld extensions includes an injectable logger, based on slf4j. By default, the fully qualified class name will be used as the category:
class Sparrow {
@Inject
private Logger log;
...
}
Alternatively you can specify a category:
class Finch
{
@Inject @Category("Finch")
private Logger log;
...
}
Managed Resource Streams
Weld extensions also contains managed resource streams (the stream is automatically closed for you when the bean goes out of scope) for resources loaded from the classpath:
@RequestScoped
class ResourceClient {
@Inject @Resource("/META-INF/config.xml")
InputStream inputStream;
public void parse() {
// TODO Parse the inputStream!
}
}
Here the stream will be closed for you when the request ends. Of course, you often don't know the file name you want to parse at development time, so you can also specify the name at runtime:
@SessionScoped
class ResourceClient {
@Inject ResourceProvider resourceProvider;
public void parse(String fileName) {
InputStream is = resourceProvider.loadResourceAsStream(fileName);
// TODO parse the XML!
}
}
Here, the stream will be closed for you when the session is destroyed.
At the moment, only loading resources from the classpath is supported, but we'll add support for loading resources from the servlet context soon. As you can see, this can greatly simplyfy using input streams!
Extensions to the core CDI programming model
Gavin has blogged about a number of improvements to the CDI programming model, some of which are available in this release. Included are:
- Bean declaration at the constructor level
- The exact qualifier
- Compound name defaulting
- Generic beans
The extensions package is currently available in Maven, and we welcome feedback, either in the Weld forum or in JIRA. Thanks for this release go to David Allen for the injectable logger and to Gavin King and Stuart Douglas for the extensions to the core CDI programming model.
I want to spend a moment introducing you to a new initiative we're undertaking for the Seam and Weld projects. We have decided to consolidate the community management roles that various people have held in the past to a single person. Whilst I (as project lead) am often focused on architecture, making sure releases happen on time, and coordinating the various contributors, the community manager is more focused on making sure the project is both easy to consume by the community and easy to contribute ideas and code into.
Briefly, the community manager will be responsible for taking an overview of the electronic and in-person resources. This could include maintaining a directory of blogs about Seam and Weld or identifying that there are a lot of new users struggling with a particular area through to ensuring that we have a good spread of content types (e.g. screencasts, conference appearances, reference docs etc.). You can read more about the role in the job description
on seamframework.org.
We're currently planning this to be a rotating position that a full time project member occupies. Dan Allen will be the first in the hot seat.
I'm happy to announce the first alpha release of Arquillian, an open source (ASL v2) framework for running tests in the container. If you want to read more about Arquillian's mission, and how it fits into our vision for testing at JBoss, read Pete's blog.
It's one thing to unit test your code outside of the container, but what happens when you run it inside? Does it still behave the same? How about testing against container managed resources? This is where Arquillian comes into its own.
With Arquillian it's just as easy to write integration tests as unit tests. In fact, to minimize the burden on you, Arquillian integrates with familiar testing frameworks, allowing reuse of tools such as the JUnit/TestNG support in your favorite IDE, Maven Surefire, Ant - in fact any tool which supports TestNG or JUnit!
To show you just how simple this is, here's an example test case setup using JUnit: (we'll get to the actual test next)
@RunWith(org.jboss.arquillian.junit.Arquillian.class)
public class TemperatureConverterTestCase {
@Deployment
public static JavaArchive createTestArchive() {
return Archives.create("test.jar", JavaArchive.class)
.addClasses(TemperatureConverter.class, TemperatureConverterBean.class);
}
}
By using JUnit's @RunWith annotation, you tell JUnit to use Arquillian as the test controller. Arquillian will then look for a static method marked with the @Deployment annotation, which creates your micro deployment. In the example above we simply deploy a session bean interface and implementation.
Arquillian hooks into your testing frameworks lifecycle and reacts to events. On the before suite and after suite events the container is started/stopped, while on the before class and after class events your micro deployment is deployed to/undeployed from the container.
The test case is started in the local JVM, and then Arquillian overrides the normal test execution and migrates the test so that it's executed inside the container. By the time the test framework calls your @Test annotated method, the test is running inside the container, giving us the possibility to work with container managed resources. Here's the complete test class with JUnit @Test methods.
@RunWith(org.jboss.arquillian.junit.Arquillian.class)
public class TemperatureConverterTestCase {
@Deployment
public static JavaArchive createTestArchive() {
return Archives.create("test.jar", JavaArchive.class)
.addClasses(TemperatureConverter.class, TemperatureConverterBean.class);
}
@EJB
private TemperatureConverter converter;
@Test
public void shouldConvertToCelsius() {
Assert.assertEquals(converter.convertToCelsius(32d), 0d);
Assert.assertEquals(converter.convertToCelsius(212d), 100d);
}
@Test
public void shouldConvertToFarenheit() {
Assert.assertEquals(converter.convertToFarenheit(0d), 32d);
Assert.assertEquals(converter.convertToFarenheit(100d), 212d);
}
}
Note how we can use @EJB to inject the session bean from our deployment into the test case for use in our test method - neat!
The Arquillian TestEnricher SPI supports all the injection annotations from Java EE 6 - @EJB, @Resource and @Inject.
This example test case could run in GlassFish, JBoss AS or OpenEJB as there are no container specific code/configuration at all. The choice is yours. You could even test on multiple platforms!
I want to learn more, where should I go from here?
You can follow up with some in depth usage scenarios and tests described in these articles:
- Dan Allen - Using Arquillian to test a possible bug in Weld
- Jordan Ganoff - Seam 3 JMS Module Testing with Arquillian
- German Escobar - Testing a JMX Portable Extension for CDI
We also have reference documentation which walks you through the examples from Arquillian, and shows you how to create your own Arquillian test suite. You might also find the Javadoc useful, especially if you plan on adding support for another container. You can also check out the forums and more articles can be found on our community site. If your interested in chatting to us, please drop by #jbosstesting on irc.freenode.net
So, what's next?
Some of the things you can expect from Arquillian are:
- Local run mode -- Sometimes, you don't want to run the test case inside the container itself. A local run mode will be added; a mode where your test controls the deployment but is not deployed as a part of it. This will give you the chance to run a test against, for example, JSF pages or RMI (testing for those nasty Non-Serializable / SessionClosed exceptions).
- Multiple deployments controlled by same test -- Sometimes your micro deployment is not enough to test on its own and you want to package other components as part of the same deployment. For example, you need to test the interaction between two Web applications.
- Support for method argument injection -- In the first alpha we only support field injection. In alpha 2 we will be extending the TestEnricher SPI to include support for method argument injection:
@Test
public void shouldWithdrawFromAccount(@EJB AccountManager manager) throws Exception
{
...
}
- Test method interceptors -- Another planned enricher SPI is a test method interceptor. With this we can add support for transactions:
@Test
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void shouldWithdrawFromAccount(@EJB AccountManager manager) throws Exception
{
...
}
- Convention over configuration -- The micro deployments should be as easy as possible to create, so adding support for common conventions should help speed up the test development. For example we can automatically add all classes in the same package as the test class to the deployment
- Arquillian controlled resources -- Sometimes the container requires container specific configuration e.g, java.naming.\* parameters needed to create a InitialContext. If the test case has to explicitly deal with this, it places the burden for container portability back on the test case author. Arquillian will provide an extension point to add Arquillian created/managed resources:
// auto creation of InitialContext based on running container, remote or local. @ArquillianResource private InitialContext context; // auto creation of URL to a specific deployed Servlet, including http port/ip etc. @ArquillianResource(MyServlet.class) private URL myServletURL; // the bundle context of a deployed osgi bundle @ArquillianResource private BundleContext context;
- Add support for more containers -- We will plan to support more containers! Currently we have planned: GlassFish 3 (as a remote container), Jetty, Tomcat, Resin, Felix OSGI. (Hey Spring guys, you're welcome to join in too!)
- Third party integrations -- In the spirit of ease of development, we integrate with existing test frameworks as much as possible, but we are always keen to learn of new frameworks we can integrate with. We already plan to support Selenium for example.
- Support for other build tools -- Arquillian Alpha1 comes with Maven support. In upcoming releases, we will distribute builds targeted toward other build tools like Ant and Gradle (that shout out is for our resident Gradle expert, Jason Porter).
- A project page, logo and artwork -- All good things must look good. That's why the JBoss.org design team is hard at work putting together artwork for the Arquillian project page. Stay tuned!
Where can I see Arquillian in use?
Arquillian is a new framework, but it's going to be put right to work as the workhorse to test all the Seam 3 modules. It will also be our recommended solution for testing your Seam application. (We'd love to see the community try it out for testing Seam 2 applications). We'll also replace the current core of the JSR-299 CDI TCK with Arquillian, likely for the 1.1 version of the TCK. (To provide a little history, Arquillian originated from the JBoss Test Harness that was developed by Pete Muir as the foundation of the CDI TCK).
If you have any thoughts on these ideas, or would like to suggest some new avenues we should explore, please contact us on the Arquillian Dev forum.
And, what's open source with out the community?!
A big thanks to the Arquillian and ShrinkWrap community for helping out on this release by being early adopters, joining in on community meetings, general discussions and writing blogs, articles and patches. In alphabetical order: Dan Allen, Steven Boscarine, German Escobar, Jordan Ganoff, Ken Gullaksen, Pete Muir, Jason Porter, Andrew Lee Rubinger. You guys rock!
[ JIRA ] | [ SPI Javadoc, API Javadoc ] | [ Reference Guide ] | [ Release Notes ] | [ Maven Artifacts ]
Recently, we've been working hard on a solution to improve the testability of Java EE, and particularly JBoss AS. I'm pleased to say that a critical piece of puzzle, Arqullian, is now available. Congratulations to Aslak and the Arquillian team for releasing the first alpha of Arquillian! You can read more about Arquillian's mission, and our plans for Java EE testing below; alternatively, there are some quick links at the bottom if you want to dive right in.
The mission of the Arquillian project is to provide a simple test harness that developers can use to produce a broad range of integration tests for their Java applications (most likely enterprise applications). A test case may be executed within the container, deployed alongside the code under test, or by coordinating with the container, acting as a client to the deployed code. Arquillian defines two styles of container, remote and embedded. A remote container resides in a separate JVM from the test runner. Its lifecycle may be managed by Arquillian, or Arquillian may bind to a container that is already started. An embedded container resides in the same JVM and is mostly likely managed by Arquillian. Containers can be further classified by their capabilities. Examples include a fully compliant Java EE application server (e.g., GlassFish, JBoss AS, Embedded GlassFish), a Servlet container (e.g., Tomcat, Jetty) and a bean container (e.g., Weld SE). Arquillian ensures that the container used for testing is pluggable, so the developer is not locked into a proprietary testing environment. Arquillian seeks to minimize the burden on the developer to carry out integration testing by handling all aspects of test execution, including:To avoid introducing unnecessary complexity into the developer's build environment, Arquillian integrates transparently with familiar testing frameworks (e.g., JUnit 4, TestNG 5), allowing tests to be launched using existing IDE, Ant and Maven test plugins without any add-ons.
- managing the lifecycle of the container (start/stop),
- bundling the test class with dependent classes and resources into a deployable archive,
- enhancing the test class (e.g., resolving @Inject, @EJB and @Resource injections),
- deploying the archive to test (deploy/undeploy) and
- capturing results and failures.
The Arquillian Mission Statement
The first alpha release of Arquillian gives us support for JBoss AS (remote deployments), GlassFish (embedded deployments), Weld SE (embedded deployments) and OpenEJB (embedded deployments). You can also inject beans and component (using @Resource or @Inject) into test cases.
We'll be adding supported containers in future releases - if you want to see your favorite container on the list, join our community and we can show you how to add support for it. We also plan to add more convention over configuration, meaning you'll only need to specify a single deployment and reuse it in all your test cases. Aslak has written more about future ideas in a follow-up blog entry. He also provides some examples of how to use Arquillian.
We're strong believers in writing tests, and writing tests which actually test your business logic in the environment it will finally run in, rather than introducing mocked out objects (which may behave differently). While unit testing is important to ensure the correctness of your logic, it does not ensure the correctness of two objects which interact with each other.
With the help of the ShrinkWrap project, Arquillian gives you the ability to create micro deployments
around your tests. Micro-deployments are contained sub-sections of your application logic. This gives you the ability to do lower level integration testing on a lower level then normal integration. It is up to you at what level you want to test!
We also know you need a convenient way to run your test quickly, and that is why we are getting JBoss Embedded AS in shape. Embedded AS offers the potential to bootstrap JBoss AS inside the same JVM when you run your test, making it super easy to debug the test. Unfortunately, Embedded AS support didn't make this release (we made a decision to release what we have now, rather than delay), but we will push this out to you as soon as it's ready.
Testing your components and services gets you a long way, but you'll nearly always want to test your presentation tier as well. And that's where frameworks like JSFUnit and Selenium come in - they allow you to exercise the work flows your user will use. Support for both these frameworks is planned, as well as for Mock JSF Objects
.
If you like what you've heard so far, but are worried that Arquillian requires build script wizardry to use, let us surprise you again! Being able to run any of these tests from within the IDE is a key goal of Arquillian -- and the key to a rapid development cycle. Arquillian requires no build wizardry! So check out the documentation and give it a try today!
[ JIRA ] | [ SPI Javadoc, API Javadoc ] | [ Reference Guide ] | [ Release Notes ]
The final release of JBoss Tools 3.1 is here!
3.1 Final
Update site changes
The update site for the final release is http://download.jboss.org/jbosstools/updates/stable/galileo.
Users moving from JBoss Tools 3.0 on Eclipse 3.4 to JBoss Tools 3.1 will need to install Eclipse 3.5 and then add the update site. Updating Eclipse major versions just goes easier if you do it like that.
Installation
This is the official version of JBoss Tools that will run on and require Eclipse 3.5 (Galileo). When installing you can either use the remote Update Site or download the update site zip from the main Download for offline installation. In both cases you can pick and choose which plugins/features you want to install.
For some features other dependencies are needed. For example Maven integration requires m2eclipse 0.10. We have done what we can to enable the related update sites, but in case you disabled them explicitly you would need to add or enable them manually. If you have problems with the installation see this
New Features overview
You can read the previous release blogs or read the full What's New and Noteworthy to get all the glory details for the changes between JBoss Tools 3.0 to 3.1.
Following is a few of the highlights.
Additional Server and deployment support
Support for JBoss Enterprise Application Platform (EAP) and Enterprise SOA Platform (SOA-P) 5 as well as community JBoss AS 5.x and even AS 6 M1 is supported.
With the Module Assembly Page it is now possible to more finegrained control over the assembly of Web Tools Projects.
We introduced the notion of deploying to SSH enabled hosts allowing for basic remote deployments on the local network or on remote clouds
such as Amazon EC2.
Portal
Support for JBoss Portal and it's successor GateIn and Enterprise Portal Platform (EPP) have been added.
JSF 2
JSF 2 is now supported as well as JSF 1 w/facelets with many optimization in the performance of the visual page editor.
New features in JSF 2 such as composite components and resource look ups are now supported in the visual page editor and in the (x)html code completion.
A lot of improvements in the code completion and visual presentation have made it now even easier and faster to write JSF components no matter if you are into editing source code or visual previewing.
Seam
Seam 2.2 support including improved navigation and refactoring of Seam components together with the improvements in JSF support makes JBoss Tools perfect for Seam development.
Hibernate
Hibernate tooling works with connections configured in DTP and Eclipse Dali making it simpler to share connection settings.
If you have an existing Java model you can now easily get either hbm.xml mappings or JPA annotations generated for this model.
Project Examples
It is now easier to get started using JBoss technology by using the Help > Project Examples menu.
More examples have been added and the import have been enhanced to make it more informative about what runtime platforms and versions it will work on.
Maven
Maven users can now easily import their Maven projects with m2eclipse and JBoss Tools Maven integration will configure support for JSF, Maven and Portal development in the IDE.
CDI
The Context and Dependency Injection specification is supported by providing code completion for @Named component and all the code completion, open-on navigation and refactoring that was done for Seam also applies to CDI components.
SOA
SOA tooling have been extended massively by adding support for BPEL on Riftsaw, ESB projects, jbpm4, Drools 5 and Smooks.
Smooks got its own revamped editor and the other editors have been extended and interlinking between the various SOA editors allowing for easy navigation is in place.
ESB Projects allow for easy creation of ESB esb-service and deployment with instant debugging.
...and more!
Have fun!
| Showing 1 to 5 of 646 blog entries |
|
|