Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:19:18+00:00 2026-06-01T09:19:18+00:00

What is the best way to integration test EJBs and REST-Resources?

  • 0

What is the best way to integration test EJBs and REST-Resources?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:19:19+00:00Added an answer on June 1, 2026 at 9:19 am

    You can do that through the EJB 3.1 EJBContainer API with a container that supports more than EJB lite. EJB lite is meant to be a minimum rather than a maximum.

    I know OpenEJB supports JAX-RS embedded, not sure on others. If they support JAX-RS through an embedded Arquillian adapter, they should be able to support it via the standard EJBContainer API which is meant for Java SE usage like testing or standalone apps.

    Here’s an example:

    • http://openejb.apache.org/examples-trunk/rest-on-ejb

    That one is not well documented, so here are the highlights.

    First, include the Embedded container libraries. In this case that is the following maven dependency:

    <dependency>
      <groupId>org.apache.openejb</groupId>
      <artifactId>openejb-cxf-rs</artifactId>
      <version>4.0.0-beta-3-SNAPSHOT</version>
      <scope>test</scope>
    </dependency>
    

    Then in your testcase, boot the EJBContainer:

    final Properties properties = new Properties();
    properties.setProperty("openejb.embedded.remotable", "true");
    EJBContainer.createEJBContainer(properties);
    

    You’re good to go, now you can send requests to your service. Using the CXF WebClient, that might look like this:

    Response response = WebClient.create("http://localhost:4204/rest-on-ejb")
            .path("/user/create")
            .query("name", "dummy")
            .query("pwd", "unbreakable")
            .query("mail", "foo@bar.fr")
            .put(null);
    
    // Then check the results via invoking the bean directly
    List<User> list = service.list(0, 100);
    for (User u : list) {
        if (!users.contains(u)) {
            service.delete(u.getId());
            return;
        }
    }
    fail("user was not added");
    

    Of course plain URL or Commons HttpClient works as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What would be the best way to implement integration test for chat application? The
What is the best way to unit test/integration test the following : @Service(fooService) public
what's the best way to change a subdomains for the duration of an integration
What's the best way to automate integration testing when they're are asynchronous callbacks involved?
the best way to explain is with example so: this is the model public
The best way I can think of to ask this is by example... In
The best way of describing this is I have a table of people with
The best way to store images into MySQL is by storing the image location
What is the best way to maintain upgrade scripts between versions of a product?
What is the best way to view the HTTP response headers from a request

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.