Message m6 = createMessage(4); Message m7 = createMessage(4); Message m8 = createMessage(4);
Message m6 = createMessage((byte)4); Message m7 = createMessage((byte)4); Message m8 = createMessage((byte)4);
   protected void nonXARecovery(boolean guid, boolean storeXid) throws Exception   {      JDBCTransactionLog tl = new JDBCTransactionLog(sc.getDataSource(), sc.getTransactionManager());      tl.setTxIdGuid(guid);            Properties props;      if (guid)      {         props = getConfigTablesForGUID();         tl.setSqlProperties(props);      }      else      {         props = new Properties();      }            tl.start();      JDBCMessageStore ms = new JDBCMessageStore("s6", sc.getDataSource(), sc.getTransactionManager());      ms.start();      Channel channel = new SimpleChannel("channel0", ms);            List refs = tl.messageRefs(ms.getStoreID(), channel.getChannelID());      assertNotNull(refs);      assertEquals(0, refs.size());            //First insert some references outside a transaction      Message m1 = createMessage(4);      Message m2 = createMessage(4);      Message m3 = createMessage(4);      Message m4 = createMessage(4);      Message m5 = createMessage(4);      MessageReference ref1 = ms.reference(m1);      MessageReference ref2 = ms.reference(m2);      MessageReference ref3 = ms.reference(m3);      MessageReference ref4 = ms.reference(m4);      MessageReference ref5 = ms.reference(m5);      tl.addReference(channel.getChannelID(), ref1, null);      tl.addReference(channel.getChannelID(), ref2, null);      tl.addReference(channel.getChannelID(), ref3, null);      tl.addReference(channel.getChannelID(), ref4, null);      tl.addReference(channel.getChannelID(), ref5, null);            refs = tl.messageRefs(ms.getStoreID(), channel.getChannelID());      assertNotNull(refs);      assertEquals(5, refs.size());      assertTrue(refs.contains(ref1.getMessageID()));      assertTrue(refs.contains(ref2.getMessageID()));      assertTrue(refs.contains(ref3.getMessageID()));      assertTrue(refs.contains(ref4.getMessageID()));      assertTrue(refs.contains(ref5.getMessageID()));                  //Now, in a non-xa transaction, add some more refs      Message m6 = createMessage(4);      Message m7 = createMessage(4);      Message m8 = createMessage(4);      MessageReference ref6 = ms.reference(m6);      MessageReference ref7 = ms.reference(m7);      MessageReference ref8 = ms.reference(m8);            TransactionRepository txRep = new TransactionRepository();      txRep.start(tl);      Transaction tx = txRep.createTransaction();      tl.addReference(channel.getChannelID(), ref6, tx);      tl.addReference(channel.getChannelID(), ref7, tx);      tl.addReference(channel.getChannelID(), ref8, tx);                  //And remove refs 4 and 5 of the pre-existing ones      tl.removeReference(channel.getChannelID(), ref4, tx);      tl.removeReference(channel.getChannelID(), ref5, tx);            refs = tl.messageRefs(ms.getStoreID(), channel.getChannelID());      assertNotNull(refs);      assertEquals(5, refs.size());      assertTrue(refs.contains(ref1.getMessageID()));      assertTrue(refs.contains(ref2.getMessageID()));      assertTrue(refs.contains(ref3.getMessageID()));      assertTrue(refs.contains(ref4.getMessageID()));      assertTrue(refs.contains(ref5.getMessageID()));            //Now stop the persistence manager and start it with recovery = true      tl.stop();            props.put("PERFORM_NONXA_RECOVERY", "true");            tl.setSqlProperties(props);            log.info("**** restarting tl");      tl.start();            //The above transaction should now be rolled back.            refs = tl.messageRefs(ms.getStoreID(), channel.getChannelID());      assertNotNull(refs);      assertEquals(5, refs.size());      assertTrue(refs.contains(ref1.getMessageID()));      assertTrue(refs.contains(ref2.getMessageID()));      assertTrue(refs.contains(ref3.getMessageID()));      assertTrue(refs.contains(ref4.getMessageID()));      assertTrue(refs.contains(ref5.getMessageID()));            //Commit should do nothing      tl.commitTx(tx);            refs = tl.messageRefs(ms.getStoreID(), channel.getChannelID());      assertNotNull(refs);      assertEquals(5, refs.size());      assertTrue(refs.contains(ref1.getMessageID()));      assertTrue(refs.contains(ref2.getMessageID()));      assertTrue(refs.contains(ref3.getMessageID()));      assertTrue(refs.contains(ref4.getMessageID()));      assertTrue(refs.contains(ref5.getMessageID()));            tl.removeAllMessageData(channel.getChannelID());               }