Package org.pentaho.metadata.model

Examples of org.pentaho.metadata.model.Domain


    mock.storeDomain( getTestDomain( ID ), false );

    SessionCachingMetadataDomainRepository repo = new SessionCachingMetadataDomainRepository( mock );
    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", SESSION_ID ) ); //$NON-NLS-1$

    Domain domain = repo.getDomain( ID );
    // Description will equal the id when no description is provided (null session)
    assertEquals( ID, domain.getDescription( TEST_LOCALE ) );
  }
View Full Code Here


    SessionCachingMetadataDomainRepository repo = new SessionCachingMetadataDomainRepository( mock );
    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", SESSION_ID1 ) ); //$NON-NLS-1$

    assertEquals( 0, mock.getInvocationCount( "getDomain" ) ); //$NON-NLS-1$
    Domain d = repo.getDomain( ID );
    assertEquals( ID, d.getId() );
    assertEquals( SESSION_ID1, d.getDescription( TEST_LOCALE ) );
    assertEquals( 1, mock.getInvocationCount( "getDomain" ) ); //$NON-NLS-1$
    // Cache should contain a domain for this session
    assertEquals( 1, PentahoSystem.getCacheManager( null ).getAllKeysFromRegionCache( CACHE_NAME ).size() );

    // Get the same domain from a different session
    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", SESSION_ID2 ) ); //$NON-NLS-1$

    d = repo.getDomain( ID );
    // Make sure we got a new, session-specific, domain
    assertEquals( SESSION_ID2, d.getDescription( TEST_LOCALE ) );
    // Make sure cache was missed and delegate was called
    assertEquals( 2, mock.getInvocationCount( "getDomain" ) ); //$NON-NLS-1$
    // We should now have two objects in the cache (1 domain per session)
    assertEquals( 2, PentahoSystem.getCacheManager( null ).getAllKeysFromRegionCache( CACHE_NAME ).size() );
View Full Code Here

    mock.storeDomain( getTestDomain( ID2 ), false );

    SessionCachingMetadataDomainRepository repo = new SessionCachingMetadataDomainRepository( mock );
    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", "1" ) ); //$NON-NLS-1$ //$NON-NLS-2$

    Domain domainFromSession1 = repo.getDomain( ID1 );
    assertNotNull( domainFromSession1 );
    assertEquals( 1, mock.getInvocationCount( "getDomain" ) ); //$NON-NLS-1$

    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", "2" ) ); //$NON-NLS-1$ //$NON-NLS-2$

    Domain domainFromSession2 = repo.getDomain( ID1 );
    assertNotNull( domainFromSession2 );
    assertEquals( 2, mock.getInvocationCount( "getDomain" ) ); //$NON-NLS-1$

    assertEquals( 2, PentahoSystem.getCacheManager( null ).getAllKeysFromRegionCache( CACHE_NAME ).size() );
View Full Code Here

    MockSessionAwareMetadataDomainRepository mock = new MockSessionAwareMetadataDomainRepository();

    SessionCachingMetadataDomainRepository repo = new SessionCachingMetadataDomainRepository( mock );
    PentahoSessionHolder.setSession( new StandaloneSession( "Standalone Session", "1" ) ); //$NON-NLS-1$ //$NON-NLS-2$

    Domain domain = getTestDomain( ID1 );
    LogicalModel model = new LogicalModel();
    model.setId( "test" ); //$NON-NLS-1$
    domain.addLogicalModel( model );

    repo.storeDomain( domain, false );
    repo.storeDomain( getTestDomain( ID2 ), false );

    repo.getDomain( ID1 );
View Full Code Here

    try {
      byte[] is = IOUtils.toByteArray( inputStream );
      xmi = new String( is, "UTF-8" );

      // now, try to see if the xmi can be parsed (ie, check if it's valid xmi)
      Domain domain = xmiParser.parseXmi( new java.io.ByteArrayInputStream( is ) );

      boolean changed = false;
      if ( domain.getLogicalModels().size() > 1 ) {
        Iterator<LogicalModel> iterator = domain.getLogicalModels().iterator();
        while ( iterator.hasNext() ) {
          LogicalModel logicalModel = iterator.next();
          Object property = logicalModel.getProperty( DSW_SOURCE_PROPERTY ); //$NON-NLS-1$
          if ( property != null ) {
            // This metadata file came from a DataSourceWizard, it may have embedded mondrian schema
View Full Code Here

  }

  @Override
  public Domain getDomain( String id ) {
    incrementInvocationCount( "getDomain" ); //$NON-NLS-1$
    Domain d = domains.get( id );
    if ( d == null ) {
      return null;
    }
    d = (Domain) d.clone();
    final IPentahoSession session = PentahoSessionHolder.getSession();
    if ( session == null ) {
      return d;
    }
    d.setDescription( new LocalizedString( TEST_LOCALE, PentahoSessionHolder.getSession().getId() ) );
    return d;
  }
View Full Code Here

  @Override
  public void removeModel( String domainId, String modelId ) throws DomainIdNullException, DomainStorageException {
    incrementInvocationCount( "removeModel" ); //$NON-NLS-1$
    // don't actually do anything
    Domain domain = getDomain( domainId );
    removeDomain( domainId );
    try {
      storeDomain( domain, true );
    } catch ( DomainAlreadyExistsException ex ) {
      throw new IllegalStateException( ex );
View Full Code Here

      return ALT_SOLUTION_PATH;
    }
  }

  private Domain getTestDomain( String id ) {
    Domain d = new Domain();
    d.setId( id );
    return d;
  }
View Full Code Here

  @Override
  public Domain getDomain( final String id ) {
    final IPentahoSession session = PentahoSessionHolder.getSession();
    final CacheKey key = new CacheKey( session.getId(), id );
    Domain domain = (Domain) cacheManager.getFromRegionCache( CACHE_REGION, key );
    if ( domain != null ) {
      if ( logger.isDebugEnabled() ) {
        logger.debug( "Found domain in cache: " + key ); //$NON-NLS-1$
      }
      return domain;
View Full Code Here

        stringBuilder.append( xmi );
      }
      inputStream.close();
      xmi = stringBuilder.toString();
      // now, try to see if the xmi can be parsed (ie, check if it's valid xmi)
      Domain domain = xmiParser.parseXmi( new java.io.ByteArrayInputStream( xmi.getBytes( DEFAULT_ENCODING ) ) );
      // xmi is valid. Create a new inputstream for the actual import action.
      inputStream2 = new java.io.ByteArrayInputStream( xmi.getBytes( DEFAULT_ENCODING ) );
    } catch ( Exception ex ) {
      logger.error( ex.getMessage() );
      // throw new
View Full Code Here

TOP

Related Classes of org.pentaho.metadata.model.Domain

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.