JUnit tests in Eclipse and ME Persistance initialization

Hi all,
first I want to say hello, because i am new to this forum and it seems to be a great place to share knowledge.
Here´s my problem:
I try to test a ME-Application using JUnit in Eclipse. The application makes heavy use of the persistence layer. I can not run a simple test, because a NullPointerException in the File-class occurs during the ME persistence initialization steps (STEP 2) while the Persistence is setup. I guess the problem is that the PersistenceRuntime can not find the replicated data. Is there any way to set a path to the data ? Or is it not possible to test the application without running it inside the server environment.
Thx for any help
Sascha
(Unknown Source)
     at com.sap.ip.me.api.persist.core.PersistenceRuntime.getInstance(Unknown Source)
     at x.y.z.persistence.ReadWriteEntities.setupPersistenceRuntime(ReadWriteEntities.java:55)
at x.y.z.persistence.ReadWriteEntities.readEntities(ReadWriteEntities.java:174)

Apparently you will have to install an Oracle 11g JDBC Client / Software. I have an Oracle 11g Client install on my machine and I didn't find a "ocijdbc11" file, so my guess is that this is a separate install OR was an option I had to check/enable for install during the client 11g software install.
The is a manual about this:
http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/getsta.htm#i1007825
and a FAQ:
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html
Oracle 11g JDBC drivers can be downloaded here:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/htdocs/jdbc_111060.html
As an alternative you could use the instant client OS specific libraries:
http://www.oracle.com/technology/tech/oci/instantclient/index.html

