@BeforeClass
 public static void initContainer() throws Exception {
   Map<String, Object> properties = new HashMap<>();
   properties.put(EJBContainer.MODULES, new File("target/classes"));
   ec = EJBContainer.createEJBContainer(properties);
   ctx = ec.getContext();
 }
Beispiel #2
0
  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    final Properties p = new Properties();

    // Configuración del Driver (2 opciones)

    // 1. Configurar datasource con propiedades
    // p.put("mysql", "new://Resource?type=DataSource");
    // p.put("movieDatabase.JdbcDriver", "com.mysql.jdbc.Driver");
    // p.put("movieDatabase.JdbcUrl",
    // "jdbc:mysql://localhost:3306/javalego?createDatabaseIfNotExist=true");
    // p.put("movieDatabase.Username", "root");

    // 2. Usar un fichero de configuración donde podremos incluir cualquier configuración
    // (datasource, ...) de open
    // ejb container.

    p.put("openejb.configuration", "src/main/resources/META-INF/openejb.xml");

    // Reducir el ámbito de clases CDI del contenedor openejb para reducir el tiempo de
    // localización. (por defecto
    // busca
    // en todas las clases del classpath).
    p.put("openejb.deployments.classpath.filter.descriptors", "true");
    p.put("openejb.exclude-include.order", "include-exclude"); // Defines the processing order
    p.put("openejb.deployments.classpath.include", ".*javalego.*"); // Include nothing
    p.put("openejb.descriptors.output", "true");

    // p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.LocalInitialContextFactory");

    container = EJBContainer.createEJBContainer(p);
    context = container.getContext();
  }
