Problem with Tapestry 5.2.4 & Selenium Tests - selenium

I am some problems since this morning with my Selenium Test.
I created a Selenium Test Class :
public class IEPatchSeleniumTest extends SeleniumTestCase{
#Test
public void testTypingXSSCode() {
open("/Index");
}
}
I configured my testng.xml like that :
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Kawwa Tests" verbose="1">
<test name="Integration Tests" enabled="true">
<parameter name="tapestry.web-app-folder" value="src/test/app0"/>
<packages>
<package name="net.mm.tapestry.security.integration" />
</packages>
</test>
</suite>
And my Maven-surefire-plugin declaration looks like :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/conf/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>-Xmx500m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
But when I ran my tests suite, i have got 2 errors :
<test-method status="FAIL" signature="testStartup(org.testng.ITestContext, org.testng.xml.XmlTest)" name="testStartup" is-config="true" duration-ms="0" depends-on-groups="beforeStartup" started-at="2011-02-04T13:46:02Z" finished-at="2011-02-04T13:46:02Z">
<exception class="org.testng.TestNGException">
<message>
<![CDATA[
Method testStartup requires 2 parameters but 0 were supplied in the #Configuration annotation.]]>
</message>
<full-stacktrace>
<![CDATA[org.testng.TestNGException:
Method testStartup requires 2 parameters but 0 were supplied in the #Configuration annotation.
at org.testng.internal.Parameters.checkParameterTypes(Parameters.java:147)
at org.testng.internal.Parameters.createParameters(Parameters.java:96)
at org.testng.internal.Parameters.createParameters(Parameters.java:289)
at org.testng.internal.Parameters.createConfigurationParameters(Parameters.java:70)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:135)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82)
at org.testng.TestRunner.beforeRun(TestRunner.java:501)
at org.testng.TestRunner.run(TestRunner.java:469)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
at org.testng.SuiteRunner.run(SuiteRunner.java:198)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
at org.testng.TestNG.run(TestNG.java:708)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
]]>
</full-stacktrace>
</exception>
</test-method>
<test-method status="FAIL" signature="indicateTestMethodName(java.lang.reflect.Method)" name="indicateTestMethodName" is-config="true" duration-ms="0" started-at="2011-02-04T13:46:02Z" finished-at="2011-02-04T13:46:02Z">
<params>
<value>
<![CDATA[public void net.mm.tapestry.security.integration.IEPatchSeleniumTest.testTypingXSSCode()]]>
</value>
</params>
<exception class="java.lang.NullPointerException">
<full-stacktrace>
<![CDATA[java.lang.NullPointerException
at org.apache.tapestry5.test.SeleniumTestCase.indicateTestMethodName(SeleniumTestCase.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:398)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:427)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
at org.testng.TestRunner.runWorkers(TestRunner.java:712)
at org.testng.TestRunner.privateRun(TestRunner.java:582)
at org.testng.TestRunner.run(TestRunner.java:477)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
at org.testng.SuiteRunner.run(SuiteRunner.java:198)
at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:821)
at org.testng.TestNG.runSuitesLocally(TestNG.java:788)
at org.testng.TestNG.run(TestNG.java:708)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:74)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
]]>
</full-stacktrace>
</exception>
</test-method>
Anyone had these problems before? Which solution did you choose ?
Thanks a lot.

Check the version of TestNG that is being set in your pom.xml. :)

Related

Upgrade from Infinispan 8 to 12

