/** * Create a <code>transaction-writer</code> using the declarable interface * and set the transaction manager with the newly instantiated writer. */ private void endTransactionWriter() { Declarable d = createDeclarable(); if (!(d instanceof TransactionWriter)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_TRANSACTION_WRITER.toLocalizedString(d.getClass().getName())); } CacheTransactionManagerCreation txMgrCreation = (CacheTransactionManagerCreation) stack .peek(); txMgrCreation.setWriter((TransactionWriter) d); }
/** * Create a <code>transaction-writer</code> using the declarable interface * and set the transaction manager with the newly instantiated writer. */ private void endTransactionWriter() { Declarable d = createDeclarable(); if (!(d instanceof TransactionWriter)) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_IS_NOT_AN_INSTANCE_OF_A_TRANSACTION_WRITER.toLocalizedString(d.getClass().getName())); } CacheTransactionManagerCreation txMgrCreation = (CacheTransactionManagerCreation) stack .peek(); txMgrCreation.setWriter((TransactionWriter) d); }
public void testNoTXWriterOnClient() { //test writer is not created ClientCacheCreation cc = new ClientCacheCreation(); CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation(); txMgrCreation.setWriter(new TestTransactionWriter()); cc.addCacheTransactionManagerCreation(txMgrCreation); try { testXml(cc); fail("expected exception not thrown"); } catch (IllegalStateException e) { } }
/** * Tests that a region created with a named attributes set programmatically * for delta propogation has the correct attributes. * */ public void testTransactionWriter() throws CacheException { CacheCreation creation = new CacheCreation(); CacheTransactionManagerCreation ctmc = new CacheTransactionManagerCreation(); ctmc.setWriter(new TestTransactionWriter()); creation.addCacheTransactionManagerCreation(ctmc); testXml(creation); Cache c = getCache(); assertTrue(c instanceof GemFireCacheImpl); c.loadCacheXml(generate(creation)); TransactionWriter tw = c.getCacheTransactionManager().getWriter(); assertTrue("tw should be TransactionWriter, but it is:"+tw,tw instanceof TestTransactionWriter); }