Index: jpa/eclipselink.jpa.test/build.xml
===================================================================
--- jpa/eclipselink.jpa.test/build.xml (revision 3389)
+++ jpa/eclipselink.jpa.test/build.xml (working copy)
@@ -988,6 +988,7 @@
target="${javac.version}"
deprecation="${javac.deprecation}"
failonerror="true"
+ excludes="org/eclipse/persistence/testing/models/jpa/sessionbean/JPASessionCustomizer_*.java"
includes="${MODEL_DIR}/**/*.java">
@@ -1405,5 +1406,11 @@
-
+
+
+
+
+
+
+
Index: jpa/eclipselink.jpa.test/cachecoordination.xml
===================================================================
--- jpa/eclipselink.jpa.test/cachecoordination.xml (revision 0)
+++ jpa/eclipselink.jpa.test/cachecoordination.xml (revision 0)
@@ -0,0 +1,224 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Running "** ${cachecoordination.protocol} **" Cache Coordination tests: ${EAR_NAME} on ${server.name}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: jpa/eclipselink.jpa.test/cachecoordination_weblogic.xml
===================================================================
--- jpa/eclipselink.jpa.test/cachecoordination_weblogic.xml (revision 0)
+++ jpa/eclipselink.jpa.test/cachecoordination_weblogic.xml (revision 0)
@@ -0,0 +1,212 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: jpa/eclipselink.jpa.test/resource/server/persistence_cachecoordination.xml
===================================================================
--- jpa/eclipselink.jpa.test/resource/server/persistence_cachecoordination.xml (revision 0)
+++ jpa/eclipselink.jpa.test/resource/server/persistence_cachecoordination.xml (revision 0)
@@ -0,0 +1,22 @@
+
+
+
+ org.eclipse.persistence.jpa.PersistenceProvider
+ %%data-source-name%%
+ org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee
+ org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Address
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/fieldaccess/advanced/Employee.java
===================================================================
--- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/fieldaccess/advanced/Employee.java (revision 3389)
+++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/fieldaccess/advanced/Employee.java (working copy)
@@ -29,8 +29,8 @@
import org.eclipse.persistence.annotations.TypeConverter;
import org.eclipse.persistence.annotations.OptimisticLocking;
-import static org.eclipse.persistence.annotations.CacheCoordinationType.INVALIDATE_CHANGED_OBJECTS;
-import static org.eclipse.persistence.annotations.CacheType.SOFT_WEAK;
+import static org.eclipse.persistence.annotations.CacheCoordinationType.SEND_NEW_OBJECTS_WITH_CHANGES;//INVALIDATE_CHANGED_OBJECTS;
+import static org.eclipse.persistence.annotations.CacheType.FULL;//SOFT_WEAK;
import static javax.persistence.CascadeType.*;
import static javax.persistence.FetchType.*;
import static javax.persistence.GenerationType.*;
@@ -107,12 +107,12 @@
objectType=Long.class
)
@Cache(
- type=SOFT_WEAK,
+ type=FULL,
shared=true,
expiry=100000,
alwaysRefresh=false, // some test dependencies for this to be false.
disableHits=true, // Employee customizer should set it back to false.
- coordinationType=INVALIDATE_CHANGED_OBJECTS
+ coordinationType=SEND_NEW_OBJECTS_WITH_CHANGES
)
@Customizer(org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.EmployeeCustomizer.class)
public class Employee implements Serializable, Cloneable {
Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/EmployeeService.java
===================================================================
--- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/EmployeeService.java (revision 3389)
+++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/EmployeeService.java (working copy)
@@ -24,9 +24,11 @@
Employee findById(int id);
+ List findByFirstName(String fname);
Employee fetchById(int id);
void update(Employee employee);
int insert(Employee employee);
+ void delete(Employee employee);
}
Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/EmployeeServiceBean.java
===================================================================
--- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/EmployeeServiceBean.java (revision 3389)
+++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/EmployeeServiceBean.java (working copy)
@@ -43,6 +43,12 @@
return employee;
}
+ public List findByFirstName(String fname) {
+ //NamedQuery("findAllFieldAccessEmployeesByFirstName")
+ Query query = entityManager.createQuery("SELECT e FROM Employee e where e.firstName = :fname").setParameter("fname", fname);
+ query.setHint("eclipselink.cache-usage", "CheckCacheOnly");
+ return query.getResultList();
+ }
public Employee fetchById(int id) {
Employee employee = entityManager.find(Employee.class, new Integer(id));
employee.getAddress();
@@ -63,4 +69,8 @@
return employee.getId();
}
+ public void delete(Employee employee) {
+ Employee emp = entityManager.find(Employee.class, employee.getId());
+ entityManager.remove(emp);
+ }
}
Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/JPASessionCustomizer_jms.java
===================================================================
--- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/JPASessionCustomizer_jms.java (revision 0)
+++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/JPASessionCustomizer_jms.java (revision 0)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 1998, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+* pvijayaratnam - cache coordination test implementation
+ ******************************************************************************/
+package org.eclipse.persistence.testing.models.jpa.sessionbean;
+
+import org.eclipse.persistence.config.SessionCustomizer;
+import org.eclipse.persistence.sessions.Session;
+import org.eclipse.persistence.sessions.DatabaseSession;
+import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
+
+import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
+import org.eclipse.persistence.sessions.coordination.TransportManager;
+import org.eclipse.persistence.sessions.coordination.jms.JMSTopicTransportManager;
+
+import java.io.*;
+import java.util.*;
+
+public class JPASessionCustomizer implements SessionCustomizer {
+
+
+ public void customize(Session session) {
+
+ RemoteCommandManager rcm = new RemoteCommandManager((DatabaseSessionImpl)session);
+ JMSTopicTransportManager tm = new JMSTopicTransportManager(rcm);
+
+ //loading properities using FileInputStream
+ Properties properties = new Properties();
+ try{
+ FileInputStream fis = new FileInputStream("weblogic.properties");
+ properties.load(fis);
+ }
+ catch(Exception notFoundException){
+ throw new Error("Properties not found.", notFoundException);
+ }
+
+ tm.setTopicHostUrl(properties.getProperty("rcm.wls.jms.topichost.url"));
+ tm.setTopicName(properties.getProperty("rcm.wls.jms.topicname"));
+ tm.setTopicConnectionFactoryName(properties.getProperty("rcm.wls.jms.topic.connectionfactory.name"));
+ tm.setUserName(properties.getProperty("server.user"));
+ tm.setPassword(properties.getProperty("server.pwd"));
+
+ //loading properities using getResource
+ /*
+ this.getClass().getResource("weblogic.properties");
+ tm.setTopicHostUrl(System.getProperty("rcm.wls.jms.topichost.url"));
+ tm.setTopicName(System.getProperty("rcm.wls.jms.topicname"));
+ tm.setTopicConnectionFactoryName(System.getProperty("rcm.wls.jms.topic.connectionfactory.name"));
+ tm.setUserName(System.getProperty("server.user"));
+ tm.setPassword(System.getProperty("server.pwd"));
+ */
+ rcm.setTransportManager(tm);
+ rcm.setShouldPropagateAsynchronously(false);
+ rcm.getTransportManager().setNamingServiceType(TransportManager.JNDI_NAMING_SERVICE);
+
+ rcm.getTransportManager().setInitialContextFactoryName("weblogic.jndi.WLInitialContextFactory");
+ rcm.getTransportManager().setShouldRemoveConnectionOnError(true);
+ rcm.setServerPlatform(((org.eclipse.persistence.sessions.DatabaseSession)session).getServerPlatform());
+ ((DatabaseSessionImpl)session).setCommandManager(rcm);
+ ((DatabaseSessionImpl)session).setShouldPropagateChanges(true);
+ rcm.initialize();
+
+ // Sleep to allow RCM to startup and find each session.
+ try {
+ Thread.sleep(2000);
+ } catch (Exception ignore) {
+ }
+
+ }
+
+
+}
\ No newline at end of file
Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/JPASessionCustomizer_rmi.java
===================================================================
--- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/JPASessionCustomizer_rmi.java (revision 0)
+++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/models/jpa/sessionbean/JPASessionCustomizer_rmi.java (revision 0)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 1998, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+* pvijayaratnam - cache coordination test implementation
+ ******************************************************************************/
+package org.eclipse.persistence.testing.models.jpa.sessionbean;
+
+import org.eclipse.persistence.config.SessionCustomizer;
+import org.eclipse.persistence.sessions.Session;
+import org.eclipse.persistence.sessions.DatabaseSession;
+import org.eclipse.persistence.internal.sessions.DatabaseSessionImpl;
+
+import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
+import org.eclipse.persistence.sessions.coordination.TransportManager;
+
+import java.io.*;
+import java.util.*;
+
+public class JPASessionCustomizer implements SessionCustomizer {
+
+ public void customize(Session session) {
+
+ RemoteCommandManager rcm = new RemoteCommandManager((DatabaseSessionImpl)session);
+
+ ((DatabaseSessionImpl)session).setShouldPropagateChanges(true);
+ ((DatabaseSessionImpl)session).setCommandManager(rcm);
+ rcm.setShouldPropagateAsynchronously(false);
+
+ //loading properities using FileInputStream
+ Properties properties = new Properties();
+ try{
+ FileInputStream fis = new FileInputStream("weblogic.properties");
+ properties.load(fis);
+ }
+ catch(Exception notFoundException){
+ throw new Error("Properties not found.", notFoundException);
+ }
+
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setAnnouncementDelay(Integer.parseInt(properties.getProperty("announcement.delay").trim()));
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setMulticastGroupAddress(properties.getProperty("rcm.multicastgroup"));
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setMulticastPort(Integer.parseInt(properties.getProperty("rcm.multicastport").trim()));
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setPacketTimeToLive(Integer.parseInt(properties.getProperty("rcm.packet.timetolive").trim()));
+
+ rcm.setUrl(properties.getProperty("%%current-server-url%%"));
+ rcm.getTransportManager().setUserName(properties.getProperty("server.user"));
+ rcm.getTransportManager().setPassword(properties.getProperty("server.pwd"));
+
+ //loading properities using getResource
+/* this.getClass().getResource("weblogic.properties");
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setAnnouncementDelay(Integer.parseInt(System.getProperty("announcement.delay").trim()));
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setMulticastGroupAddress(System.getProperty("rcm.multicastgroup"));
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setMulticastPort(Integer.parseInt(System.getProperty("rcm.multicastport").trim()));
+ ((DatabaseSessionImpl)session).getCommandManager().getDiscoveryManager().setPacketTimeToLive(Integer.parseInt(System.getProperty("rcm.packet.timetolive").trim()));
+
+ rcm.setUrl(System.getProperty("rcm.wls.server1.url"));
+ rcm.getTransportManager().setUserName(System.getProperty("server.user"));
+ rcm.getTransportManager().setPassword(System.getProperty("server.pwd"));
+*/
+ rcm.getTransportManager().setNamingServiceType(TransportManager.JNDI_NAMING_SERVICE);
+ rcm.getTransportManager().setInitialContextFactoryName("weblogic.jndi.WLInitialContextFactory");
+ rcm.getTransportManager().setShouldRemoveConnectionOnError(true);
+ rcm.setServerPlatform(((org.eclipse.persistence.sessions.DatabaseSession)session).getServerPlatform());
+ rcm.initialize();
+
+ // Sleep to allow RCM to startup and find each session.
+ try {
+ Thread.sleep(2000);
+ } catch (Exception ignore) {
+ }
+
+ }
+
+}
\ No newline at end of file
Index: jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/sessionbean/SessionBeanTestsRCM.java
===================================================================
--- jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/sessionbean/SessionBeanTestsRCM.java (revision 0)
+++ jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/sessionbean/SessionBeanTestsRCM.java (revision 0)
@@ -0,0 +1,288 @@
+/*******************************************************************************
+ * Copyright (c) 1998, 2008 Oracle. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+* pvijayaratnam - cache coordination test implementation
+ ******************************************************************************/
+ package org.eclipse.persistence.testing.tests.jpa.sessionbean;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.*;
+
+import org.eclipse.persistence.exceptions.ValidationException;
+import org.eclipse.persistence.testing.framework.junit.JUnitTestCase;
+import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Department;
+import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Employee;
+import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.Address;
+import org.eclipse.persistence.testing.models.jpa.fieldaccess.advanced.AdvancedTableCreator;
+import org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService;
+
+import org.eclipse.persistence.expressions.Expression;
+import org.eclipse.persistence.expressions.ExpressionBuilder;
+import org.eclipse.persistence.queries.ReadObjectQuery;
+
+import java.util.*;
+import java.io.*;
+
+/**
+ * EJB 3 SessionBean tests.
+ * Testing using EclipseLink JPA in a JEE EJB 3 SessionBean environment.
+ * These tests can only be run with a server.
+ */
+public class SessionBeanTestsRCM extends JUnitTestCase {
+ protected EmployeeService service;
+ private String wlsUserName;
+ private String wlsPassword;
+ private String server1Url;
+ private String server2Url;
+ private String server3Url;
+ int empId = 0;
+ private Employee employeeCached = null;
+
+ public SessionBeanTestsRCM() {
+ super();
+ }
+
+ public SessionBeanTestsRCM(String name) {
+ super(name);
+ }
+
+ public SessionBeanTestsRCM(String name, boolean shouldRunTestOnServer) {
+ super(name);
+
+ this.getClass().getResource("weblogic.properties");
+ wlsUserName = System.getProperty("server.user");
+ wlsPassword = System.getProperty("server.pwd");
+ server1Url = System.getProperty("rcm.wls.server1.url");
+ server2Url = System.getProperty("rcm.wls.server2.url");
+ server3Url = System.getProperty("rcm.wls.server3.url");
+ }
+
+ public static Test suite() {
+
+
+ TestSuite suite = new TestSuite("SessionBeanTestsRCM");
+
+ suite.addTest(new SessionBeanTestsRCM("testSetupRcmOnServer2", true));
+ suite.addTest(new SessionBeanTestsRCM("testSetupForDeleteOnServer2", true));
+
+ suite.addTest(new SessionBeanTestsRCM("testSetupRcmOnServer1", true));
+ suite.addTest(new SessionBeanTestsRCM("testPerformDeleteOnServer1", true));
+
+ //suite.addTest(new SessionBeanTestsRCM("testReadFromServer2AfterUpdateNonJPQL", true));
+ suite.addTest(new SessionBeanTestsRCM("testConfirmUpdateOnServer2", true));
+ suite.addTest(new SessionBeanTestsRCM("testConfirmDeleteOnServer2", true));
+ return suite;
+ }
+
+ /**
+ * The setup is done as a test, both to record its failure, and to alow execution in the server2.
+ */
+ public void testSetupRcmOnServer2() throws Exception {
+ new AdvancedTableCreator().replaceTables(JUnitTestCase.getServerSession("sessionbean"));
+ }
+
+ public EmployeeService getEmployeeService(String url) throws Exception {
+ if (service == null) {
+ Properties properties = new Properties();
+ if (url != null) {
+ properties.put("java.naming.provider.url", url);
+ }
+ Context context = new InitialContext(properties);
+
+ try {
+ service = (EmployeeService) PortableRemoteObject.narrow(context.lookup("java:comp/env/ejb/EmployeeService"), EmployeeService.class);
+ } catch (NameNotFoundException notFoundException) {
+ try {
+ service = (EmployeeService) PortableRemoteObject.narrow(context.lookup("ejb/EmployeeService"), EmployeeService.class);
+ } catch (NameNotFoundException notFoundException2) {
+ try {
+ // WLS likes this one.
+ service = (EmployeeService) PortableRemoteObject.narrow(context.lookup("EmployeeService#org.eclipse.persistence.testing.models.jpa.sessionbean.EmployeeService"), EmployeeService.class);
+ } catch (NameNotFoundException notFoundException3) {
+ try {
+ //jboss likes this one
+ service = (EmployeeService) PortableRemoteObject.narrow(context.lookup("EmployeeService/remote"), EmployeeService.class);
+ } catch (NameNotFoundException notFoundException4) {
+ throw new Error("All lookups failed.", notFoundException);
+ }
+ }
+ }
+ }
+ }
+ return service;
+ }
+
+
+ /* CacheCoordination Delete Test Setup on Server2:
+ * This test insert an employee record, which will be deleted later using Server1
+ */
+ public void testSetupForDeleteOnServer2() throws Exception {
+ /* Create an Employee record using Server2 */
+ Employee employee = new Employee();
+ employee.setFirstName("Jane2");
+ employee.setLastName("Doe2");
+ employee.setAddress(new Address());
+ employee.getAddress().setCity("Ottawa2");
+ Employee manager = new Employee();
+ manager.setFirstName("John2");
+ manager.setLastName("Done2");
+ employee.setManager(manager);
+
+ int empID = getEmployeeService(server2Url).insert(employee);
+
+ try{
+ employee = getEmployeeService(server2Url).findById(empID);
+ if(employee == null){
+
+ fail("Server2 CacheCoordination Setup Failure: New employee added from Server2 is not found in cache or DB.");
+ }
+ } catch(Exception e){
+ throw new Error("Following Emp ID not found: " + empID);
+ }
+ }
+
+ /**
+ * CacheCoordination Update Test setup on Server1:
+ * This test insert an employee record, which is then updated using Server1. Later on, this update will be verified on Server2.
+ * The setup is done as a test, both to record its failure, and to alow execution in the server1.
+ */
+ public void testSetupRcmOnServer1() throws Exception {
+
+ /* Create an Employee record in Server1 */
+ Employee employee = new Employee();
+ employee.setFirstName("Jane1");
+ employee.setLastName("Doe1");
+ employee.setAddress(new Address());
+ employee.getAddress().setCity("Ottawa1");
+ Employee manager = new Employee();
+ manager.setFirstName("John1");
+ manager.setLastName("Done1");
+ employee.setManager(manager);
+
+ empId = getEmployeeService(server1Url).insert(employee);
+
+ /* read Employee from cache and/or DB */
+ Employee jane1 = (Employee) getEmployeeService(server1Url).findById(empId);
+ /* update employee on Server1 */
+ jane1.setLastName("LastNameUpdatedOnServer1");
+ jane1.getAddress().setCity("newCity");
+ getEmployeeService(server1Url).update(jane1);
+
+ if (!jane1.getLastName().equals("LastNameUpdatedOnServer1")) {
+ fail("UpdateTest Setup on Server1 failed");
+ }
+
+ }
+
+ /**
+ * CacheCoordination Test setup for Delete on Server1:
+ * Find employee created on Server2, then delete it using Server1.
+ */
+ public void testPerformDeleteOnServer1() throws Exception {
+
+ List result = getEmployeeService(server1Url).findByFirstName("Jane2");
+ int count = 0;
+ for(Iterator i = result.iterator(); i.hasNext();){
+ employeeCached = (Employee) i.next();
+ }
+
+ if(employeeCached == null){
+
+ fail("Perform Delete Test failed: New employee was not found in distributed cache to delete");
+ }
+
+ getEmployeeService(server1Url).delete(employeeCached);
+ }
+
+
+ /* CacheCoordination Test - Verify that Object Update done on Server1 is sync with Server2 thru cache:
+ * This test uses JPQL to read object on Server2.
+ */
+ public void testConfirmUpdateOnServer2() throws Exception {
+
+
+ /* verify updates are in sync: read Employee from using Server2 URL */
+
+ List result = getEmployeeService(server2Url).findByFirstName("Jane1");
+ int count = 0;
+ for(Iterator i = result.iterator(); i.hasNext();){
+ employeeCached = (Employee) i.next();
+ }
+ if(employeeCached == null){
+
+ fail("Object Update Test verification failed: New employee was not found in distributed cache");
+ }
+ if (!employeeCached.getLastName().equals("LastNameUpdatedOnServer1")) {
+ fail("Object Update Test verification failed: Changes from server1 is not seen by server2 from distributed cache");
+ }
+
+
+ }
+
+
+
+ /* CacheCoordination Test - Verify that Object Delete done on Server1 is sync with Server2 thru cache:
+ * This test uses JPQL to read object on Server2.
+ */
+ public void testConfirmDeleteOnServer2() throws Exception {
+
+ /* verify deletes are in sync: read Employee from using Server2 URL */
+
+ List result = getEmployeeService(server2Url).findByFirstName("Jane2");
+ int count = 0;
+ for(Iterator i = result.iterator(); i.hasNext();){
+ employeeCached = (Employee) i.next();
+ }
+ if(!( employeeCached == null)){
+
+ fail("Object Delete Test verification failed: employee was not removed from cache as expected" );
+ }
+
+ }
+
+ /* CacheCoordination Test - Verify changes are on cache and read onto Server2:
+ *
+ */
+/*
+ public void testReadFromServer2AfterUpdateNonJPQL() throws Exception {
+
+
+ // read Employee from using Server2 URL
+ ExpressionBuilder employees = new ExpressionBuilder();
+ Expression expression = employees.get("firstName").equal("Jane1");
+ ReadObjectQuery query = new ReadObjectQuery(Employee.class, expression);
+
+ // verify updates are in sync
+
+ query.checkCacheOnly();
+ //empID = getEmpID();
+ Employee employeeCached = (Employee) (this.getServerSession("sessionbean")).executeQuery(query);
+
+ if(employeeCached == null){
+
+ fail("Object_Exist_Test: New employee was not added to distributed cache: (SERVER2_URL) "+ (this.getServerSession("sessionbean")).getName() );
+ }
+ if (!employeeCached.getLastName().equals("LastNameUpdatedOnServer1")) {
+ fail("Object_Update_Test: Changes from server1 is not seen by server2 from distributed cache");
+ }
+
+
+ }
+*/
+
+}
+
Index: jpa/eclipselink.jpa.test/weblogic.properties
===================================================================
--- jpa/eclipselink.jpa.test/weblogic.properties (revision 3389)
+++ jpa/eclipselink.jpa.test/weblogic.properties (working copy)
@@ -19,3 +19,39 @@
junit.lib=../../../extension.lib.external/junit.jar
eclipselink.jar.name=../../eclipselink.jar
jdbc.driver.jar=../../../extension.oracle.lib.external/ojdbc5_11.jar
+
+# CacheCoordination Weblogic properties
+domain.name=mydomain
+weblogic.version=10.3
+
+#rcm.wls.adminserver.httphost=${weblogic.host}
+rcm.wls.server1.httphost=${weblogic.host}
+rcm.wls.server2.httphost=${weblogic.host}
+rcm.wls.server3.httphost=${weblogic.host}
+#rcm.wls.adminserver.name=server1
+rcm.wls.server1.name=server1
+rcm.wls.server2.name=server2
+rcm.wls.server3.name=server3
+#rcm.wls.adminserver.port=${weblogic.port}
+rcm.wls.server1.port=7001
+rcm.wls.server2.port=7021
+rcm.wls.server3.port=7031
+
+rcm.wls.server1.url=t3://${rcm.wls.server1.httphost}:${rcm.wls.server1.port}/
+rcm.wls.server2.url=t3://${rcm.wls.server2.httphost}:${rcm.wls.server2.port}/
+rcm.wls.server3.url=t3://${rcm.wls.server3.httphost}:${rcm.wls.server3.port}/
+
+# test config using protocol: valid values are jms or rmi
+cachecoordination.protocol=jms
+
+# RMI properties
+announcement.delay=1000
+rcm.multicastgroup=239.192.0.0
+rcm.multicastport=3121
+rcm.packet.timetolive=2
+
+# JMS properties
+#rcm.wls.jms.topichost.url=t3://${rcm.wls.server1.httphost}:${rcm.wls.server1.port}
+rcm.wls.jms.topichost.url=t3://localhost:7001
+rcm.wls.jms.topicname=jms/EclipseLinkTopic
+rcm.wls.jms.topic.connectionfactory.name=jms/EclipseLinkTopicConnectionFactory
\ No newline at end of file