Search in sources :

Example 16 with ObjectFactoryException

use of org.pentaho.platform.api.engine.ObjectFactoryException in project pentaho-platform by pentaho.

the class StandaloneObjectFactoryTest method testGlobalObjectFail.

public void testGlobalObjectFail() throws Exception {
    StandaloneObjectFactory factory = new StandaloneObjectFactory();
    // $NON-NLS-1$
    factory.defineObject(Object1.class.getSimpleName(), "bogus", Scope.GLOBAL);
    // $NON-NLS-1$
    IPentahoSession session1 = new StandaloneSession("test user 1");
    try {
        factory.get(Object1.class, session1);
        // $NON-NLS-1$
        assertFalse("exception expected", true);
    } catch (ObjectFactoryException e) {
        // $NON-NLS-1$
        assertTrue("exception expected", true);
    }
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) StandaloneObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory)

Example 17 with ObjectFactoryException

use of org.pentaho.platform.api.engine.ObjectFactoryException in project pentaho-platform by pentaho.

the class StandaloneObjectFactoryTest method testThreadObjectFail1.

public void testThreadObjectFail1() throws Exception {
    StandaloneObjectFactory factory = new StandaloneObjectFactory();
    // $NON-NLS-1$
    factory.defineObject(Object1.class.getSimpleName(), "bogus", Scope.THREAD);
    // $NON-NLS-1$
    IPentahoSession session1 = new StandaloneSession("test user 1");
    try {
        factory.get(Object1.class, session1);
        // $NON-NLS-1$
        assertFalse("exception expected", true);
    } catch (ObjectFactoryException e) {
        // $NON-NLS-1$
        assertTrue("exception expected", true);
    }
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) StandaloneObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory)

Example 18 with ObjectFactoryException

use of org.pentaho.platform.api.engine.ObjectFactoryException in project pentaho-platform by pentaho.

the class StandaloneObjectFactoryTest method testInit.

public void testInit() throws Exception {
    // $NON-NLS-1$
    IPentahoSession session1 = new StandaloneSession("test user 1");
    StandaloneObjectFactory factory = new StandaloneObjectFactory();
    factory.defineObject(Object1.class.getSimpleName(), Object1.class.getName(), Scope.GLOBAL);
    // $NON-NLS-1$
    assertTrue("Object is not defined", factory.objectDefined(Object1.class.getSimpleName()));
    Object1 obj1 = factory.get(Object1.class, session1);
    // $NON-NLS-1$
    assertNotNull("Object is null", obj1);
    factory.init(null, null);
    // $NON-NLS-1$
    assertFalse("Object is defined", factory.objectDefined(Object1.class.getSimpleName()));
    assertNull(factory.getImplementingClass(Object1.class.getSimpleName()));
    try {
        factory.get(Object1.class, session1);
        // $NON-NLS-1$
        assertFalse("exception expected", true);
    } catch (ObjectFactoryException e) {
        // $NON-NLS-1$
        assertTrue("exception expected", true);
    }
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) StandaloneObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory)

Example 19 with ObjectFactoryException

use of org.pentaho.platform.api.engine.ObjectFactoryException in project pentaho-platform by pentaho.

the class StandaloneObjectFactoryTest method testSessionObjectFail1.

public void testSessionObjectFail1() throws Exception {
    StandaloneObjectFactory factory = new StandaloneObjectFactory();
    // $NON-NLS-1$
    factory.defineObject(Object1.class.getSimpleName(), "bogus", Scope.SESSION);
    // $NON-NLS-1$
    IPentahoSession session1 = new StandaloneSession("test user 1");
    try {
        factory.get(Object1.class, session1);
        // $NON-NLS-1$
        assertFalse("exception expected", true);
    } catch (ObjectFactoryException e) {
        // $NON-NLS-1$
        assertTrue("exception expected", true);
    }
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) StandaloneObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory)

Example 20 with ObjectFactoryException

use of org.pentaho.platform.api.engine.ObjectFactoryException in project pentaho-platform by pentaho.

the class StandaloneSpringPentahoObjectFactoryTest method testNoInit.

public void testNoInit() throws Exception {
    StandaloneSession session = new StandaloneSession();
    StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();
    try {
        GoodObject obj = factory.get(GoodObject.class, session);
        assertNotNull(obj);
        assertFalse(true);
    } catch (ObjectFactoryException e) {
        assertTrue(true);
    }
}
Also used : StandaloneSession(org.pentaho.platform.engine.core.system.StandaloneSession) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException) StandaloneSpringPentahoObjectFactory(org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)

Aggregations

ObjectFactoryException (org.pentaho.platform.api.engine.ObjectFactoryException)27 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)10 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)10 StandaloneObjectFactory (org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory)7 IPentahoObjectFactory (org.pentaho.platform.api.engine.IPentahoObjectFactory)5 DataSource (javax.sql.DataSource)4 IDBDatasourceService (org.pentaho.platform.api.data.IDBDatasourceService)4 ArrayList (java.util.ArrayList)3 DBDatasourceServiceException (org.pentaho.platform.api.data.DBDatasourceServiceException)3 StandaloneSpringPentahoObjectFactory (org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)3 SQLException (java.sql.SQLException)2 List (java.util.List)2 IOException (java.io.IOException)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 Principal (java.security.Principal)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1 PBEKeySpec (javax.crypto.spec.PBEKeySpec)1 PBEParameterSpec (javax.crypto.spec.PBEParameterSpec)1