/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { pc = new PersistenceCache(); }
@Test public void testFlushStackPush() { PersistenceCache pc = new PersistenceCache(); fs.push(new Node("A", new Object().getClass(), null, pc, "A", null)); fs.push(new Node("B", new Object().getClass(), null, pc, "B", null)); fs.push(new Node("C", new Object().getClass(), null, pc, "C", null)); fs.push(new Node("D", new Object().getClass(), null, pc, "D", null)); Assert.assertEquals(4, fs.size()); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { objectGraph = new ObjectGraph(); pc = new PersistenceCache(); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { pc = new PersistenceCache(); state = new ManagedState(); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { PersistenceCache pc = new PersistenceCache(); pcm = new PersistenceCacheManager(pc); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { pc = new PersistenceCache(); state = new DetachedState(); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { pc = new PersistenceCache(); state = new TransientState(); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { pc = new PersistenceCache(); state = new RemovedState(); }
/** * Instantiates a new entity manager impl. * * @param factory * the factory */ EntityManagerImpl(final EntityManagerFactory factory, final PersistenceUnitTransactionType transactionType, final PersistenceContextType persistenceContextType) { this.factory = factory; if (logger.isDebugEnabled()) { logger.debug("Creating EntityManager for persistence unit : " + getPersistenceUnit()); } this.persistenceContextType = persistenceContextType; this.persistenceCache = new PersistenceCache((Cache) factory.getCache()); this.persistenceCache.setPersistenceContextType(this.persistenceContextType); this.transactionType = transactionType; this.persistenceDelegator = new PersistenceDelegator( ((EntityManagerFactoryImpl) this.factory).getKunderaMetadataInstance(), this.persistenceCache); for (String pu : ((EntityManagerFactoryImpl) this.factory).getPersistenceUnits()) { this.persistenceDelegator.loadClient(pu, discoverClient(pu)); } if (logger.isDebugEnabled()) { logger.debug("Created EntityManager for persistence unit : " + getPersistenceUnit()); } }
/** * Test method for * {@link com.impetus.kundera.lifecycle.states.TransientState#handleMerge(com.impetus.kundera.lifecycle.NodeStateContext)} * . * * @throws NoSuchMethodException * @throws SecurityException * @throws InvocationTargetException * @throws IllegalAccessException * @throws InstantiationException * @throws IllegalArgumentException */ @Test public void testHandleMerge() throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Node storeNode = StoreBuilder.buildStoreNode(pc, state, CascadeType.MERGE); EntityManagerFactory emf = Persistence.createEntityManagerFactory("kunderatest"); Constructor constructor = PersistenceDelegator.class.getDeclaredConstructor(KunderaMetadata.class, PersistenceCache.class); constructor.setAccessible(true); PersistenceDelegator pd = (PersistenceDelegator) constructor.newInstance( ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), new PersistenceCache()); storeNode.setPersistenceDelegator(pd); Object data1 = storeNode.getData(); state.handleMerge(storeNode); Object data2 = storeNode.getData(); Assert.assertTrue(DeepEquals.deepEquals(data1, data2)); }
constructor.setAccessible(true); PersistenceDelegator pd = (PersistenceDelegator) constructor.newInstance( ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), new PersistenceCache());
constructor.setAccessible(true); PersistenceDelegator pd = (PersistenceDelegator) constructor.newInstance( ((EntityManagerFactoryImpl) emf).getKunderaMetadataInstance(), new PersistenceCache());
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { EntityManagerFactoryImpl emfImpl = getEntityManagerFactory(); new PersistenceUnitConfiguration(null, emfImpl.getKunderaMetadataInstance(), "kunderatest").configure(); PersistenceCache persistenceCache = new PersistenceCache(); graphBuilder = new ObjectGraphBuilder(persistenceCache, new PersistenceDelegator( emfImpl.getKunderaMetadataInstance(), persistenceCache)); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { emfImpl = getEntityManagerFactory(); new PersistenceUnitConfiguration(null, emfImpl.getKunderaMetadataInstance(), "kunderatest").configure(); pc = new PersistenceCache(); graphBuilder = new ObjectGraphBuilder(pc, new PersistenceDelegator(emfImpl.getKunderaMetadataInstance(), pc)); }
/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { pc = new PersistenceCache(); emfImpl = getEntityManagerFactory(); graphBuilder = new ObjectGraphBuilder(pc, new PersistenceDelegator(emfImpl.getKunderaMetadataInstance(), pc)); // configurator.configure(); new PersistenceUnitConfiguration(null, emfImpl.getKunderaMetadataInstance(), "kunderatest").configure(); // new MetamodelConfiguration("kunderatest").configure(); }