I am upgrading my project from infinispan cache version 8 to 12. After upgrading to infinispan 12 it is no longer possible to serialize a GregorianCalendar java type , resulting in the following error:
ERROR c.m.DemonAlimDatasManagerCourant - Erreur lors de l'alimentation des caches: ISPN000615: Unable to unmarshall 'java.util.GregorianCalendar' as a marshaller is not present in the user or global SerializationContext
org.infinispan.commons.marshall.MarshallingException: ISPN000615: Unable to unmarshall 'java.util.GregorianCalendar' as a marshaller is not present in the user or global SerializationContext
at org.infinispan.encoding.ProtostreamTranscoder.getCtxForMarshalling(ProtostreamTranscoder.java:198)
at org.infinispan.encoding.ProtostreamTranscoder.marshall(ProtostreamTranscoder.java:127)
at org.infinispan.encoding.ProtostreamTranscoder.transcode(ProtostreamTranscoder.java:68)
at org.infinispan.encoding.DataConversion.toStorage(DataConversion.java:227)
at org.infinispan.cache.impl.EncoderCache.valueToStorage(EncoderCache.java:105)
at org.infinispan.cache.impl.EncoderCache.put(EncoderCache.java:698)
at com.manager.DemonAlimDatasManagerCourant.alimenterData(DemonAlimDatasManagerCourant.java:180)
at com.manager.DemonAlimDatasManagerCourant.alimenterInstance(DemonAlimDatasManagerCourant.java:127)
at com.manager.DemonAlimDatasManagerCourant$$FastClassBySpringCGLIB$$a48662da.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at net.bull.javamelody.MonitoringSpringInterceptor.invoke(MonitoringSpringInterceptor.java:76)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
at com.manager.DemonAlimDatasManagerCourant$$EnhancerBySpringCGLIB$$de1659e7.alimenterInstance(<generated>)
at com.manager.DemonAlimDatasCourantService.enterDaemon(DemonAlimDatasCourantService.java:53)
at com.manager.DemonAlimDatasCourantService$$FastClassBySpringCGLIB$$723f4b20.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at net.bull.javamelody.MonitoringSpringInterceptor.invoke(MonitoringSpringInterceptor.java:76)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
at com.manager.DemonAlimDatasCourantService$$EnhancerBySpringCGLIB$$ea996e79.enterDaemon(<generated>)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
I tried with adding to my config file but it didin't give me a result
<?xml version="1.0" encoding="UTF-8"?>
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:12.1 http://infinispan.org/schemas/infinispan-config-12.1.xsd"
xmlns="urn:infinispan:config:12.1">
<cache-container default-cache="default" shutdown-hook="REGISTER">
<transport stack="tcp" node-name="ecr-dec-cache-light" cluster="ecr-cluster"/>
<serialization marshaller="org.infinispan.commons.marshall.JavaSerializationMarshaller">
<allow-list>
<class>java.util.GregorianCalendar</class>
</allow-list>
</serialization>
<jmx/>
<distributed-cache name="default" />
<distributed-cache name="parametrage" statistics="true" mode="SYNC" owners="1" remote-timeout="3600000">
<locking acquire-timeout="60000" />
<state-transfer enabled="false" />
</distributed-cache>
Is there any other solution?

How do I use a Citrus mail endpoint in an Arquillian test on JEE server

