Package org.pentaho.platform.api.engine

Examples of org.pentaho.platform.api.engine.IConfiguration


    mp = new MicroPlatform();
    mp.defineInstance( IAuthorizationPolicy.class, new TestAuthorizationPolicy() );
    mp.start();

    ISystemConfig systemConfig = new SystemConfig();
    IConfiguration securityConfig = mock( IConfiguration.class );
    Properties props = new Properties();
    props.setProperty( "provider", "jackrabbit" );
    when( securityConfig.getProperties() ).thenReturn( props );
    when( securityConfig.getId() ).thenReturn( "security" );
    systemConfig.registerConfiguration( securityConfig );

    systemResource = new SystemResource( systemConfig );

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


  @Produces( { MediaType.APPLICATION_JSON } )
  @Facet ( name = "Unsupported" )
  public Response getAuthenticationProvider() throws Exception {
    try {
      if ( canAdminister() ) {
        IConfiguration config = this.systemConfig.getConfiguration( "security" );
        String provider = config.getProperties().getProperty( "provider" );
        return Response.ok( new AuthenticationProvider( provider ) ).type( MediaType.APPLICATION_JSON ).build();
      } else {
        return Response.status( UNAUTHORIZED ).build();
      }
    } catch ( Throwable t ) {
View Full Code Here

  private String resolveValue( String placeholder ) {
    Matcher matcher = pattern.matcher( placeholder );
    matcher.find();
    String pid = matcher.group( 1 );
    String key = matcher.group( 2 );
    IConfiguration con = getConfiguration( pid );
    if ( con == null ) {
      logger.info( "Error resolving key replacement: " + placeholder );
      return null;
    }
    try {
      return con.getProperties().getProperty( key );
    } catch ( IOException e ) {
      logger.error( "Error getting properties for configuration: " + key );
      return null;
    }
  }
View Full Code Here

  SystemConfig systemConfig = new SystemConfig();

  @Test
  public void testSetConfiguration() throws Exception {

    IConfiguration c =
        new PropertiesFileConfiguration( "test", new File( "test-res/SystemConfig/system/test.properties" ) );
    systemConfig.registerConfiguration( c );
    assertNotNull( systemConfig.getConfiguration( "test" ) );
  }
View Full Code Here

  }

  @Test
  public void testGetConfiguration() throws Exception {

    IConfiguration c =
        new PropertiesFileConfiguration( "test", new File( "test-res/SystemConfig/system/test.properties" ) );
    systemConfig.registerConfiguration( c );

    assertNotNull( systemConfig.getConfiguration( "test" ) );
    assertEquals( "A dog's tale", systemConfig.getProperty( "test.someProperty" ) );
View Full Code Here

  }

  @Test
  public void testListConfigurations() throws Exception {

    IConfiguration c =
        new PropertiesFileConfiguration( "test", new File( "test-res/SystemConfig/system/test.properties" ) );
    systemConfig.registerConfiguration( c );
    assertEquals( 1, systemConfig.listConfigurations().length );

    c = new PropertiesFileConfiguration( "test", new File( "test-res/SystemConfig/system/test.properties" ) );
View Full Code Here

  @Test
  public void testWrite() throws Exception {
    PentahoSystem.clearObjectFactory();

    IConfiguration c =
        new PropertiesFileConfiguration( "test", new File( "test-res/SystemConfig/system/test.properties" ) );
    systemConfig.registerConfiguration( c );
    IConfiguration configuration = systemConfig.getConfiguration( "test" );
    Properties props = configuration.getProperties();
    props.setProperty( "someProperty", "new value" );
    configuration.update( props );

    FileSystemXmlApplicationContext context =
        new FileSystemXmlApplicationContext( "test-res/SystemConfig/system/testPropertyPlaceholders.spring.xml" );
    context.refresh();

    assertNotNull( context.getBean( "testPlaceHolder" ) );
    assertEquals( "new value", context.getBean( "testPlaceHolder" ) );
    props = configuration.getProperties();
    props.setProperty( "someProperty", "A dog's tale" );
    configuration.update( props );

  }
View Full Code Here

public class SqlMetadataQueryExecTest {
  @Test
  public void testDriverClassesToForceMetaNoEntries() throws IOException {
    ISystemConfig sysConfig = mock( ISystemConfig.class );
    IConfiguration config = mock( IConfiguration.class );
    when( sysConfig.getConfiguration( SqlMetadataQueryExec.CONFIG_ID ) ).thenReturn( config );
    Properties props = mock( Properties.class );
    when( config.getProperties() ).thenReturn( props );
    final ArgumentCaptor<String> defaultValue = ArgumentCaptor.forClass( String.class );
    when( props.getProperty( eq( SqlMetadataQueryExec.FORCE_DB_META_CLASSES_PROP ), defaultValue.capture() ) )
        .thenAnswer( new Answer<String>() {

          @Override
View Full Code Here

  }

  @Test
  public void testDriverClassesToForceMetaOneEntry() throws IOException {
    ISystemConfig sysConfig = mock( ISystemConfig.class );
    IConfiguration config = mock( IConfiguration.class );
    String className = "test";
    when( sysConfig.getConfiguration( SqlMetadataQueryExec.CONFIG_ID ) ).thenReturn( config );
    Properties props = mock( Properties.class );
    when( config.getProperties() ).thenReturn( props );
    when( props.getProperty( eq( SqlMetadataQueryExec.FORCE_DB_META_CLASSES_PROP ), anyString() ) ).thenReturn(
        " " + className + " " );
    SqlMetadataQueryExec sqlMetadataQueryExec = new SqlMetadataQueryExec( sysConfig );
    assertEquals( 1, sqlMetadataQueryExec.driverClassesToForceMeta.size() );
    assertTrue( sqlMetadataQueryExec.driverClassesToForceMeta.contains( className ) );
View Full Code Here

  }

  @Test
  public void testDriverClassesToForceMetaTwoEntries() throws IOException {
    ISystemConfig sysConfig = mock( ISystemConfig.class );
    IConfiguration config = mock( IConfiguration.class );
    String className = "test";
    String className2 = "test2";
    when( sysConfig.getConfiguration( SqlMetadataQueryExec.CONFIG_ID ) ).thenReturn( config );
    Properties props = mock( Properties.class );
    when( config.getProperties() ).thenReturn( props );
    when( props.getProperty( eq( SqlMetadataQueryExec.FORCE_DB_META_CLASSES_PROP ), anyString() ) ).thenReturn(
        " , " + className + " , " + className2 + " ,,, " );
    SqlMetadataQueryExec sqlMetadataQueryExec = new SqlMetadataQueryExec( sysConfig );
    assertEquals( 2, sqlMetadataQueryExec.driverClassesToForceMeta.size() );
    assertTrue( sqlMetadataQueryExec.driverClassesToForceMeta.contains( className ) );
View Full Code Here

TOP

Related Classes of org.pentaho.platform.api.engine.IConfiguration

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.