SessionCachingMetadataDomainRepository implements IMetadataDomainRepository,
    org.pentaho.platform.plugin.services.metadata.IPentahoMetadataDomainRepositoryExporter, ILogoutListener,
    IAclAwarePentahoMetadataDomainRepositoryImporter,
    IModelAnnotationsAwareMetadataDomainRepositoryImporter { @Override public String loadAnnotationsXml( String domainId ) { if ( delegate instanceof IModelAnnotationsAwareMetadataDomainRepositoryImporter ) { return ( (IModelAnnotationsAwareMetadataDomainRepositoryImporter) delegate ).loadAnnotationsXml( domainId ); } return null; } SessionCachingMetadataDomainRepository( final IMetadataDomainRepository delegate ); @Override Domain getDomain( final String id ); @Override void reloadDomains(); @Override void flushDomains(); @Override void removeDomain( final String domainId ); @Override void storeDomain( final Domain domain, final boolean overwrite ); @Override void removeModel( final String domainId, final String modelId ); @Override Set<String> getDomainIds(); @Override String generateRowLevelSecurityConstraint( final LogicalModel model ); @Override boolean hasAccess( final int accessType, final IConcept aclHolder ); @Override void onLogout( final IPentahoSession session ); Map<String, InputStream> getDomainFilesData( final String domainId ); @Override void storeDomain( InputStream inputStream, String domainId, boolean overwrite, RepositoryFileAcl acl ); @Override void setAclFor( String domainId, RepositoryFileAcl acl ); @Override RepositoryFileAcl getAclFor( String domainId ); @Override boolean hasAccessFor( String domainId ); @Override void storeDomain( InputStream inputStream, String domainId, boolean overwrite ); @Override void addLocalizationFile( String domainId, String locale, InputStream inputStream, boolean overwrite ); @Override String loadAnnotationsXml( String domainId ); @Override void storeAnnotationsXml( String domainId, String annotationsXml ); static String CACHE_REGION; }
@Test public void testLoadAnnotationsXml() throws Exception { MockSessionAwareMetadataDomainRepository mock = spy( new MockSessionAwareMetadataDomainRepository() ); SessionCachingMetadataDomainRepository repo = spy( new SessionCachingMetadataDomainRepository( mock ) ); PentahoMetadataDomainRepository delegate = mock( PentahoMetadataDomainRepository.class ); String domainId = "myDomain"; repo.loadAnnotationsXml( domainId ); verify( delegate, times( 0 ) ).loadAnnotationsXml( domainId ); repo = spy( new SessionCachingMetadataDomainRepository( delegate ) ); repo.loadAnnotationsXml( domainId ); verify( delegate, times( 1 ) ).loadAnnotationsXml( domainId ); }