Similar Messages

  • Tried to add JUnit Test in Eclipse -- "Test type does not exist" error

    Hi guys,
    I'm developing an assignment whose details I won't bother going into -- it's enough to say that we were introduced to JUnit testing a couple of weeks ago in university tutorials, and I've stupidly tried to add one to my project without fully understanding it all. This is in eclipse 3.1.1.
    Basically, I followed eclipse's built-in tutorial called "Writing and running JUnit tests ".
    1) Created class "TestFailure" with method "testFailure".
    public void testFailure() throws Exception {
        fail();
    } 2) This then appeared as a .java file in my project (as well as on my UML diagram, courtesy of Omondo's UML plugin).
    3) I decided it was too risky mucking around with this stuff in a "live" project, so went ahead and deleted the TestFailure icon on my class diagram.
    4) I closed down eclipse.
    5) I went ahead and deleted TestFailure.java and TestFailure.class from my project folders.
    6) I opened my project again, and tried to execute...
    ... and now I keep getting a Test type does not exist error when I try and run it.
    How on earth do I get rid of this?
    Any advice/guidance is greatly appriciated -- oh, how I wish I'd not started messing with JUnit testing!!! :)

    Um, okay -- I fully hold my hands up and admit that I don't know what I'm doing with JUnit testing (we only had a half hour intro to it) but figured I may as well learn by using the official tutorials. It's always a good place to start! Although obviously using a current assignment isn't the best idea ;)
    I was executing my main class (obviously with my main method in there) to execute the program after I'd deleted test case classes, but strangely I've just shut down my machine and restarted and it's working fine. I'm not sure what the deal is here -- lesson learnt though, study new topics on a dummy project! :)
    Anyway, if I waited until I understood the software and code I'm producing to its fullest, I think hell'd freeze over before I executed any code! :) Using a tutorial to learn a new aspect of software I'm already familiar with wasn't a bad move, IMHO. Just using it on this particular project was... Needless stress and all that.

  • Persist does not throw any exception in a JUnit test

    I am implementing a JUnit test using Toplink as JPA provider. I must be missing something because I try to persist two times the same entity and no exception is thrown. Neither PersistenceException nor any other type of exception. The code cannot be easier:
    @Test
    public void testAddExistingTeam() throws Exception {
    Team team = new Team("team2");
    try{     
    EntityManagerFactory emf =
    Persistence.createEntityManagerFactory("fofo");
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    em.persist(team);
    em.persist(team);
    em.getTransaction().commit();
    em.close();
    catch(Exception e){
    e.printStackTrace();
    Notice the two em.persist(team).
    This code does not seem to either enter the catch block or produce any sort of exception. On the other hand, I have checked that after the first
    em.persist(team); the team is really managed.
    The relevant parts of the Team class definition follow:
    @Entity
    @Table (name ="TEAM")
    public class Team implements Serializable {
    @Id
    @Column (name="NAME")
    private String name;
    @ManyToOne
    @JoinColumn (name="CLUB_NAME", referencedColumnName="NAME")
    private Club club;
    private Category category;
    private String email;
    @ManyToMany(mappedBy="teams")
    private List<Competition> competitions;
    public Team (String name){
    this.name = name;
    this.club = null;
    this.competitions = new ArrayList<Competition>();
    ....getters/setters....and more constructors.
    I am really puzzled by this issue. Somebody could help??? I would be really grateful!!!
    Josepma

    This is expected behavior as persist is a no-op if called on a managed entity (other than to cascade over relationships marked with cascade.Persist), and the first persist call makes the passed in team entity managed.
    Try calling em.flush(); and em.clear(); between the persist calls to get an exception.
    The first flush will ensure the team is inserted in the database, while clear will detach it so that the second persist call will try to insert the team. JPA providers are not required to throw the entityExistsException on persist - it can be delayed until the transaction is flushed or committed, so you are likely to get a PersistenceException from the commit instead of EntityExistsException from persist.
    Best Regards,
    Chris

  • JUnit Tests (How To) - Websphere/Eclipse

    I'm about to start looking into using JUnit to test some db resultset timings. As I haven't really dived into this before, I'm looking for some guidance.
    Can someone post an example of how I would use JUnit to test the timing of a resultset or the timing of a procedure.
    I could just do a simple timed test, but I want to start using JUnit.
    Where:
    <start timing>
    do a bunch of really wild stuff
    <end timing>
    Thanks.

    JUnit isn't meant for performance timing. There's nothing to stop you from doing it, of course.
    JUnit might be pertinent if you had a metric that would define success or failure of your "really wild stuff".
    But timing would be more the province of JMeter or another performance measurement tool.
    With that said, Eclipse handles JUnit tests easily. Just have the JUnit JAR in your project's build path. Open the debug view and you can run any JUnit test in your project.
    I have an Ant build.xml that runs all the tests in my projects automatically and generates reports for viewing in a Web browser. That's a great way to go, IMO.

  • [svn:bz-trunk] 13744: Bug: BLZ-481 - AMFConnection JUnit test do not run properly as part of checkintests on Mac  (and Windows?)

    Revision: 13744
    Revision: 13744
    Author:   [email protected]
    Date:     2010-01-25 01:14:09 -0800 (Mon, 25 Jan 2010)
    Log Message:
    Bug: BLZ-481 - AMFConnection JUnit test do not run properly as part of checkintests on Mac (and Windows?)
    QA: No
    Doc: No
    Checkintests: Pass
    Details:
    -Don't start the server before unit task, unit task already checks if the server is not running and starts the server.
    -Don't stop the server after FlexUnit tests, JUnit tests need the server running, and they will stop the server after they are done.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/BLZ-481
    Modified Paths:
        blazeds/trunk/build.xml
        blazeds/trunk/qa/apps/qa-regress/testsuites/flexunit/build.xml

    Tony,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Do a search of our knowledgebase at http://support.novell.com/search/kb_index.jsp
    - Check all of the other support tools and options available at
    http://support.novell.com.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://support.novell.com/forums)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://support.novell.com/forums/faq_general.html
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://support.novell.com/forums/

  • Problem with JUnit Testing from Command Prompt

    Hi There,
    Related Info:
    OS - Windows 7 32 Bit, IDE Used: Eclipse
    I'm using the following command to compile the java file from the command prompt:
    C:\Users\J\Desktop> javac -classpath .:junit.jar check4PrimeTest.java
    I get the error: "package junit.framework does not exist import junit.framework.*;"
    How can i fix this?
    I have downloaded junit from junit.org the 'junit4.10' and extracted in my Java Folder along side jdkjdk1.7.0_03, jre6, jre7.
    I will post my code below for the 'check4PrimeTest.java' file which im trying to test from the command prompt.
    package check4prime;
    // check4PrimeTest.java
    //Imports
    import junit.framework.*;
    public class check4PrimeTest extends TestCase {
         //Initialize a class to work with.
         private check4Prime check4prime = new check4Prime();
         //constructor
         public check4PrimeTest (String name) {
              super(name);
         //Main entry point
         public static void main(String[] args) {
              System.out.println("Starting test...");
              junit.textui.TestRunner.run(suite());
              System.out.println("Test finished...");
         } // end main()
         //Test case 1
         public void testCheckPrime_true() {
              assertTrue(check4prime.primeCheck(3));
         //Test cases 2,3
         public void testCheckPrime_false() {
              assertFalse(check4prime.primeCheck(0));
              assertFalse(check4prime.primeCheck(1000));
         //Test case 7
         public void testCheck4Prime_checkArgs_char_input() {
              try {
                   String [] args= new String[1];
                   args[0]="r";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } //end testCheck4Prime_checkArgs_char_input()
         //Test case 5
         public void testCheck4Prime_checkArgs_above_upper_bound() {
              try {
                   String [] args= new String[1];
                   args[0]="10001";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_upper_bound()
         //Test case 4
         public void testCheck4Prime_checkArgs_neg_input() {
              try {
                   String [] args= new String[1];
                   args[0]="-1";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_neg_input()
         //Test case 6
         public void testCheck4Prime_checkArgs_2_inputs() {
              try {
                   String [] args= new String[2];
                   args[0]="5";
                   args[1]="99";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
               } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_2_inputs
         //Test case 8
         public void testCheck4Prime_checkArgs_0_inputs() {
              try {
                   String [] args= new String[0];
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_0_inputs
         //JUnit required method.
         public static Test suite() {
              TestSuite suite = new TestSuite(check4PrimeTest.class);
              return suite;
         } //end suite()
    } //end check4PrimeTestEdited by: 963042 on Oct 3, 2012 8:57 PM
    Edited by: 963042 on Oct 3, 2012 10:07 PM

    963042 wrote:
    C:\Users\J\Desktop> javac -classpath .:junit.jar check4PrimeTest.javaThat's the Linux way to do it. On windows there is a different list separator. Use this:
    javac -cp .;junit.jar check4PrimeTest.java
    And use -cp to save you some typing ;) If you want to incorporate unit testing into your builds I would suggest looking into automating it a little more through tool such as ant, maven, etc.

  • Unable to run ADFBC JUNIT Test Classes with JDEV11G 11.1.1.6

    Dear All,
    I upgraded my project to the latest release JDEV 11G 11.1.1.6
    Previously we are on JDEV 11G 11.1.1.5
    I have a JUNIT class that I am running which test my ADFBC components.
    public class MyTestClass {
      @Test
      public void testVOAccess()
        //assertions
    }Unfortunately, I am hitting an error like this from the messages.
    Mar 9, 2012 1:28:07 PM oracle.adf.share.ADFContext getCurrent
    WARNING: Automatically initializing a DefaultContext for getCurrent.
    Caller should ensure that a DefaultContext is proper for this use.
    Memory leaks and/or unexpected behaviour may occur if the automatic initialization is performed improperly.
    This message may be avoided by performing initADFContext before using getCurrent().
    For more information please enable logging for oracle.adf.share.ADFContext at FINEST level.
    Mar 9, 2012 1:28:08 PM oracle.security.jps.internal.config.xml.XmlConfigurationFactory initDefaultConfiguration
    SEVERE: org.xml.sax.SAXParseException: Invalid encoding name "Cp1252".
    Mar 9, 2012 1:28:10 PM oracle.mds
    NOTIFICATION: PManager instance is created without multitenancy support as JVM flag "oracle.multitenant.enabled" is not set to enable multitenancy support.
    Mar 9, 2012 1:28:12 PM oracle.security.jps.internal.config.xml.XmlConfigurationFactory initDefaultConfiguration
    SEVERE: org.xml.sax.SAXParseException: Invalid encoding name "Cp1252".
    Mar 9, 2012 1:28:12 PM oracle.adf.share.jndi.ReferenceStoreHelper getReferencesMapEx
    WARNING: Incomplete connection reference object for connection:MYDATASOURCEAt the JUNIT Test Runner, I see this.
    java.lang.ExceptionInInitializerError: null
         java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:171)
         org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:216)
    Caused by: oracle.jbo.DMLException: JBO-26061: Error while opening JDBC connection.
         oracle.jbo.server.ConnectionPool.createConnection(ConnectionPool.java:207)
         oracle.jbo.server.ConnectionPool.instantiateResource(ConnectionPool.java:166)To validate the issue, I tried to run my same project using the older release which is JDEV 11G 11.1.1.5
    and I see that I am not hitting any error. All my test classes runs fine.
    Has anybody replicated this?
    Thanks

    Didier Laurent wrote:
    I logged the following bug for this issue:
    bug 14030895 - REGR: JDEVELOPER 11.1.1.6.0 JUNIT JBO-26061 ERROR WHILE OPENING JDBC CONNECTION
    Regards,
    Didier.So its really a bug..
    I abandon this already since I cannot find any solution to look up for this.
    On the other hand, I am maintaining two jdeveloper version just to get around this problem.
    When testing ADFBC, I used the 11.1.1.5 while for non-junit test I used the 11.1.1.6
    Hopefully this gets fixed on the next release as I am having a hard time swithcing between two JDev version.
    Thanks
    Edited by: Neliel on May 3, 2012 11:42 PM

  • Getting error while writing JUnit test case for RestFul Services

    Hi All,
    I have written Restful services in Netbean 6.8.
    It's running well...no issues.
    {color:#0000ff}While writing JUnit test cases for them, I am getting following error:
    {color}{color:#993300}Testcase: testGetAuthenticated(com.ct.services.LoginServicesTest): Caused an ERROR
    Implementing class{color}
    java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:303)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:160)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
    at com.ct.services.LoginServices.getAuthenticated(LoginServices.java:205)
    at com.ct.services.LoginServicesTest.testGetAuthenticated(LoginServicesTest.java:84)
    Test com.ct.services.LoginServicesTest FAILED
    F:\NetbeanProjectsWorkspace\DemoProject\nbproject\build-impl.xml:972: Some tests failed; see details above.
    BUILD FAILED (total time: 11 seconds)
    {color:#0000ff}Strange thing is that when I am commenting below lines and its related calls:
    {color}
    {color:#ff0000}EntityManagerFactory mEmf = Persistence.createEntityManagerFactory("AnyName");
    EntityManager mEm = mEmf.createEntityManager();
    {color}
    {color:#0000ff}from my code, JUnit test cases are working fine.
    {color}Anybody having any idea about this ?
    Thanks
    Avi
    Edited by: Avi007 on Aug 28, 2010 5:17 AM

    Hi All,
    [http://stackoverflow.com/questions/2778295/test-driven-development-problem]
    Please refer the above link for the solution
    Thanks
    Avi
    Edited by: Avi007 on Aug 30, 2010 12:33 AM

  • Re: junit test for entity beans ... ejb 3.0

    I'm confused. I'm trying to test my entity bean.
    I have:
    - an entity bean
    - a stateless session bean for accessing the entity bean (facade)
    - an interface for accessing the the stateless bean
    And I'm trying to write a JUnit test class to test this bean. However, I am uncertain as to how to test this (I'm new to EJB 3.0, JBoss and Eclipse).
    What would the JUnit test look like? I'm confused as to whether or not I should be injecting the interface/bean/what???
    I've tried several variations. I either get "NameNotFound" - not bound exceptions or Null pointer exceptions.
    What would the @EJB syntax look like or how would I do it through the context?
    For Example:
    @EJB private TestFacade myTest; //interface to stateless bean ?
    OR
    InitialContext ctx = new InitialContext();
    TestResultFacadeBean myTest = (TestResultFacadeBean) ctx.lookup("localTest");
    I'm confused at to which method I should be using and what object I should be accessing. If I could get either one to work, I'd be happy. :)
    How do I ensure my bean is deployed to the container? What do I need to do?
    If anyone has a simple example or explanation as to which method I should use and how to use it, I'd be very grateful.
    Thanks very much,
    LisaD

    OK, you need to have several layers of testing.
    Layer 0. Test the entity beans are deployable (more on this later). Basically, you need to know that all your annotations work. Things to watch out for are multiple @Id fields in one class or @EmbeddedID or @IdClass in conjuction with @ManyToOne, @ManyToMany, @OneToMany, @OneToOne and fun with @JoinTable, @JoinColumn and @JoinColumns. Once you know how these are supposed to work with the spec, it's not too bad to write it correctly each time. But there are some gotchas that will break things later on.
    Layer 1. Do the functions in the classes that don't depend on annotations work as expected. Typically, this is just going to be the getters and setters in your entity classes. Of course JUnit best practice says we don't bother testing functions that look like:
    public T getX() {
    return this.x;
    or
    public void setX(T x) {
    this.x = x;
    as there is nothing that can go wrong with them. So in that case, your level 1 tests will just be initial values specified from constructors and verifying that the non-get/set pairs work, and that the getters you have tagged @Transient work (because you've likely put some logic in them)
    Layer 2. Test the session bean methods that don't require injection to work.
    Layer 3. Test the session bean methods that require injection (Mock Objects). Simulate the injection for yourself, injecting Mock Objects for the entity manager. Then you can confirm that the correct methods are being called in the correct sequences, etc.
    [Note this may require some skill in designing the mock.  I'm working on developing my own entitymanager mock, and if it looks usefull I'll release it to the world.
    Layer 4. Test the session bean methods that require injection (Real entity manager) (See Layer 0)
    For this you will need an out of container persistence implementation.  Currently Hibernate and Glassfish provide beta versions.  You will need a different persistence.xml file that lists all the entities.  You will have to use reflection to inject the entity manager(s) that you create from an entity manager factory unless you provide a constructor that takes an EntityManager as a parameter.  You may need to use reflection to call any @PostConstruct method if you made it private.
    Layer 5. Navigate the relationships in the objects returned from Layer 4 using a database that has been loaded with test data.
    I am currently using Layers 0, 1, 2 & 4 to test my session beans and entity beans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Exception while running a test file as JUNIT test case

    Hi,
    I am trying to build a code using Eclipse to generate an "ear" file that can be used for deployment. The ear file is generated successfully but the build is not successful as the following exception is thrown while debugging a junit test case:
    javax.naming.CommunicationException: tdk.dk:389 [Root exception is java.net.SocketTimeoutException: connect timed out]
         at com.sun.jndi.ldap.Connection.<init>(Connection.java:197)
         at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:118)
         at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1580)
         at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2616)
         at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:287)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
         at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
         at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
         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 junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         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:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         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)
    Kindly suggest a solution.
    P.S. : All test cases are running fine except for one test case, whose error details are given.

    No it is not. The Oracle JDeveloper and ADF forum is for development questions around development with Oracle JDeveloper and ADF.
    If you use Eclipse through OEPE, you could post the question here
    Enterprise Pack for Eclipse
    If you don't use OEPE but Eclipse, then this forum may be a great source of help: http://stackoverflow.com/
    Frank

  • Creating junit test cases using the reflection API

    In order to use the reflection API to get information about a *.java file's class name and methods, I need to compile the *.java file first, and then get info through the *.class file. Am I right?
    Eclipse, the Java IDE, can create junit test cases for java files the user selects right after the *.java files have been created, and even before the *.java files have been compiled by the user. I guess Eclipse internally compiles the java files before creating JUnit test cases for them. Does anyone know about it? Thanks.

    Let me explain my problem in more details.
    Given any java source tree, my program is supposed to create junit test cases for each class using java reflection. My approach is to scan through the source tree to keep the list of classes available, then compile all the java files in the given source tree, then do Class.forName() to load them to get their methods... Obviously I don't know what classes I will have at compilation time. I create a temp_classes directory as the output directory for the given source tree java files, and I add temp_classes to my classpath when I strart up my own program. However, that won't work..
    D:\eclipse\workspace\cmpe271_hw4\classes>java -classpath ..\classes;..\temp_classes Test
    javac -classpath .\temp_classes; -d .\temp_classes @temp_classes\javalist.txt
    java.lang.ClassNotFoundException: Factory
    java.lang.ClassNotFoundException: InvalidDateFormatException
    java.lang.ClassNotFoundException: MyUtility
    java.lang.ClassNotFoundException: Storage

  • Eclipse and Classpath Errors

    I have been writing some small applications within Eclipse and they run fine within eclipse; however, when I go and export these projects and try to run the JAR file that has been created, I am getting classpath errors.
    At the following link https://cms.psu.edu/AngelUploads/Files/buk110/huh.jpg Is a screenshot of my Java Build Path Screen.
    Am I doing something wrong? Any help would be appreciated...
    Thanks

    Problems still are occuring for me. However, I believe I am getting closer to what I need to do.
    I have exported the project to a jar file into a folder I've called test. In this "test" folder I've also created a folder called "jars" which consists of all of my external jar files.
    I've then edited the manifest file as follows
    Manifest-Version: 1.0
    Main-Class: keyword_listing
    Class-Path: jars/i-text-1.3.jar jars/junit-3.8.1.jar jars/log4j-1.2.9.jar jars/tm-extractors-0.4.jarBut I still get the errors as before. Am I totally going in the wrong direction or am I missing something really simple?

  • Cannot get to debugger when Debug As - Junit Test in OEPE

    In Oracle Enterprise Pack for Eclipse, I created a JUnit (3 or 4) test case. When I attempted to Debug As -> Junit Test, I would get NullPointerException and cannot get to the debugger at all. However, there is no such problem in Ganymede (not OEPE). Is this a known problem for OEPE?
    The stack trace is:
    junit.framework.AssertionFailedError: Exception in constructor: testMapCustomer (org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
         at org.springframework.test.ConditionalTestCase.<init>(ConditionalTestCase.java:50)
         at org.springframework.test.AbstractSpringContextTests.<init>(AbstractSpringContextTests.java:73)
         at org.springframework.test.AbstractSingleSpringContextTests.<init>(AbstractSingleSpringContextTests.java:80)
         at org.springframework.test.AbstractDependencyInjectionSpringContextTests.<init>(AbstractDependencyInjectionSpringContextTests.java:98)
         at com.cibc.wmfxr.pricing.processor.test.Junit38SybaseDaoTest.<init>(Junit38SybaseDaoTest.java:6)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at junit.framework.TestSuite.createTest(TestSuite.java:54)
         at junit.framework.TestSuite.addTestMethod(TestSuite.java:280)
         at junit.framework.TestSuite.<init>(TestSuite.java:140)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
         ... 21 more
    Caused by: java.lang.NullPointerException
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
         at org.springframework.test.ConditionalTestCase.<init>(ConditionalTestCase.java:50)
         at org.springframework.test.AbstractSpringContextTests.<init>(AbstractSpringContextTests.java:74)
         at org.springframework.test.AbstractSingleSpringContextTests.<init>(AbstractSingleSpringContextTests.java:80)
         at org.springframework.test.AbstractDependencyInjectionSpringContextTests.<init>(AbstractDependencyInjectionSpringContextTests.java:98)
         at com.cibc.wmfxr.pricing.processor.test.Junit38SybaseDaoTest.<init>(Junit38SybaseDaoTest.java:6)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at junit.framework.TestSuite.createTest(TestSuite.java:54)
         at junit.framework.TestSuite.addTestMethod(TestSuite.java:280)
         at junit.framework.TestSuite.<init>(TestSuite.java:140)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:674)
         ... 2 more
         at junit.framework.Assert.fail(Assert.java:47)
         at junit.framework.TestSuite$1.runTest(TestSuite.java:90)
         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:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Thanks. I tried it with the downloaded junit-4.6.jar and got the following stack trace. Now I wonder I should try it with the Junit bundle in the SpringSource Enterprise Bundle Repository since OEPE integrates the Spring OSGi Bundle. If this is the right idea, could you let me know how to install the Junit bundle in OEPE? Do I just add it to bundles.info? There are already a few lines for org.junit in bundles.info. What should I do with them? Thanks a lot.
    java.lang.ExceptionInInitializerError
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
         at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
         at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
         at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
         at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
         at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:28)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:24)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
         at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<clinit>(SpringJUnit4ClassRunner.java:63)
         ... 18 more
    Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
         ... 22 more
    Caused by: java.lang.NullPointerException
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
         ... 23 more

  • Unable to establish loopback connection when running junit tests

    Hello,
    I just started using jrockit (jrockit-jdk1.6.0_20-R28.1.0-4.0.1) and I encounter a problem running junit tests.
    I have 2 tests in the same junit suite, both do binding to 127.0.0.1.
    The first test succeeds in the binding. Once it finishes, the second one tries to bind to same address and fails due to IOException, Unable to establish loopback connection (logs below)
    If I run them using sun's hotspot jvm they work fine.
    If I run them separately, i.e, only one test per suite, each works fine.
    It seems that only when switching to jrockit I get the problem.
    Any idea?
    Thanks,
    Edo
    Logs:
    ERROR [Main Thread_1] Failed to start ConnectionFullVirtualServer[server.traffix.com/127.0.0.1:3868]
    [org.jboss.netty.channel.ChannelException: Failed to bind to: server.traffix.com/127.0.0.1:3868 ] thrown
         org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303)
         com.traffix.openblox.core.transport.ConnectionFullVirtualServer.listen(ConnectionFullVirtualServer.java:60)
         com.traffix.openblox.core.transport.VirtualServerTable.listen(VirtualServerTable.java:143)
         com.traffix.openblox.core.transport.StackImpl.doStart(StackImpl.java:772)
         com.traffix.openblox.core.transport.TransportStack.doStart(TransportStack.java:156)
         com.traffix.openblox.core.transport.StackStateMachineImpl.doStart(StackStateMachineImpl.java:75)
         com.traffix.openblox.core.transport.StackStateMachine$StackStateConfigured.processEvent(StackStateMachine.java:60)
         com.traffix.openblox.core.fsm.StateMachine.processEvent(StateMachine.java:90)
    Caused by: java.io.IOException: Unable to establish loopback connection
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:106)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41)
         sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)
         java.nio.channels.Selector.open(Selector.java:209)
         org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.<init>(NioServerSocketPipelineSink.java:219)
    Caused by: java.nio.channels.ClosedByInterruptException
         java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
         sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:518)
         java.nio.channels.SocketChannel.open(SocketChannel.java:146)
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:78)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41)[ com.traffix.openblox.core.transport.VirtualServerTable.listen(VirtualServerTable.java:146) ][22/12/2010 11:05:57:511]
    ERROR [Main Thread_1] Failed to start Endpoint Stack(server.traffix.com Configured)
    [org.jboss.netty.channel.ChannelException: Failed to bind to: server.traffix.com/127.0.0.1:3868 ] thrown
         org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:303)
         com.traffix.openblox.core.transport.ConnectionFullVirtualServer.listen(ConnectionFullVirtualServer.java:60)
         com.traffix.openblox.core.transport.VirtualServerTable.listen(VirtualServerTable.java:143)
         com.traffix.openblox.core.transport.StackImpl.doStart(StackImpl.java:772)
         com.traffix.openblox.core.transport.TransportStack.doStart(TransportStack.java:156)
         com.traffix.openblox.core.transport.StackStateMachineImpl.doStart(StackStateMachineImpl.java:75)
         com.traffix.openblox.core.transport.StackStateMachine$StackStateConfigured.processEvent(StackStateMachine.java:60)
         com.traffix.openblox.core.fsm.StateMachine.processEvent(StateMachine.java:90)
    Caused by: java.io.IOException: Unable to establish loopback connection
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:106)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41)
         sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:26)
         java.nio.channels.Selector.open(Selector.java:209)
         org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink$Boss.<init>(NioServerSocketPipelineSink.java:219)
    Caused by: java.nio.channels.ClosedByInterruptException
         java.nio.channels.spi.AbstractInterruptibleChannel.end(AbstractInterruptibleChannel.java:184)
         sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:518)
         java.nio.channels.SocketChannel.open(SocketChannel.java:146)
         sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:78)
         sun.nio.ch.PipeImpl.<init>(PipeImpl.java:122)
         sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:27)
         java.nio.channels.Pipe.open(Pipe.java:133)
         sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:41

    Have you tracked down if the phone actually sends the TCP connection to the desktop? I'm feeling that this is a firewall issue that shows itself when the firewall zone changes (public/private/domain).
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Problems Debugging JUnit Tests

    Hi,
    I have been trying a TDD approach to my new development and until my latest test everythings been working well. Im using Eclipse by the way with JUnit incoporated into my project
    Now I have the following problem..
    I ran my latest test and my CPU usage shot up to 100%. In an attempt to work out why I selected Debug as JUnit Project, the following was displayed
    Class File Editor
    The Source attachment does not contain the source for the file Assert.class
    You can change the source attachment by clicking change attached source below.
    Unfortunately I don't know what this means, can anyone help me out here?
    Thanks

    I don't have access to any other IDE's apart from Eclipse, so I can't check if they run outside.You don't need an IDE to run outside Eclipse. Just run JUnit from a command shell, just like any other Java program that you'd run if you didn't have ANY IDE.
    Whats Ant? I presume i'm not using it.Ant is an XML and Java-based make tool that's a standard for Java these days:
    http://ant.apache.org
    It can run all your JUnit tests as part of your build process. It'll even work with Eclipse.
    Its my last test thats causing it not to work however
    it never even returns a failure it hangs the system
    before the failure is reported. If I remove this test
    and debug the other tests however the same error
    described in the first post occurs.Can you step through that JUnit test in the Eclipse debugger to see where it's hanging up? If you're going to use an IDE, might as well put it to work.

