db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Schilling (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-582) Test case needed for JDOFatalUserException nested exception argument needs cast to Throwable[]
Date Fri, 12 Sep 2008 02:25:44 GMT

    [ https://issues.apache.org/jira/browse/JDO-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630465#action_12630465
] 

Richard Schilling commented on JDO-582:
---------------------------------------

I setup the code now so that I'm using the META-INF/services/javax.jdo.PersistenceManagerFactory
approach.  The test is failing because no nested exception is being generated.  So, I'll look
into this to be sure I've written the original code correctly.  

Is the following the correct setup?

I reorganized the settings files so I have the following

Contents of Negative09/9a/META-INF/services/javax.jdo.PersistenceManagerFactory:
javax.jdo.JDOHelperTest$BadPMFWrongReturnType

Contents of Negative09/9b/META-INF/services/javax.jdo.PersistenceManagerFactory:
javax.jdo.JDOHelperTest$BadPMFGetPMFMethodThrowsJDOException

And, here is the method the calls upon these files:

public void testNegative09_MultipleInvalidClassesInDifferentConfigFiles()
            throws IOException {
        
        // failure ensured with a bad class name in Negative09/jdoconfig.xml
        try {
            URLClassLoader loader = new JDOConfigTestClassLoader(
                    JDOCONFIG_CLASSPATH_PREFIX,
                    getClass().getClassLoader());
            ClasspathHelper.addFile(
                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative09/9a", loader);
            ClasspathHelper.addFile(
                    JDOCONFIG_CLASSPATH_PREFIX + "/Negative09/9b", loader);

            JDOHelper.getPersistenceManagerFactory(loader);

            fail("JDOHelper failed to throw JDOFatalUserException");
        }
        catch (JDOFatalUserException x) {
            
            // if nested exceptions are returned, we're on the happy farm ...
            if (x.getNestedExceptions() == null){
                fail("JDOHelper failed to include any nested exceptions");
            } else {
                
                Throwable t[] = x.getNestedExceptions();
                System.out.println("There are " + t.length + " nested exceptiond.");
                for (int i=0;i<t.length;i++){
                    System.out.println("exception " + i + ": " + t[i].getMessage());
                }
            }
                

        }
    }


> Test case needed for JDOFatalUserException nested exception argument needs cast to Throwable[]
> ----------------------------------------------------------------------------------------------
>
>                 Key: JDO-582
>                 URL: https://issues.apache.org/jira/browse/JDO-582
>             Project: JDO
>          Issue Type: Bug
>          Components: api2, api2-legacy
>            Reporter: Erik Bengtson
>            Assignee: Richard Schilling
>             Fix For: JDO 2 maintenance release 2
>
>         Attachments: 20080710-jdo-582.diff, 20080710-jdo-582.diff, 20080911-jdo-582-JDOHelper.patch,
20080911-jdo-582-JDOHelperConfigTest.patch, 20080911-jdo-582-Negative09.patch, 20080911-jdo-582.patch,
20080911-jdo-582.patch, estedExceptionJDOHelper.patch, Negative09.zip
>
>
> After collecting exceptions from invoking getPersistenceManagerFactory on all implementations,
if no implementation has succeeded in returning a PersistenceManagerFactory, an exception
is thrown, and the argument should be a Throwable[]. Otherwise, it's treated as a failed object
instead of nested exceptions.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message