@Test public void testCreateSession$happyPath() throws Exception { new Expectations() {{ engine.unwrap(DefaultApplicationEngine.class);result=engine; engine.writeSessionService();result=sessionService; sessionService.createSession((WriteSessionConfiguration)any);result=session; engine.transactionManager();result=transactionManager; transactionManager.currentTransaction();result=transaction; }}; new MockUp<ApplicationEngine>() { @Mock public ApplicationEngine engine() throws ApplicationEngineException { return engine; } }; CoreRuntimeDelegate sut=new CoreRuntimeDelegate(); assertThat(sut.createSession(),notNullValue()); }
@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);  }