I have a Java webapp where a REST call triggers a mail sent through a javax.mail.Session. The application is deployed as a .war archive that I want to test inside a JBoss EAP 7.2 server.
I am using Arquillian 1.5.0.Final and Citrus Framework version 2.8.0. My build system is Gradle 5.x and everything is using a Java 8 runtime.
I would like to create a Citrus mail endpoint and use Arquillian to provide this inside the JEE container. My experience with these frameworks is limited to a few days, so I'm starting with a sample application to gain more knowledge:
I have the following working against a simple web endpoint (The HelloServlet from https://guides.gradle.org/building-java-web-applications/):
#RunWith(Arquillian.class)
public class HelloServletTest {
#CitrusFramework
private Citrus citrusFramework;
#ArquillianResource
private URL baseUri;
private String serviceUri;
#Deployment(testable = false)
public static WebArchive createDeployment() {
final WebArchive war = ShrinkWrap.create(WebArchive.class)
.addClass(HelloServlet.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
// [...]
return war;
}
#Before
public void setUp() throws Exception {
serviceUri = new URL(baseUri, "hello").toExternalForm();
}
#Test
#CitrusTest
public void smokeTest(#CitrusResource TestDesigner designer) throws InterruptedException {
System.err.println("ServiceURI: " + serviceUri);
designer.send(serviceUri)
.message(new HttpMessage("?name=Jacob")
.method(HttpMethod.POST));
designer.receive(serviceUri).message(new HttpMessage("").status(HttpStatus.OK));
citrusFramework.run(designer.getTestCase());
}
}
I use #Deployment(testable=false) as this example runs a client-side test. However, my end goal is to use Citrus inside the container so my understanding is that I need to have #Deployment(testable=true). But when I run the test with testable=true a NPE is thrown:
java.lang.NullPointerException
at com.consol.citrus.annotations.CitrusAnnotations.injectAll(CitrusAnnotations.java:61)
at com.consol.citrus.arquillian.enricher.CitrusTestEnricher.enrich(CitrusTestEnricher.java:57)
at org.jboss.arquillian.junit.RulesEnricher.enrichInstances(RulesEnricher.java:85)
at org.jboss.arquillian.junit.RulesEnricher.enrichStatement(RulesEnricher.java:77)
[...]
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:128)
at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:114)
[...]
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.fireCustomLifecycle(EventTestRunnerAdaptor.java:159)
at org.jboss.arquillian.junit.Arquillian$7.evaluate(Arquillian.java:273)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
[...]
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
[...]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
My arquillian.xml is
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<defaultProtocol type="Servlet 3.0"/>
<engine>
<property name="deploymentExportPath">build/deployments</property>
</engine>
<container qualifier="wildfly-managed" default="true">
</container>
<extension qualifier="citrus">
<property name="autoPackage">false</property>
<property name="citrusVersion">2.8.0</property>
</extension>
</arquillian>
My citrus-context.xml is
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:citrus-mail="http://www.citrusframework.org/schema/mail/config"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.citrusframework.org/schema/mail/config http://www.citrusframework.org/schema/mail/config/citrus-mail-config.xsd">
<!-- Mail server mock -->
<citrus-mail:server id="mailServer"
auto-start="true"
port="2222"/>
</beans>
My questions are:
Does my approach make sense? Is it feasible to use Citrus and Arquillian in this way?
Is the NPE exception to be expected or am I missing some dependency or configuration?

java.lang.ClassNotFoundException: org.eclipse.equinox.launcher.WebStartMain

I try to launch my RCP-project with jnlp. So i implemented a small e4-RCP project. Starting with the product doesn't cause any problem. The application supposedly works just fine. I installed a tomcat server running at localhost:8080, this also starts very well. Than i wrote a jnlp file for the app. exported and signed the jar. When i try to start the app. as http://localhost:8080/webstart.jnlp i get the exception:
java.lang.ClassNotFoundException: org.eclipse.equinox.launcher.WebStartMain
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at com.sun.jnlp.JNLPClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at de.checkpoint.webstart.WebstartLauncher.main(WebstartLauncher.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Thread.java:748)
Having said all all of that, here is my main:
package de.checkpoint.webstart;
import org.eclipse.equinox.launcher.WebStartMain;
public class WebstartLauncher {
public static void main(String[] args) {
WebStartMain.main(args);
}
}
Here is my jnlp file:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="webstart.jnlp">
<information>
<title>Jnlp Webstart Test</title>
<vendor>Boris Nguema B.</vendor>
<homepage href="http://localhost:8080/" />
<description>Testing Webstart</description>
</information>
<security>
<all-permissions/>
</security>
<!-- <property name="eclipse.product" value="de.checkpoint.product"/> -->
<!-- <property name="osgi.frameworkParentClassloader" value="current"/> -->
<!-- <property name="jnlp.osgi.parentClassloader" value="current"/> -->
<resources>
<j2se version="1.8+" />
<jar href="de.checkpoint.start_1.0.0.201711041646.jar" />
</resources>
<application-desc main-class="de.checkpoint.webstart.WebstartLauncher" />
</jnlp>
Can anyone tells me, what am I missing?
I am not sure if you already found out the problem,but equinox launcher do not have those lines in the manifest:
Permissions: all-permissions
Codebase: *
Trusted-Only: true
you need to add them and sign.

