use of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory in project pentaho-platform by pentaho.
the class StandaloneObjectFactoryTest method testUndefinedImplementingClass.
public void testUndefinedImplementingClass() throws Exception {
StandaloneObjectFactory factory = new StandaloneObjectFactory();
assertNull(factory.getImplementingClass("bogus"));
}
use of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory in project pentaho-platform by pentaho.
the class StandaloneObjectFactoryTest method testGlobalObject2.
public void testGlobalObject2() throws Exception {
StandaloneObjectFactory factory = new StandaloneObjectFactory();
factory.defineObject(Object2.class.getSimpleName(), Object2.class.getName(), Scope.GLOBAL);
// $NON-NLS-1$
IPentahoSession session1 = new StandaloneSession("test user 1");
// $NON-NLS-1$
IPentahoSession session2 = new StandaloneSession("test user 2");
Object2 obj1 = factory.get(Object2.class, session1);
// $NON-NLS-1$
assertNotNull("Object is null", obj1);
Object2 obj2 = factory.get(Object2.class, session2);
// $NON-NLS-1$
assertNotNull("Object is null", obj2);
// $NON-NLS-1$
assertTrue("Objects are not same", obj1 == obj2);
}
use of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory in project pentaho-platform by pentaho.
the class StandaloneObjectFactoryTest method testThreadObject1.
public void testThreadObject1() throws Exception {
StandaloneObjectFactory factory = new StandaloneObjectFactory();
factory.defineObject(Object1.class.getSimpleName(), Object1.class.getName(), Scope.THREAD);
// $NON-NLS-1$
IPentahoSession session1 = new StandaloneSession("test user 1");
Object1 obj1 = factory.get(Object1.class, session1);
// $NON-NLS-1$
assertNotNull("Object is null", obj1);
Object1 obj2 = factory.get(Object1.class, session1);
// $NON-NLS-1$
assertNotNull("Object is null", obj2);
// $NON-NLS-1$
assertTrue("Objects are not same", obj1 == obj2);
Object1 obj3 = factory.get(Object1.class, session1);
// $NON-NLS-1$
assertTrue("Objects are not same", obj1 == obj3);
}
use of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory in project pentaho-platform by pentaho.
the class StandaloneObjectFactoryTest method testBadScope.
public void testBadScope() throws Exception {
// $NON-NLS-1$
IPentahoSession session1 = new StandaloneSession("test user 1");
StandaloneObjectFactory factory = new StandaloneObjectFactory();
factory.defineObject(Object1.class.getSimpleName(), Object1.class.getName(), null);
Object obj = factory.get(Object1.class, session1);
// $NON-NLS-1$
assertNull("object should be null", obj);
}
use of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory in project pentaho-platform by pentaho.
the class StandaloneObjectFactoryTest method testNoCreator.
public void testNoCreator() {
// $NON-NLS-1$
IPentahoSession session1 = new StandaloneSession("test user 1");
StandaloneObjectFactory factory = new StandaloneObjectFactory();
try {
factory.get(Object1.class, session1);
// $NON-NLS-1$
assertFalse("exception expected", true);
} catch (ObjectFactoryException e) {
// $NON-NLS-1$
assertTrue("exception expected", true);
}
}
Aggregations