コード例 #1
0
ファイル: JpaTest.java プロジェクト: rranz/javalego
  @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();
  }
コード例 #2
0
 @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);
 }
コード例 #3
0
 @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();
 }
コード例 #4
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);
  }
コード例 #5
0
ファイル: BaseTestEJB.java プロジェクト: yano2h/TESIS
 @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.");
 }
コード例 #8
0
 //    @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 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.");
 }
コード例 #10
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.");
 }
コード例 #11
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");
 }
コード例 #12
0
  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();
  }
コード例 #13
0
 @BeforeClass
 public static void setUpClass() {
   container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
 }
コード例 #14
0
 @Before
 public void setUp() {
   ejbContainer = EJBContainer.createEJBContainer();
   context = ejbContainer.getContext();
 }
コード例 #15
0
 @BeforeClass
 public static void beforeClass() {
   ejbContainer = EJBContainer.createEJBContainer();
   context = ejbContainer.getContext();
 }
コード例 #16
0
 @BeforeClass
 public static void init() throws Exception {
   EJBContainer.createEJBContainer();
   emf = Persistence.createEntityManagerFactory("PersonaPU");
 }
コード例 #17
0
ファイル: BookShowTest.java プロジェクト: otonielsilva/tomee
 /**
  * Bootstrap the Embedded EJB Container
  *
  * @throws Exception
  */
 @Override
 protected void setUp() throws Exception {
   ejbContainer = EJBContainer.createEJBContainer();
   ejbContainer.getContext().bind("inject", this);
 }