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

Examples of org.pentaho.platform.engine.core.system.StandaloneSession


  public int execute() {
    PentahoSystem.systemEntryPoint();
    try {
      // create a generic session object
      StandaloneSession session = new StandaloneSession( userId );

      solutionEngine = PentahoSystem.get( SolutionEngine.class, session );
      solutionEngine.init( session );

      SimpleParameterProvider parameterProvider = new SimpleParameterProvider( parameters );
View Full Code Here


      tenantManager.deleteTenant( tenant );
    }
  }

  protected void loginAsRepositoryAdmin() {
    StandaloneSession pentahoSession = new StandaloneSession( repositoryAdminUsername );
    pentahoSession.setAuthenticated( repositoryAdminUsername );
    final GrantedAuthority[] repositoryAdminAuthorities =
        new GrantedAuthority[]{new GrantedAuthorityImpl( sysAdminRoleName )};
    final String password = "ignored";
    UserDetails repositoryAdminUserDetails =
        new User( repositoryAdminUsername, password, true, true, true, true, repositoryAdminAuthorities );
View Full Code Here

    PentahoSessionHolder.removeSession();
    SecurityContextHolder.getContext().setAuthentication( null );
  }

  protected void login( final String username, final ITenant tenant, String[] roles ) {
    StandaloneSession pentahoSession = new StandaloneSession( username );
    pentahoSession.setAuthenticated( tenant.getId(), username );
    PentahoSessionHolder.setSession( pentahoSession );
    pentahoSession.setAttribute( IPentahoSession.TENANT_ID_KEY, tenant.getId() );
    final String password = "password";

    List<GrantedAuthority> authList = new ArrayList<GrantedAuthority>();

    for ( String roleName : roles ) {
View Full Code Here

  public void testSimpleRuntime() {
    // The simple runtime is used by the standalone distribution.
    // This provides some simple tests to exercise the code...
    startTest();
    StandaloneSession session =
        new StandaloneSession( Messages.getInstance().getString( "BaseTest.DEBUG_JUNIT_SESSION" ) ); //$NON-NLS-1$
    IRuntimeRepository srr = new SimpleRuntimeRepository();
    srr.setSession( session );
    IRuntimeElement ele1 = srr.loadElementById( "instanceid", null ); //$NON-NLS-1$
    IRuntimeElement ele2 = srr.newRuntimeElement( "parent", "parentType", true ); //$NON-NLS-1$ //$NON-NLS-2$
    IRuntimeElement ele3 = srr.newRuntimeElement( "parentid", "parentType", "solutionId", true ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
View Full Code Here

    String value = provider.getStringParameter( "settings.xml{settings/setting1}", null );

    Assert.assertEquals( "Could not get setting from pentaho.xml", "value1", value );

    StandaloneSession session = new StandaloneSession( "user1" );
    provider.setSession( session );
    value = (String) provider.getParameter( "settings.xml{settings/{$user}/setting2}" );
    Assert.assertEquals( "Wrong setting value", "value2", value );

    Assert.assertFalse( provider.getParameterNames().hasNext() );
View Full Code Here

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$
View Full Code Here

  }

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

  }

  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$
View Full Code Here

    }
  }

  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$
View Full Code Here

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

TOP

Related Classes of org.pentaho.platform.engine.core.system.StandaloneSession

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.