info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_TESTINGREADONLY" ) ); //$NON-NLS-1$
HibernateUtil.beginTransaction();
try {
IRuntimeRepository repo = new RuntimeRepository();
repo.setSession( getPentahoSession() );
RuntimeElement baseElement = (RuntimeElement) repo.loadElementById( elementId, null );
info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_SETTINGELEMENTTOREADONLY" ) ); //$NON-NLS-1$
baseElement.setReadOnly( true );
} finally {
HibernateUtil.commitTransaction();
}
// Now, the element is read-only.
// Flush the session and re-load the element to
// test the "loaded" methods.
HibernateUtil.flushSession();
HibernateUtil.clear();
// Now, reload the element.
HibernateUtil.beginTransaction();
try {
info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_LOADINGREADONLY" ) ); //$NON-NLS-1$
IRuntimeRepository repo = new RuntimeRepository();
repo.setSession( getPentahoSession() );
RuntimeElement baseElement = (RuntimeElement) repo.loadElementById( elementId, null );
boolean caughtException = false;
try {
info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_TRYINGSETSTRINGPROPERTY" ) ); //$NON-NLS-1$
baseElement
.setStringProperty(
Messages.getInstance().getString( "RUNTIMEREPOTEST.MODIFY_NEW_STRING_KEY" ), Messages.getInstance().getString( "RUNTIMEREPOTEST.MODIFY_STRING_VALUE" ) ); //$NON-NLS-1$ //$NON-NLS-2$
} catch ( IllegalStateException ex ) {
caughtException = true;
info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_EXCEPTIONTRIPPED" ) ); //$NON-NLS-1$
}
assertTrue(
Messages.getInstance().getErrorString( "RUNTIMEREPOTEST.ERROR_0001_EXCEPTIONNOTTRIPPED" ), caughtException ); //$NON-NLS-1$
caughtException = false;
try {
info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_TRYINGSETPARENTTYPE" ) ); //$NON-NLS-1$
baseElement.setParentType( Messages.getInstance().getString( "RUNTIMEREPOTEST.CREATE_PARENT_TYPE" ) ); //$NON-NLS-1$
} catch ( IllegalStateException ex ) {
caughtException = true;
info( Messages.getInstance().getString( "RUNTIMEREPOTEST.USER_EXCEPTIONTRIPPED" ) ); //$NON-NLS-1$
}
assertTrue(