Package org.pentaho.platform.engine.core.system.objfac

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


        BeanDefinitionBuilder.rootBeanDefinition( def.getClassname() ).setScope( BeanDefinition.SCOPE_PROTOTYPE )
          .getBeanDefinition();
      beanFactory.registerBeanDefinition( def.getBeanId(), beanDef );
    }

    StandaloneSpringPentahoObjectFactory pentahoFactory =
      new StandaloneSpringPentahoObjectFactory( "Plugin Factory ( " + plugin.getId() + " )" );
    pentahoFactory.init( null, beanFactory );

  }
View Full Code Here


    systemResource = new SystemResource( systemConfig );

    StandaloneApplicationContext applicationContext = new StandaloneApplicationContext( getSolutionPath(), "" ); //$NON-NLS-1$

    ApplicationContext springApplicationContext = getSpringApplicationContext();
    IPentahoObjectFactory pentahoObjectFactory = new StandaloneSpringPentahoObjectFactory();
    pentahoObjectFactory.init( null, springApplicationContext );
    PentahoSystem.registerObjectFactory( pentahoObjectFactory );

    // force Spring to populate PentahoSystem
    boolean initOk = PentahoSystem.init( applicationContext );
View Full Code Here

  @Test
  public void testByKey() throws Exception {

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

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

    GoodObject info = aggFactory.get( GoodObject.class, "GoodObject", session );
View Full Code Here

  @Test
  public void testCombined() 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( "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 );
View Full Code Here

  @Test
  public void testRePublish() throws Exception {

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

    PentahoSystem.registerObjectFactory( factory );

    MimeTypeListener republished =
      PentahoSystem.get( MimeTypeListener.class, session, Collections.singletonMap( "republished", "true" ) );
View Full Code Here

  @Test
  public void testRePublishAttributes() throws Exception {

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

    PentahoSystem.registerObjectFactory( factory );

    MimeTypeListener republished =
      PentahoSystem.get( MimeTypeListener.class, session, Collections.singletonMap( "someKey", "someValue" ) );
View Full Code Here

  @Test
  public void testGetById() throws Exception {

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

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

    MimeTypeListener info =
View Full Code Here

  public void testInitFromXml() throws Exception {

    StandaloneSession session = new StandaloneSession();
    StandaloneSession session2 = new StandaloneSession();

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

    GoodObject goodObject = factory.get( GoodObject.class, session );
    assertNotNull( goodObject );

    try {
      factory.get( BadObject.class, null );
      assertFalse( true );
    } catch ( ObjectFactoryException e ) {
      // ignored
    }

    GoodObject goodObject1 = factory.get( GoodObject.class, session );
    GoodObject goodObject2 = factory.get( GoodObject.class, session );

    assertEquals( goodObject1, goodObject2 );
    assertEquals( session, goodObject1.initSession );

    GoodObject goodObject3 = factory.get( GoodObject.class, session2 );
    assertNotSame( goodObject1, goodObject3 );
    assertEquals( session2, goodObject3.initSession );

  }
View Full Code Here

  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 );
    }
View Full Code Here

  public void testBadInit() throws Exception {

    StandaloneSession session = new StandaloneSession();

    StandaloneSpringPentahoObjectFactory factory = new StandaloneSpringPentahoObjectFactory();

    try {
      factory.init( null, "bogus" );
      assertFalse( true );
    } catch ( IllegalArgumentException e ) {
      assertTrue( true );
    }

    try {
      GoodObject obj = factory.get( GoodObject.class, session );
      assertNotNull( obj );
      assertFalse( true );
    } catch ( ObjectFactoryException e ) {
      assertTrue( true );
    }
View Full Code Here

TOP

Related Classes of org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory

Copyright © 2018 www.massapicom. 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.