@Test public void testCreateSession$failure() throws Exception { new MockUp<ApplicationEngine>() { @Mock public ApplicationEngine engine() throws ApplicationEngineException { throw new ApplicationEngineException("FAILURE"); } }; CoreRuntimeDelegate sut=new CoreRuntimeDelegate(); try { sut.createSession(); fail("Should not be able to create session if the application engine fails"); } catch (ApplicationContextException e) { assertThat(e.getMessage(),equalTo("Could not create session")); } }
@Override public WriteSession createSession() throws ApplicationContextException { try { WriteSessionService sessionService = sessionService(); WriteSession delegate = sessionService. createSession( WriteSessionConfiguration. builder(). build()); Transaction transaction=transactionManager().currentTransaction(); transaction.begin(); return new TransactionalWriteSession(transaction,delegate); } catch (Exception e) { throw new ApplicationContextException("Could not create session",e); } }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public WriteSession createSession() throws ApplicationContextException { try { WriteSessionService sessionService = sessionService(); WriteSession delegate = sessionService. createSession( WriteSessionConfiguration. builder(). build()); Transaction transaction=transactionManager().currentTransaction(); transaction.begin(); return new TransactionalWriteSession(transaction,delegate); } catch (Exception e) { throw new ApplicationContextException("Could not create session",e); } } }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public WriteSession createSession() throws ApplicationContextException { try { WriteSessionService sessionService = sessionService(); WriteSession delegate = sessionService. createSession( WriteSessionConfiguration. builder(). build()); Transaction transaction=transactionManager().currentTransaction(); transaction.begin(); return new TransactionalWriteSession(transaction,delegate); } catch (Exception e) { throw new ApplicationContextException("Could not create session",e); } } CoreRuntimeDelegate(); }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public WriteSession createSession() throws ApplicationContextException { try { WriteSessionService sessionService = sessionService(); WriteSession delegate = sessionService. createSession( WriteSessionConfiguration. builder(). build()); Transaction transaction=transactionManager().currentTransaction(); transaction.begin(); return new TransactionalWriteSession(transaction,delegate); } catch (Exception e) { throw new ApplicationContextException("Could not create session",e); } } CoreRuntimeDelegate(); @Override boolean isOffline(); @Override WriteSession createSession(); @Override ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session); @Override void registerShutdownListener(ShutdownListener listener); }
CoreRuntimeDelegate extends RuntimeDelegate { @Override public WriteSession createSession() throws ApplicationContextException { try { WriteSessionService sessionService = sessionService(); WriteSession delegate = sessionService. createSession( WriteSessionConfiguration. builder(). build()); Transaction transaction=transactionManager().currentTransaction(); transaction.begin(); return new TransactionalWriteSession(transaction,delegate); } catch (Exception e) { throw new ApplicationContextException("Could not create session",e); } } CoreRuntimeDelegate(); @Override boolean isOffline(); @Override WriteSession createSession(); @Override ResourceSnapshotResolver createResourceResolver(URI canonicalBase, ReadSession session); @Override void registerShutdownListener(ShutdownListener listener);  }