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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations