Examples of StandaloneSpringPentahoObjectFactory


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

  }

  public void testGetAll() throws Exception {

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

    List<MimeTypeListener> mimes = factory.getAll( MimeTypeListener.class, session );

    assertNotNull( mimes );

    assertEquals( 5, mimes.size() );
View Full Code Here

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

  }

  public void testReferences() throws Exception {

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

    IPentahoObjectReference reference = factory.getObjectReference( MimeTypeListener.class, session );

    assertEquals( "30", reference.getAttributes().get( "priority" ) );

    assertEquals( ( (MimeTypeListener) reference.getObject() ).name, "Higher Priority MimeTypeListener" );
  }
View Full Code Here

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

  }

  public void testGetByProperty() throws Exception {

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

    MimeTypeListener obj = factory.get( MimeTypeListener.class, session, Collections.singletonMap( "someKey", "1" ) );
    assertEquals( "Test Attr1", obj.name );

    obj = factory.get( MimeTypeListener.class, session, Collections.singletonMap( "someKey", "2" ) );
    assertEquals( "Test Attr2", obj.name );

    // Multiple Attributes
    HashMap<String, String> map = new HashMap<String, String>();
    map.put( "someKey", "3" );
    map.put( "foo", "bar" );
    obj = factory.get( MimeTypeListener.class, session, map );
    assertEquals( "Test Attr3", obj.name );

    // Not found, will default to
    map = new HashMap<String, String>();
    map.put( "someKey", "3" );
    map.put( "foo", "bang" );
    obj = factory.get( MimeTypeListener.class, session, map );
    assertEquals( null, obj.name );
  }
View Full Code Here

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

  public void testReferenceList() throws Exception {
    PentahoSystem.shutdown();

    StandaloneSession session = new StandaloneSession();
    PentahoSessionHolder.setSession( session );
    StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();
    factory.init( "test-res/solution/system/pentahoObjects.spring.xml", null );
    PentahoSystem.registerObjectFactory( factory );

    MimeListenerCollection collection = factory.get( MimeListenerCollection.class, session );
    assertNotNull( collection );

    assertEquals( 5, collection.getListeners().size() );
    // Highest priorty first?
    assertEquals( "Higher Priority MimeTypeListener", collection.getListeners().get( 0 ).name );
View Full Code Here

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

  public void testPriority() throws Exception {

    StandaloneSession session = new StandaloneSession();

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

    MimeTypeListener obj = factory.get( MimeTypeListener.class, session );

    assertEquals( "Higher Priority MimeTypeListener", obj.name );
  }
View Full Code Here

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

  }

  public void testSessionProperties() throws Exception {

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

    IContentInfo obj = factory.get( IContentInfo.class, session );
    assertEquals( "Test Session", obj.getTitle() );

    IContentInfo obj_again = factory.get( IContentInfo.class, session );
    assertSame( obj_again, obj );

    session = new StandaloneSession();
    IContentInfo obj_newer = factory.get( IContentInfo.class, session );
    assertNotSame( obj, obj_newer );
  }
View Full Code Here

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

  public void testInitFromObject() throws Exception {

    StandaloneSession session = new StandaloneSession();

    StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();

    File f = new File( "test-res/solution/system/pentahoObjects.spring.xml" );
    FileSystemResource fsr = new FileSystemResource( f );
    GenericApplicationContext appCtx = new GenericApplicationContext();
    XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader( appCtx );
    xmlReader.loadBeanDefinitions( fsr );

    factory.init( "test-res/solution/system/pentahoObjects.spring.xml", appCtx );

    GoodObject obj = factory.get( GoodObject.class, session );
    assertNotNull( obj );
  }
View Full Code Here

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

   */
  @Test
  public void testRegistration() throws Exception {

    StandaloneSession session = new StandaloneSession();
    StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();

    ConfigurableApplicationContext context =
      new FileSystemXmlApplicationContext( "test-res/solution/system/pentahoObjects.spring.xml" );

    factory.init( null, context );

    StandaloneSpringPentahoObjectFactory factory2 = new StandaloneSpringPentahoObjectFactory();
    factory2.init( null, context );

    AggregateObjectFactory aggFactory = new AggregateObjectFactory();
    aggFactory.registerObjectFactory( factory );
    aggFactory.registerObjectFactory( factory2 );

View Full Code Here

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

   */
  @Test
  public void testRegisteredButNotPublishingAnythingApplicationContext() throws Exception {

    StandaloneSession session = new StandaloneSession();
    StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();

    ConfigurableApplicationContext context =
      new FileSystemXmlApplicationContext( "test-res/solution/system/registeredButNotPublishing.spring.xml" );

    // this was causing an exception.
    factory.init( null, context );

    AggregateObjectFactory aggFactory = new AggregateObjectFactory();
    aggFactory.registerObjectFactory( factory );
    assertEquals( 0, PublishedBeanRegistry.getRegisteredFactories().size() );

View Full Code Here

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

      System.setProperty( "java.naming.factory.initial", "org.osjava.sj.SimpleContextFactory" ); //$NON-NLS-1$ //$NON-NLS-2$
      System.setProperty( "org.osjava.sj.root", getSolutionPath() + "/system/simple-jndi" ); //$NON-NLS-1$ //$NON-NLS-2$
      System.setProperty( "org.osjava.sj.delimiter", "/" ); //$NON-NLS-1$ //$NON-NLS-2$
    }
    String objectFactoryCreatorCfgFile = getSolutionPath() + SYSTEM_FOLDER + "/" + DEFAULT_SPRING_CONFIG_FILE_NAME; //$NON-NLS-1$
    IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
    pentahoObjectFactory.init( objectFactoryCreatorCfgFile, null );
    PentahoSystem.registerObjectFactory( pentahoObjectFactory );
    return PentahoSystem.init( applicationContext );
  }
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.