He creado una clase sencilla como mis primeros pasos programando OpenXava 4.0.1. La clase funciona bien en Eclipse y en Liferay 6.0.5. Pero al ejectuar la prueba Junit surgen errores. Cualquier ayuda o sugerencia sera muy agradecida.
@Entity
public class Customer {
@Id
@Column(length=6)
private int number;
@Column(length=50)
@Required
private String name;
@Column(length=20)
private String region;
public void setNumber(int number) {
this.number = number;
}
public int getNumber() {
return number;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setRegion(String region) {
this.region = region;
}
public String getRegion() {
return region;
}
}
Esto funciona bien en Eclipse y en Liferay 6.0.5.
Al crear la siguiente prueba JUnit recibo un error.
package org.openxava.ox.tests;
import org.openxava.tests.*;
public class CustomerTest extends ModuleTestBase {
public CustomerTest(String nameTest) {
super(nameTest, "OX", "Customer");
// TODO Auto-generated constructor stub
}
public void testCreateReadUpdateDelete() throws Exception {
// Create
execute("CRUD.new"); // Clicks on 'New' button
setValue("number", "77"); // Types 77 as the value for the 'number' field
setValue("name", "JUNIT Customer"); // Sets the value for the 'name' field
setValue("region", "South");
execute("CRUD.save"); // Clicks on 'Save' button
assertNoErrors(); // Verifies that the application does not show errors
assertValue("number", ""); // Verifies the 'number' field is empty
assertValue("name", ""); // Verifies the 'name' field is empty
assertValue("region", ""); // Verifies the 'region' field is empty
// Read
setValue("number", "77"); // Types 77 as the value for the 'number' field
execute("CRUD.refresh"); // Clicks on 'Refresh' button
assertValue("number", "77"); // Verifies the 'number' field has 77
assertValue("name", "JUNIT Customer"); // and 'name' has 'JUNIT Customer'
assertValue("region", "South"); // Etc
// Update
setValue("name", "JUNIT Customer MODIFIED"); // Changes the value of 'name' field
execute("CRUD.save"); // Clicks on 'Search' button
assertNoErrors(); // Verifies that the application does not show errors
assertValue("number", ""); // Verifies the 'number' field is empty
assertValue("name", ""); // Verifies the 'name' field is empty
// Verify if modified
setValue("number", "77"); // Types 77 as the value for 'number' field
execute("CRUD.refresh"); // Clicks on 'Refresh' button
assertValue("number", "77"); // Verifies the 'number' field has 77
assertValue("name", "JUNIT Customer MODIFIED"); // and 'name'
Al ejecutar la prueba Run As->Junit Test, recibo el siguiente Trace.
java.lang.NullPointerException
at org.openxava.tests.ModuleTestBase.setNewModuleIfChanged(ModuleTestBase.java:1809)
at org.openxava.tests.ModuleTestBase.resetForm(ModuleTestBase.java:1804)
at org.openxava.tests.ModuleTestBase.resetModule(ModuleTestBase.java:460)
at org.openxava.tests.ModuleTestBase.setUp(ModuleTestBase.java:111)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
En consola sale la siguiente informacion.
Feb 11, 2011 1:41:50 PM org.hibernate.annotations.common.Version <clinit>
INFO: Hibernate Commons Annotations 3.2.0.Final
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.6.0.Final
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : javassist
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Feb 11, 2011 1:41:50 PM org.hibernate.util.DTDEntityResolver resolveEntity
WARNING: recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : GalleryImage.hbm.xml
Feb 11, 2011 1:41:50 PM org.hibernate.util.DTDEntityResolver resolveEntity
WARNING: recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Feb 11, 2011 1:41:51 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: statusCode= contentType=
Feb 11, 2011 1:41:51 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: <html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!-H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-></style> </head><body><h1>HTTP Status 404 - /OX/xava/module.jsp</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/OX/xava/module.jsp</u></p><p><b>description</b> <u>The requested resource (/OX/xava/module.jsp) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>
Feb 11, 2011 1:41:52 PM org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.6.0.Final
Feb 11, 2011 1:41:52 PM org.hibernate.util.DTDEntityResolver resolveEntity
WARNING: recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Feb 11, 2011 1:41:52 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: org.openxava.session.GalleryImage -> IMAGES
Feb 11, 2011 1:41:52 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: org.openxava.ox.model.Customer
Feb 11, 2011 1:41:52 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.openxava.ox.model.Customer on table Customer
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: org.openxava.ox.model.Category
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.openxava.ox.model.Category on table Category
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: org.openxava.ox.model.Product
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.openxava.ox.model.Product on table Product
Feb 11, 2011 1:41:53 PM org.hibernate.validator.Version <clinit>
INFO: Hibernate Validator 3.1.0.GA
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.search.HibernateSearchEventListenerRegister enableHibernateSearch
INFO: Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: true
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost/OpenXava
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=postgres, password=****, autocommit=true, release_mode=auto}
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Database ->
name : PostgreSQL
version : 8.4.7
major : 8
minor : 4
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Driver ->
name : PostgreSQL Native Driver
version : PostgreSQL 9.0 JDBC4 (build 801)
major : 9
minor : 0
Feb 11, 2011 1:41:53 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
Feb 11, 2011 1:41:53 PM org.hibernate.engine.jdbc.JdbcSupportLoader useContextualLobCreation
INFO: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
Feb 11, 2011 1:41:53 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
Feb 11, 2011 1:41:53 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Feb 11, 2011 1:41:53 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory createRegionFactory
INFO: Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Check Nullability in Core (should be disabled when Bean Validation is on): enabled
Feb 11, 2011 1:41:53 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Feb 11, 2011 1:41:53 PM org.hibernate.id.UUIDHexGenerator <init>
WARNING: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
Feb 11, 2011 1:41:53 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Luego de confirmar que Tomcat no estaba respondiendo (posible conflicto con Liferay y Eclipse en la misma pc).
Ahora el trace al ejecutar JUnit es..
com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName= attributeName= attributeValue=
at com.gargoylesoftware.htmlunit.html.HtmlPage.getElementByName(HtmlPage.java:1647)
at org.openxava.tests.ModuleTestBase.getTextAreaByName(ModuleTestBase.java:329)
at org.openxava.tests.ModuleTestBase.setFormValue(ModuleTestBase.java:219)
at org.openxava.tests.ModuleTestBase.setFormValue(ModuleTestBase.java:171)
at org.openxava.tests.ModuleTestBase.setFormValue(ModuleTestBase.java:167)
at org.openxava.tests.ModuleTestBase.setValue(ModuleTestBase.java:931)
at org.openxava.ox.tests.CustomerTest.testCreateReadUpdateDelete(CustomerTest.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Eso quiere decir que no encuentra el editor para number en la interfaz gráfica.
Para averiguar porque está pasando eso añade las siguientes líneas a tu test:
public void testCreateReadUpdateDelete() throws Exception {
// Create
execute("CRUD.new"); // Clicks on 'New' button
assertNoErrors(); // AÑADE ESTO: Para saber si CRUD.new ha fallado
printHtml(); // AÑADE ESTO: Esto saca en log el HTML completo de la página actual, así verás que página está viendo el test
setValue("number", "77"); // Types 77 as the value for the 'number' field
Dime que tal te va
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Le añadi las lineas al codigo y ejecutó perfectamente bien.
Exactamente no sé que pudo ser, pero esta entre Eclipse y Tomcat. Estoy notando que en el ambiente de Eclipse al recompilar el proyecto la sincronizacion con Tomcat no esta muy confiable. Como que los cambios no se reflejan en el server y tengo que dar restart a Tomcat para ver los cambios.
Cuando comense hoy, intente navegar a uno de los modulos y me salia un mensaje de apache que la pagina no estaba disponible. Le di restart varias veces al Tomcat y nada. Cerre el Eclipse, lo abri de nuevo y entonces arranco.
El ambiente de Eclipse y Tomcat son nuevos para mi, pues le estoy dando el beneficio de la duda a que yo este haciendo algo mal, pero me interesa saber si este compartamiento lo han visto otras personas.
Como siempre Javier, gracias por tu atencion.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Estoy notando que en el ambiente de Eclipse al recompilar el proyecto la sincronizacion con Tomcat no esta muy confiable
Tienes razón. Ese aspecto funciona bastante mal en las últimas versiones de Eclipse (3.6.0 y 3.6.1), esa es la razón por la que yo todavía uso el Eclipse 3.5.2. Descargate y usa el Eclipse 3.5.2, y no tendrás ningún problema con la sincronización de tu código, y el despliegue en el Tomcat.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hola, tuve un problema parecido y lo que encontré es que el método
org.openxava.tests.ModuleTestBase.login(user, password) no funciona con naviox y lo que aparece como html al iniciar la prueba es la ventana de login del naviox, lo he superado con esto:
... al inicio de tu test...
try{
log.debug("iniciando login");
changeModule("SignIn");
Saludos.
He creado una clase sencilla como mis primeros pasos programando OpenXava 4.0.1. La clase funciona bien en Eclipse y en Liferay 6.0.5. Pero al ejectuar la prueba Junit surgen errores. Cualquier ayuda o sugerencia sera muy agradecida.
Gracias,
La clase es
package org.openxava.ox.model;
import javax.persistence.*;
import org.openxava.annotations.*;
@Entity
public class Customer {
@Id
@Column(length=6)
private int number;
@Column(length=50)
@Required
private String name;
@Column(length=20)
private String region;
public void setNumber(int number) {
this.number = number;
}
public int getNumber() {
return number;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setRegion(String region) {
this.region = region;
}
public String getRegion() {
return region;
}
}
Esto funciona bien en Eclipse y en Liferay 6.0.5.
Al crear la siguiente prueba JUnit recibo un error.
package org.openxava.ox.tests;
import org.openxava.tests.*;
public class CustomerTest extends ModuleTestBase {
public CustomerTest(String nameTest) {
super(nameTest, "OX", "Customer");
// TODO Auto-generated constructor stub
}
public void testCreateReadUpdateDelete() throws Exception {
// Create
execute("CRUD.new"); // Clicks on 'New' button
setValue("number", "77"); // Types 77 as the value for the 'number' field
setValue("name", "JUNIT Customer"); // Sets the value for the 'name' field
setValue("region", "South");
execute("CRUD.save"); // Clicks on 'Save' button
assertNoErrors(); // Verifies that the application does not show errors
assertValue("number", ""); // Verifies the 'number' field is empty
assertValue("name", ""); // Verifies the 'name' field is empty
assertValue("region", ""); // Verifies the 'region' field is empty
// Read
setValue("number", "77"); // Types 77 as the value for the 'number' field
execute("CRUD.refresh"); // Clicks on 'Refresh' button
assertValue("number", "77"); // Verifies the 'number' field has 77
assertValue("name", "JUNIT Customer"); // and 'name' has 'JUNIT Customer'
assertValue("region", "South"); // Etc
// Update
setValue("name", "JUNIT Customer MODIFIED"); // Changes the value of 'name' field
execute("CRUD.save"); // Clicks on 'Search' button
assertNoErrors(); // Verifies that the application does not show errors
assertValue("number", ""); // Verifies the 'number' field is empty
assertValue("name", ""); // Verifies the 'name' field is empty
// Verify if modified
setValue("number", "77"); // Types 77 as the value for 'number' field
execute("CRUD.refresh"); // Clicks on 'Refresh' button
assertValue("number", "77"); // Verifies the 'number' field has 77
assertValue("name", "JUNIT Customer MODIFIED"); // and 'name'
// Delete
execute("CRUD.delete"); // Clicks on 'Delete' button
assertMessage("Customer deleted successfully");
}
}
Al ejecutar la prueba Run As->Junit Test, recibo el siguiente Trace.
java.lang.NullPointerException
at org.openxava.tests.ModuleTestBase.setNewModuleIfChanged(ModuleTestBase.java:1809)
at org.openxava.tests.ModuleTestBase.resetForm(ModuleTestBase.java:1804)
at org.openxava.tests.ModuleTestBase.resetModule(ModuleTestBase.java:460)
at org.openxava.tests.ModuleTestBase.setUp(ModuleTestBase.java:111)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
En consola sale la siguiente informacion.
Feb 11, 2011 1:41:50 PM org.hibernate.annotations.common.Version <clinit>
INFO: Hibernate Commons Annotations 3.2.0.Final
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.6.0.Final
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : javassist
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
Feb 11, 2011 1:41:50 PM org.hibernate.util.DTDEntityResolver resolveEntity
WARNING: recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration addResource
INFO: Reading mappings from resource : GalleryImage.hbm.xml
Feb 11, 2011 1:41:50 PM org.hibernate.util.DTDEntityResolver resolveEntity
WARNING: recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Feb 11, 2011 1:41:50 PM org.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
Feb 11, 2011 1:41:51 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: statusCode= contentType=
Feb 11, 2011 1:41:51 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: <html><head><title>Apache Tomcat/6.0.26 - Error report</title><style><!-H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-></style> </head><body><h1>HTTP Status 404 - /OX/xava/module.jsp</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/OX/xava/module.jsp</u></p><p><b>description</b> <u>The requested resource (/OX/xava/module.jsp) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.26</h3></body></html>
Feb 11, 2011 1:41:52 PM org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.6.0.Final
Feb 11, 2011 1:41:52 PM org.hibernate.util.DTDEntityResolver resolveEntity
WARNING: recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Feb 11, 2011 1:41:52 PM org.hibernate.cfg.HbmBinder bindRootPersistentClassCommonValues
INFO: Mapping class: org.openxava.session.GalleryImage -> IMAGES
Feb 11, 2011 1:41:52 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: org.openxava.ox.model.Customer
Feb 11, 2011 1:41:52 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.openxava.ox.model.Customer on table Customer
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: org.openxava.ox.model.Category
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.openxava.ox.model.Category on table Category
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: org.openxava.ox.model.Product
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity org.openxava.ox.model.Product on table Product
Feb 11, 2011 1:41:53 PM org.hibernate.validator.Version <clinit>
INFO: Hibernate Validator 3.1.0.GA
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.search.HibernateSearchEventListenerRegister enableHibernateSearch
INFO: Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Using Hibernate built-in connection pool (not for production use!)
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: Hibernate connection pool size: 20
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: autocommit mode: true
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost/OpenXava
Feb 11, 2011 1:41:53 PM org.hibernate.connection.DriverManagerConnectionProvider configure
INFO: connection properties: {user=postgres, password=****, autocommit=true, release_mode=auto}
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Database ->
name : PostgreSQL
version : 8.4.7
major : 8
minor : 4
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Driver ->
name : PostgreSQL Native Driver
version : PostgreSQL 9.0 JDBC4 (build 801)
major : 9
minor : 0
Feb 11, 2011 1:41:53 PM org.hibernate.dialect.Dialect <init>
INFO: Using dialect: org.hibernate.dialect.PostgreSQLDialect
Feb 11, 2011 1:41:53 PM org.hibernate.engine.jdbc.JdbcSupportLoader useContextualLobCreation
INFO: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
Feb 11, 2011 1:41:53 PM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
INFO: Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
Feb 11, 2011 1:41:53 PM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic flush during beforeCompletion(): disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Automatic session close at end of transaction: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch size: 15
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC batch updates for versioned data: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Scrollable result sets: enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JDBC3 getGeneratedKeys(): enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Connection release mode: auto
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default batch fetch size: 1
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Generate SQL with comments: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL updates by primary key: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Order SQL inserts for batching: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
Feb 11, 2011 1:41:53 PM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
INFO: Using ASTQueryTranslatorFactory
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: JPA-QL strict compliance: enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Second-level cache: enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Query cache: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory createRegionFactory
INFO: Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Structured second-level cache entries: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Statistics: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Deleted entity synthetic identifier rollback: disabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Default entity-mode: pojo
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Named query checking : enabled
Feb 11, 2011 1:41:53 PM org.hibernate.cfg.SettingsFactory buildSettings
INFO: Check Nullability in Core (should be disabled when Bean Validation is on): enabled
Feb 11, 2011 1:41:53 PM org.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Feb 11, 2011 1:41:53 PM org.hibernate.id.UUIDHexGenerator <init>
WARNING: Using org.hibernate.id.UUIDHexGenerator which does not generate IETF RFC 4122 compliant UUID values; consider using org.hibernate.id.UUIDGenerator instead
Feb 11, 2011 1:41:53 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
INFO: Not binding factory to JNDI, no JNDI name configured
Luego de confirmar que Tomcat no estaba respondiendo (posible conflicto con Liferay y Eclipse en la misma pc).
Ahora el trace al ejecutar JUnit es..
com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName= attributeName= attributeValue=
at com.gargoylesoftware.htmlunit.html.HtmlPage.getElementByName(HtmlPage.java:1647)
at org.openxava.tests.ModuleTestBase.getTextAreaByName(ModuleTestBase.java:329)
at org.openxava.tests.ModuleTestBase.setFormValue(ModuleTestBase.java:219)
at org.openxava.tests.ModuleTestBase.setFormValue(ModuleTestBase.java:171)
at org.openxava.tests.ModuleTestBase.setFormValue(ModuleTestBase.java:167)
at org.openxava.tests.ModuleTestBase.setValue(ModuleTestBase.java:931)
at org.openxava.ox.tests.CustomerTest.testCreateReadUpdateDelete(CustomerTest.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Hola Franklin,
* attributeName= attributeValue=
Eso quiere decir que no encuentra el editor para number en la interfaz gráfica.
Para averiguar porque está pasando eso añade las siguientes líneas a tu test:
Dime que tal te va
Javier, logre ejecutar la prueba exitosamente.
Gracias.
Hola Franklin,
¿Dónde estaba el problema?
Hola Javier.
Le añadi las lineas al codigo y ejecutó perfectamente bien.
Exactamente no sé que pudo ser, pero esta entre Eclipse y Tomcat. Estoy notando que en el ambiente de Eclipse al recompilar el proyecto la sincronizacion con Tomcat no esta muy confiable. Como que los cambios no se reflejan en el server y tengo que dar restart a Tomcat para ver los cambios.
Cuando comense hoy, intente navegar a uno de los modulos y me salia un mensaje de apache que la pagina no estaba disponible. Le di restart varias veces al Tomcat y nada. Cerre el Eclipse, lo abri de nuevo y entonces arranco.
El ambiente de Eclipse y Tomcat son nuevos para mi, pues le estoy dando el beneficio de la duda a que yo este haciendo algo mal, pero me interesa saber si este compartamiento lo han visto otras personas.
Como siempre Javier, gracias por tu atencion.
Hola Franklin,
Tienes razón. Ese aspecto funciona bastante mal en las últimas versiones de Eclipse (3.6.0 y 3.6.1), esa es la razón por la que yo todavía uso el Eclipse 3.5.2. Descargate y usa el Eclipse 3.5.2, y no tendrás ningún problema con la sincronización de tu código, y el despliegue en el Tomcat.
Hola Javier.
Gracias por la sugerencia.
Hola, tuve un problema parecido y lo que encontré es que el método
org.openxava.tests.ModuleTestBase.login(user, password) no funciona con naviox y lo que aparece como html al iniciar la prueba es la ventana de login del naviox, lo he superado con esto:
... al inicio de tu test...
try{
log.debug("iniciando login");
changeModule("SignIn");
}catch (Exception e){
log.debug("no ingreso al login");
}
... continua con tu test ...