javax.persistence.PersistenceException: [PersistenceUnit: NG] Error while reading JPA XML file: META-INF/SQLQueries.xml

I have tried several suggested methods to resolve this java persistence exception but have not been successful yet. Any suggestions or help would be greatly appreciated.
Below are the details
SQLQueries.xml
-----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/orm_2_0.xsd "
version="2.0">
<sql-query name="GET_NEXT_NUM_SP" callable="true">
<return alias = "nextNumber" class="com.utility.numbergenerator.da.NumberDAOImpl">
<return-property name="nextSeqNum" column="NEXT_SEQ_NUM" />
</return>
{ ? = call Test_Proc }
</sql-query>
</entity-mappings>
persistence.xml
-----------------------
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="NG" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<mapping-file>META-INF/SQLQueries.xml</mapping-file>
<class> Several related classes </class>
<properties> Followed by properties </properties>
</persistence-unit>
Stack trace of the exception
-- Initializing database connection --
javax.persistence.PersistenceException: [PersistenceUnit: NG] Error while reading JPA XML file: META-INF/SQLQueries.xml
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1205)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:282)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:366)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
at com.go2uti.oneworld.common.hibernate.HibernateUtil.initializeJPA(HibernateUtil.java:68)
at com.go2uti.oneworld.common.hibernate.HibernateUtil.(HibernateUtil.java:38)
at com.go2uti.oneworld.utility.businessidgenerator.da.EntityManagerFactorySingleton.init(EntityManagerFactorySingleton.java:26)
at com.go2uti.oneworld.utility.businessidgenerator.compatibility.AbstractPersistentTest.initializeContext(AbstractPersistentTest.java:38)
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:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
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)
Caused by: org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:101)
at org.hibernate.cfg.Configuration.add(Configuration.java:513)
at org.hibernate.cfg.Configuration.add(Configuration.java:509)
at org.hibernate.cfg.Configuration.add(Configuration.java:716)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:801)
at org.hibernate.cfg.AnnotationConfiguration.addResource(AnnotationConfiguration.java:152)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1192)
... 34 more
Please help me resolve this issue.
Your META-INF/SQLQueries.xml file is based on JPA 2.0 XML mapping schema which is defined by http://java.sun.com/xml/ns/persistence/orm_2_0.xsd.
Since sql-query element is Hibernate specific you need to replace <entity-mappings> with <hibernate-mapping> as shown below:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<sql-query name="GET_NEXT_NUM_SP" callable="true">
<return alias="nextNumber" class="com.utility.numbergenerator.da.NumberDAOImpl">
<return-property name="nextSeqNum" column="NEXT_SEQ_NUM" />
</return>
{ ? = call Test_Proc }
</sql-query>
</hibernate-mapping>

Getting NPE when group is included

I hope you can help me on the following issue...
I am running a test that includes one class, in this class I have two methods. One belong to group G1 and the other one to G2.
If I use exclude group, the test is executed, if I use include group, test is skipped getting NPE.
I am using Eclipse 3.6 , Testng 6.8.
Example:
Test class:
public class{
#Test (groups = {"G1"})
public void Test1(){
...test code...
}
#Test (groups = {"G2"})
public void Test2(){
...test code...
}
}
Works:
<test name="Test_Name" preserve-order="true" >
<groups>
<run>
<exclude name="G1"/>
</run>
</groups>
<classes>
<class name="Test.class" />
</classes>
</test>
Test2 is executed.
Fails:
<test name="Test_Name" preserve-order="true" >
<groups>
<run>
<include name="G1" />
</run>
</groups>
<classes>
<class name="Test.class1" />
</classes>
</test>
Log:
java.lang.NullPointerException
at xxxxxxxxxxxxxxxxxxxxxxx.Test1(UsersTest.java:32) First line of the method
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod
(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods
(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Thanks!