Пример #1
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();
  }
 @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();
 }
 @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");
 }
Пример #4
0
 @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");
 }
Пример #5
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();
 }
Пример #6
0
 /** 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();
 }
Пример #7
0
 /** 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
 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.");
 }
Пример #9
0
 /** 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.");
 }
Пример #10
0
 /** 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.");
 }
 private EjercicioSession getEjercicioSession() throws NamingException {
   return (EjercicioSession) container.getContext().lookup("java:global/classes/EjercicioSession");
 }
Пример #12
0
 @Before
 public void inject() throws NamingException {
   if (container != null) {
     container.getContext().bind("inject", this);
   }
 }
Пример #13
0
 private SerieSession getSerieSession() throws NamingException {
   return (SerieSession) container.getContext().lookup("java:global/classes/SerieSession");
 }
 @Before
 public void setUp() {
   ejbContainer = EJBContainer.createEJBContainer();
   context = ejbContainer.getContext();
 }
 @BeforeClass
 public static void beforeClass() {
   ejbContainer = EJBContainer.createEJBContainer();
   context = ejbContainer.getContext();
 }
Пример #16
0
 /**
  * Bootstrap the Embedded EJB Container
  *
  * @throws Exception
  */
 @Override
 protected void setUp() throws Exception {
   ejbContainer = EJBContainer.createEJBContainer();
   ejbContainer.getContext().bind("inject", this);
 }