Community

having problems with testNG and Seam tools -

reply from William Woodman in JBoss Tools - View the full discussion

ok - not sure what has happened - however i built the project on my 'other machine' and tried again applying what i'd learned to date

 

1.     workspace with no spaces in any of the paths

2.     set the vm option to include "-Dsun.lang.ClassLoader.allowArraySyntax=true" for my 1.6 vm i use

3.     imported the xxx-ds.xml data source from the xxx-ear/resources folder into the xxx-test/bootstrap/deploy folder

4      imported the xxx-ejb/META-INF/persistence.xml into the xxx-test/META-INF folder

5.     wrote some simple tests

 

 

and 'whoa' this seemed to work  - i've attached my notes as a word rtf file if any is interested

 

however i still have problem.

 

i write a test that does an @In directive - and this doesnt seem to work - so something is still missing - if i do get on the entityManager - this works - but the injection doesnt - my assert fails the tests

 

so why does the injection fail ?  would rfeally appreciate any guidance - am i just being stupid or what ?

 

 

 

package org.domain.forsterslist.entity;import javax.persistence.EntityManager;import org.jboss.seam.annotations.In;import org.jboss.seam.annotations.Name;import org.jboss.seam.mock.SeamTest;import org.testng.annotations.Test;@Name (value="nodeTest")public class NodeTest extends SeamTest{    @In (value="entityManager", create=true)    EntityManager em;    @In (create=true)    Node node;            @Test  //passes    public void entityManagerTest() throws Exception     {        new ComponentTest()         {            @Override            protected void testComponents() throws Exception             {                assert 1 == 1;                EntityManager entityManager = (EntityManager) getInstance("entityManager");                assert (entityManager != null);            }        }.run();    }    @Test //passes    public void basic ()     {        String testStr = "basic test ";                System.out.println (testStr);        assert testStr.equals("basic test ");            }        @Test     public void injectedNodeTest () throws Exception     {        assert node != null;  //fails        node.setName("my node");        assert node.getName().equals("my node");    }        @Test    public void injectionEntityManagerTest () throws Exception    {        new ComponentTest ()        {            @Override             protected void testComponents () throws Exception            {                                assert em != null;  //fails            }        }.run ();    }}

 

Reply to this message by going to Community

Start a new discussion in JBoss Tools at Community