Nov 21, 2009

Prebuilt BPEL Templates for Oracle R12 EBS

The Oracle EBS R12 product team has developed custom prebuilt BPEL business processes for the following modules:
  •    Oracle Price Protection
  •    Complex Maintenance, Repair, and Overhaul
  •    Oracle Transportation Management
  •    Supply Chain Trading Connector
  •    Advanced Supply Chain Planning
  •    Product Information Management
These prebuilt BPEL processes have been certified with Oracle BPEL Process Manager 10g version 10.1.3.5 (in Oracle SOA Suite 10.1.3.5) for Oracle E-Business Suite Release 12.1.1 and higher.
Information about using these prebuilt SOA integrations can be found in My Oracle Support Note 755067.1: Using Oracle BPEL 10with E-Business Suite Release 12.1.1 or Higher(http://support.oracle.com). Oracle support is available with a valid customer support contract for issues that arise in integrating the SOA Suite adapter with the Oracle E-Business Suite.

Apr 19, 2009

Sample Stateless Session Bean

Stateless session beans are session beans whose instances have no conversational state. This means that all bean instances are equivalent when they are not involved in servicing a client-invoked method. The term 'stateless' signifies that an instance has no state for a specific client.

CalculatorBean

package org.superbiz.stateless.basic;

import javax.ejb.Stateless;

@Stateless
public class CalculatorBean {

    public int add(int a, int b) {
        return a + b;
    }

    public int subtract(int a, int b) {
        return a - b;
    }

    public int multiply(int a, int b) {
        return a * b;
    }

    public int divide(int a, int b) {
        return a / b;
    }

    public int remainder(int a, int b) {
        return a % b;
    }
}

CalculatorTest

Our CalculatorBean can be easily tested using the EJBContainer API in EJB 3.1
package org.superbiz.stateless.basic;

import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import javax.ejb.embeddable.EJBContainer;
import javax.naming.NamingException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class CalculatorTest {

    private static EJBContainer ejbContainer;

    private CalculatorBean calculator;

    @BeforeClass
    public static void startTheContainer() {
        ejbContainer = EJBContainer.createEJBContainer();
    }

    @Before
    public void lookupABean() throws NamingException {
        Object object = ejbContainer.getContext().lookup("java:global/simple-stateless/CalculatorBean");

        assertTrue(object instanceof CalculatorBean);

        calculator = (CalculatorBean) object;
    }

    @AfterClass
    public static void stopTheContainer() {
        if (ejbContainer != null) {
            ejbContainer.close();
        }
    }

    /**
     * Test Add method
     */
    @Test
    public void testAdd() {

        assertEquals(10, calculator.add(4, 6));

    }

    /**
     * Test Subtract method
     */
    @Test
    public void testSubtract() {

        assertEquals(-2, calculator.subtract(4, 6));

    }

    /**
     * Test Multiply method
     */
    @Test
    public void testMultiply() {

        assertEquals(24, calculator.multiply(4, 6));

    }

    /**
     * Test Divide method
     */
    @Test
    public void testDivide() {

        assertEquals(2, calculator.divide(12, 6));

    }

    /**
     * Test Remainder method
     */
    @Test
    public void testRemainder() {

        assertEquals(4, calculator.remainder(46, 6));

    }

}