Beispiel #3
0
 @BeforeClass
 public static void setUpClass() throws Exception {
   Map<String, Object> properties = new HashMap<String, Object>();
   properties.put(EJBContainer.MODULES, prepareModuleDirectory());
   properties.put(
       "org.glassfish.ejb.embedded.glassfish.configuration.file",
       PATH_RESOURCES_TEST + "domain.xml");
   container = javax.ejb.embeddable.EJBContainer.createEJBContainer(properties);
   ctx = container.getContext();
 }
 /** Test of remove method, of class PaseoFacade. */
 @Test
 public void testRemove() throws Exception {
   System.out.println("remove");
   Paseo entity = null;
   EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
   PaseoFacade instance =
       (PaseoFacade) container.getContext().lookup("java:global/classes/PaseoFacade");
   instance.remove(entity);
   container.close();
   // TODO review the generated test code and remove the default call to fail.
   fail("The test case is a prototype.");
 }
 /** Test of getDoctorByPersonId method, of class DoctorFacade. */
 @Test
 public void testGetDoctorByPersonId() throws Exception {
   System.out.println("getDoctorByPersonId");
   Object personId = 954;
   EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
   DoctorFacade instance =
       (DoctorFacade) container.getContext().lookup("java:global/classes/DoctorFacade");
   Doctor expResult = new Doctor(954);
   Doctor result = instance.getDoctorByPersonId(personId);
   assertEquals(expResult, result);
   container.close();
 }
 /** Test of getAll method, of class RuleBL. */
 @Test
 public void testGetAll() throws Exception {
   System.out.println("getAll");
   EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
   RuleBLRemote instance =
       (RuleBLRemote) container.getContext().lookup("java:global/classes/RuleBL");
   List expResult = null;
   List result = instance.getAll();
   assertEquals(expResult, result);
   container.close();
   // TODO review the generated test code and remove the default call to fail.
   fail("The test case is a prototype.");
 }
 /** Test of count method, of class PaseoFacade. */
 @Test
 public void testCount() throws Exception {
   System.out.println("count");
   EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
   PaseoFacade instance =
       (PaseoFacade) container.getContext().lookup("java:global/classes/PaseoFacade");
   int expResult = 0;
   int result = instance.count();
   assertEquals(expResult, result);
   container.close();
   // TODO review the generated test code and remove the default call to fail.
   fail("The test case is a prototype.");
 }
 //    @Test
 public void testRemoveEjercicio_int() throws Exception {
   System.out.println("removeEjercicio");
   int idEjercicio = 0;
   EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
   EjercicioSession instance =
       (EjercicioSession) container.getContext().lookup("java:global/classes/EjercicioSession");
   boolean expResult = false;
   boolean result = instance.removeEjercicio(idEjercicio);
   assertEquals(expResult, result);
   container.close();
   // TODO review the generated test code and remove the default call to fail.
   fail("The test case is a prototype.");
 }
 @BeforeClass
 public static void start() throws Exception {
   Properties properties = new Properties();
   properties.setProperty(DeploymentFilterable.CLASSPATH_INCLUDE, ".*openejb-cxf-rs.*");
   properties.setProperty(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true");
   container = EJBContainer.createEJBContainer(properties);
 }
 @BeforeClass
 public static void beforeClass() throws Exception {
   // the following represents a db file in the users $HOME/data directory
   container = ContainerProducer.produceContainer("usermanager_test1");
   userManagerService =
       (UserManagerService)
           container.getContext().lookup("java:global/JPATemporalDB/UserManagerService");
 }
 @BeforeClass
 public static void setUpClass() throws Exception {
   properties = new HashMap<Object, Object>();
   properties.put(EJBContainer.APP_NAME, "GestionProjet");
   container = javax.ejb.embeddable.EJBContainer.createEJBContainer(properties);
   instanceTacheEJB =
       (TacheEJB) container.getContext().lookup("java:global/GestionProjet/classes/TacheEJB");
   instanceProjetEJB =
       (ProjetEJB) container.getContext().lookup("java:global/GestionProjet/classes/ProjetEJB");
   collection = new ArrayList<Tache>();
   collection.add(
       instanceTacheEJB.creerTache(
           "4",
           "",
           ImportanceEnum.IMPORTANT,
           instanceProjetEJB.creerProjet("Projet 6", "description")));
   id = instanceTacheEJB.getTache("4").getId();
   tache = instanceTacheEJB.getTache("4");
 }
Beispiel #12
0
  @BeforeClass
  public static void setUp() throws Exception {
    final Properties properties = new Properties();
    properties.setProperty("openejb.embedded.remotable", "true");

    // Just for this test we change the default port from 4204 to avoid conflicts
    properties.setProperty("httpejbd.port", "" + port);

    container = EJBContainer.createEJBContainer(properties);
  }
  public void testInject() throws Exception {

    Map<String, Object> map = new HashMap<String, Object>();

    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new SingletonBean(Widget.class));
    map.put(EJBContainer.MODULES, ejbJar);

    OpenEjbContainer openEjbContainer = (OpenEjbContainer) EJBContainer.createEJBContainer(map);

    openEjbContainer.inject(this);

    assertNotNull(widget);

    widget = null;

    openEjbContainer.getContext().bind("inject", this);

    openEjbContainer.close();
  }
 @BeforeClass
 public static void setUpClass() {
   container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
 }
 private EjercicioSession getEjercicioSession() throws NamingException {
   return (EjercicioSession) container.getContext().lookup("java:global/classes/EjercicioSession");
 }
 @BeforeClass
 public static void beforeClass() {
   ejbContainer = EJBContainer.createEJBContainer();
   context = ejbContainer.getContext();
 }
 @AfterClass
 public static void tearDownClass() throws Exception {
   container.close();
 }
 private SerieSession getSerieSession() throws NamingException {
   return (SerieSession) container.getContext().lookup("java:global/classes/SerieSession");
 }
Beispiel #19
0
 @Before
 public void inject() throws NamingException {
   if (container != null) {
     container.getContext().bind("inject", this);
   }
 }
 @AfterClass
 public static void afterClass() {
   ejbContainer.close();
 }
Beispiel #21
0
 @AfterClass
 public static void tearDownClass() throws Exception {
   container.close();
   FileUtils.cleanDirectory(new File(TARGET_DIR));
 }
 @AfterClass
 public static void close() throws Exception {
   if (container != null) {
     container.close();
   }
 }
 @Before
 public void setUp() {
   ejbContainer = EJBContainer.createEJBContainer();
   context = ejbContainer.getContext();
 }
 @AfterClass
 public static void tearDownClass() {
   container.close();
 }
Beispiel #25
0
 @AfterClass
 public static void close() {
   if (container != null) {
     container.close();
   }
 }
 @AfterClass
 public static void closeContainer() throws Exception {
   if (ctx != null) ctx.close();
   if (ec != null) ec.close();
 }
 @After
 public void tearDown() {
   if (ejbContainer != null) {
     ejbContainer.close();
   }
 }
 @BeforeClass
 public static void init() throws Exception {
   EJBContainer.createEJBContainer();
   emf = Persistence.createEntityManagerFactory("PersonaPU");
 }
Beispiel #29
0
 /**
  * Bootstrap the Embedded EJB Container
  *
  * @throws Exception
  */
 @Override
 protected void setUp() throws Exception {
   ejbContainer = EJBContainer.createEJBContainer();
   ejbContainer.getContext().bind("inject", this);
 }