Examples of StandaloneObjectFactory


Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

    factory.init( null, context );

    StandaloneSpringPentahoObjectFactory factory2 = new StandaloneSpringPentahoObjectFactory();
    factory2.init( "test-res/solution/system/pentahoObjects.spring.xml", null );

    StandaloneObjectFactory factory3 = new StandaloneObjectFactory();
    factory3.init( null, null );
    factory3.defineObject( "MimeTypeListener", MimeTypeListener.class.getName(),
      IPentahoDefinableObjectFactory.Scope.GLOBAL );

    AggregateObjectFactory aggFactory = new AggregateObjectFactory();
    aggFactory.registerObjectFactory( factory3 );
    aggFactory.registerObjectFactory( factory2 );
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

public class StandaloneObjectFactoryTest extends TestCase {

  public void testNoCreator() {

    IPentahoSession session1 = new StandaloneSession( "test user 1" ); //$NON-NLS-1$
    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    try {
      factory.get( Object1.class, session1 );
      assertFalse( "exception expected", true ); //$NON-NLS-1$
    } catch ( ObjectFactoryException e ) {
      assertTrue( "exception expected", true ); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

  }

  public void testBadScope() throws Exception {

    IPentahoSession session1 = new StandaloneSession( "test user 1" ); //$NON-NLS-1$
    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    factory.defineObject( Object1.class.getSimpleName(), Object1.class.getName(), null );

    Object obj = factory.get( Object1.class, session1 );
    assertNull( "object should be null", obj ); //$NON-NLS-1$

  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

  }

  public void testImplementingClass() throws Exception {

    IPentahoSession session1 = new StandaloneSession( "test user 1" ); //$NON-NLS-1$
    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    factory.defineObject( Object1.class.getSimpleName(), Object1.class.getName(), Scope.GLOBAL );
    factory.defineObject( "bogus2", "bogus", Scope.GLOBAL ); //$NON-NLS-1$ //$NON-NLS-2$

    Object1 obj = factory.get( Object1.class, session1 );
    assertNotNull( obj );

    assertEquals( Object1.class.getName(), factory.getImplementingClass( Object1.class.getSimpleName() ).getName() );
  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

    assertEquals( Object1.class.getName(), factory.getImplementingClass( Object1.class.getSimpleName() ).getName() );
  }

  public void testUndefinedImplementingClass() throws Exception {

    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    assertNull( factory.getImplementingClass( "bogus" ) );
  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

    assertNull( factory.getImplementingClass( "bogus" ) );
  }

  public void testImplementingClassNotFound() throws Exception {

    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    factory.defineObject( "bogus", "NotARealClass", Scope.GLOBAL ); //$NON-NLS-1$ //$NON-NLS-2$

    try {
      factory.getImplementingClass( "bogus" );
      fail( "exception was expected" );
    } catch ( RuntimeException e ) {
      //ignored
    }
  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

  }

  public void testInit() throws Exception {

    IPentahoSession session1 = new StandaloneSession( "test user 1" ); //$NON-NLS-1$
    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    factory.defineObject( Object1.class.getSimpleName(), Object1.class.getName(), Scope.GLOBAL );

    assertTrue( "Object is not defined", factory.objectDefined( Object1.class.getSimpleName() ) ); //$NON-NLS-1$
    Object1 obj1 = factory.get( Object1.class, session1 );
    assertNotNull( "Object is null", obj1 ); //$NON-NLS-1$

    factory.init( null, null );
    assertFalse( "Object is defined", factory.objectDefined( Object1.class.getSimpleName() ) ); //$NON-NLS-1$

    assertNull( factory.getImplementingClass( Object1.class.getSimpleName() ) );

    try {
      factory.get( Object1.class, session1 );
      assertFalse( "exception expected", true ); //$NON-NLS-1$
    } catch ( ObjectFactoryException e ) {
      assertTrue( "exception expected", true ); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

  }

  public void testGlobalObject1() throws Exception {

    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    factory.defineObject( Object1.class.getSimpleName(), Object1.class.getName(), Scope.GLOBAL );

    factory.defineObject( BadObjectRuntime.class.getSimpleName(), BadObjectRuntime.class.getName(), Scope.GLOBAL );
    factory.defineObject( BadObject.class.getSimpleName(), BadObject.class.getName(), Scope.GLOBAL );

    IPentahoSession session1 = new StandaloneSession( "test user 1" ); //$NON-NLS-1$
    IPentahoSession session2 = new StandaloneSession( "test user 2" ); //$NON-NLS-1$

    Object1 obj1 = factory.get( Object1.class, session1 );
    assertNotNull( "Object is null", obj1 ); //$NON-NLS-1$

    Object1 obj2 = factory.get( Object1.class, session2 );
    assertNotNull( "Object is null", obj2 ); //$NON-NLS-1$

    assertTrue( "Objects are not same", obj1 == obj2 ); //$NON-NLS-1$

    try {
      factory.get( BadObjectRuntime.class, session1 );
      assertFalse( true );
    } catch ( RuntimeException e ) {
      assertTrue( true );
    }

    try {
      factory.get( BadObject.class, session1 );
      assertFalse( true );
    } catch ( ObjectFactoryException e ) {
      assertTrue( true );
    }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

  }

  public void testGlobalObject2() throws Exception {

    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    factory.defineObject( Object2.class.getSimpleName(), Object2.class.getName(), Scope.GLOBAL );

    IPentahoSession session1 = new StandaloneSession( "test user 1" ); //$NON-NLS-1$
    IPentahoSession session2 = new StandaloneSession( "test user 2" ); //$NON-NLS-1$

    Object2 obj1 = factory.get( Object2.class, session1 );
    assertNotNull( "Object is null", obj1 ); //$NON-NLS-1$

    Object2 obj2 = factory.get( Object2.class, session2 );
    assertNotNull( "Object is null", obj2 ); //$NON-NLS-1$

    assertTrue( "Objects are not same", obj1 == obj2 ); //$NON-NLS-1$

  }
View Full Code Here

Examples of org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory

  }

  public void testGlobalObject3() throws Exception {

    StandaloneObjectFactory factory = new StandaloneObjectFactory();

    factory.defineObject( Object2.class.getSimpleName(), Object2.class.getName(), Scope.GLOBAL, getClass()
        .getClassLoader() );

    IPentahoSession session1 = new StandaloneSession( "test user 1" ); //$NON-NLS-1$
    IPentahoSession session2 = new StandaloneSession( "test user 2" ); //$NON-NLS-1$

    Object2 obj1 = factory.get( Object2.class, session1 );
    assertNotNull( "Object is null", obj1 ); //$NON-NLS-1$

    Object2 obj2 = factory.get( Object2.class, session2 );
    assertNotNull( "Object is null", obj2 ); //$NON-NLS-1$

    assertTrue( "Objects are not same", obj1 == obj2 ); //$NON-NLS-1$

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.