use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class StandaloneObjectFactoryTest method testLocalObject1.
public void testLocalObject1() throws Exception {
StandaloneObjectFactory factory = new StandaloneObjectFactory();
factory.defineObject(Object1.class.getSimpleName(), Object1.class.getName(), Scope.LOCAL);
// $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 same", obj1 != obj2);
Object1 obj3 = factory.get(Object1.class, session1);
// $NON-NLS-1$
assertTrue("Objects are same", obj1 != obj3);
}
use of org.pentaho.platform.engine.core.system.StandaloneSession 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);
}
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class StandaloneSessionTest method testAuthenticated.
public void testAuthenticated() {
// $NON-NLS-1$
StandaloneSession session = new StandaloneSession("testname");
// $NON-NLS-1$
assertFalse("Wrong authenication", session.isAuthenticated());
session.setAuthenticated(null);
// $NON-NLS-1$
assertFalse("Wrong authenication", session.isAuthenticated());
// $NON-NLS-1$
session.setAuthenticated("testname");
// $NON-NLS-1$
assertTrue("Wrong authenication", session.isAuthenticated());
session.setNotAuthenticated();
// $NON-NLS-1$
assertNull("session name is wrong", session.getName());
// $NON-NLS-1$
assertFalse("Wrong authenication", session.isAuthenticated());
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class StandaloneSessionTest method testLogger.
public void testLogger() {
StandaloneSession session = new StandaloneSession();
// $NON-NLS-1$
assertNotNull("Bad logger", session.getLogger());
}
use of org.pentaho.platform.engine.core.system.StandaloneSession in project pentaho-platform by pentaho.
the class StandaloneSessionTest method testDefaultConstructor.
public void testDefaultConstructor() {
StandaloneSession session = new StandaloneSession();
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("session name is wrong", "unknown", session.getName());
// $NON-NLS-1$ //$NON-NLS-2$
assertEquals("session id is wrong", "unknown", session.getId());
// $NON-NLS-1$
assertEquals("session locale is wrong", Locale.getDefault(), session.getLocale());
// make sure this does not blow up
session.destroy();
// $NON-NLS-1$
assertEquals("session object name is wrong", StandaloneSession.class.getName(), session.getObjectName());
}
Aggregations