Maybe you are looking for

  • ICloud does not recognize outlook 2010

    Win 7 64bit. Outlook 2010.  Open iCloud control and all items refering to Outlook are not selectable.  What have I missed? The [email protected] was added to Outlook.  Can receive and send mail.  Unable to sync calendars/task, contacts or mail. Thank

  • NB200 - Virtual screen resolution on Windows 7

    Quote: +The 10.1-inch glossy screen features a resolution of 1,024 x 600, and is bright and pleasant to use.+ +If you find that some programs have elements which appear off the screen, the graphics drivers support a virtual resolution up to 1,600 x 1

  • Installed ScanSnap and now receive a request to change my harddrive each time I open a pdf.

    I recently installed a ScanSnap and it changed my Adobe Acrobat 8 Professional to the point where each time I open this program or even a pdf file, I receive a User Account Control warning message asking whether the "Adobe Acrobat application program

  • BPM - Formerly galaxy

    Is BPM part of CE7.1 only? Is EHP CE7.1 required? Is it also available as part of EHP for 7.0?  Please let me know. thanks

  • Is it possible to enable Subpixel rendering on iPad Mini?

    Hi, is it possible to enable Subpixel rendering of text on the iPad mini?  That would make text easier to read at small sizes. http://en.wikipedia.org/wiki/Subpixel_rendering