diff --git a/README.md b/README.md index 6043666e..fffee422 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,42 @@ +<<<<<<< HEAD +Coherence Incubator Source Repository +===================================== + +The Oracle [Coherence Incubator](http://cohinc.java.net) Project defines a collection of +examples, organized as [Apache Maven](http://maven.apache.org/) modules, demonstrating +advanced uses of [Oracle Coherence](http://www.oracle.com/technology/products/coherence/index.html). + +Official information about this project including the definition, licensing, contributors, +maintainers, issue tracking, releases, source code and contact information is available at: +[http://cohinc.java.net](http://cohinc.java.net) + +Repository Structure +==================== + +This repository contains many branches of development for the Oracle [Coherence Incubator](http://cohinc.java.net), +each based on different major revisions of [Oracle Coherence](http://www.oracle.com/technology/products/coherence/index.html). + +Coherence Incubator 12 (for Coherence 12.1.2.x) +---------------------------------------------- + +Development Documentation: [http://coherence-community.github.com/coherence-incubator/12.0.0-SNAPSHOT/](http://coherence-community.github.com/coherence-incubator/12.0.0-SNAPSHOT/) + +Development Branch: [**develop-12**](https://github.com/coherence-community/coherence-incubator/tree/develop-12) + +Coherence Incubator 11 (for Coherence 3.7.1.x) +---------------------------------------------- + +Release Documentation: [http://coherence-community.github.com/coherence-incubator/11.1.0/](http://coherence-community.github.com/coherence-incubator/11.1.0/) + +Development Branch: [**develop-11**](https://github.com/coherence-community/coherence-incubator/tree/develop-11) + +Coherence Incubator 10 (legacy for Coherence 3.7.1.x) +----------------------------------------------------- + +The original source code and releases for Coherence Incubator 10 remain available at: + +[http://coherence.oracle.com/display/INC10/Home](http://coherence.oracle.com/display/INC10/Home) +======= Coherence Incubator Release 12 ============================== @@ -19,3 +58,4 @@ The latest project documentation for the Coherence Incubator Release 12 SNAPSHOT > The [Apache Maven](http://maven.apache.org)-based releases for this project are published to: [maven.java.net](https://maven.java.net). > > Maven Snapshots of this project are routinely published to the [maven.java.net](https://maven.java.net) snapshot repository that of which is defined here: [https://maven.java.net/content/repositories/snapshots/](https://maven.java.net/content/repositories/snapshots/) +>>>>>>> 9e2384b44188610fe2ea6448988904e6aec6a910 diff --git a/coherence-processingpattern-tests/pom.xml b/coherence-processingpattern-tests/pom.xml new file mode 100755 index 00000000..e4d77663 --- /dev/null +++ b/coherence-processingpattern-tests/pom.xml @@ -0,0 +1,142 @@ + + 4.0.0 + + + coherence-incubator + com.oracle.coherence.incubator + 12.0.0-SNAPSHOT + ../pom.xml + + + coherence-processingpattern-tests + + Coherence Incubator Processing Pattern (functional tests) + + + Functional tests for the Coherence Incubator Processing Pattern. + + + + + + com.oracle.coherence + coherence + ${oracle.coherence.version} + provided + + + + com.oracle.coherence.incubator + coherence-processingpattern + ${project.parent.version} + + + + junit + junit + ${junit.version} + test + + + + com.oracle.tools + oracle-tools-core + ${oracle.tools.version} + test + + + + com.oracle.tools + oracle-tools-runtime + ${oracle.tools.version} + test + + + + com.oracle.tools + oracle-tools-coherence + ${oracle.tools.version} + test + + + + com.oracle.tools + oracle-tools-testing-support + ${oracle.tools.version} + test + + + + com.oracle.tools + oracle-tools-coherence-testing-support + ${oracle.tools.version} + test + + + + org.mockito + mockito-all + ${mockito.version} + test + + + + org.easymock + easymock + ${easymock.version} + test + + + + org.easymock + easymockclassextension + ${easymock.version} + test + + + + org.powermock + powermock-module-junit4 + ${powermock.version} + test + + + + org.powermock + powermock-api-easymock + ${powermock.version} + test + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven.javadoc.plugin.version} + + true + + + + + org.apache.maven.plugins + maven-install-plugin + ${maven.install.plugin.version} + + true + + + + + org.apache.maven.plugins + maven-deploy-plugin + ${maven.deploy.plugin.version} + + true + + + + + + \ No newline at end of file diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallable.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallable.java new file mode 100644 index 00000000..14cdcfb4 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallable.java @@ -0,0 +1,93 @@ +/* + * File: SimpleCallable.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.callable; + +import com.tangosol.io.ExternalizableLite; + +import com.tangosol.io.pof.PofReader; +import com.tangosol.io.pof.PofWriter; +import com.tangosol.io.pof.PortableObject; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +import java.util.concurrent.Callable; + +/** + * A Simple Callable that sleeps for a second and writes to system out. + * + * Copyright (c) 2013. All Rights Reserved. Oracle Corporation.
+ * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. + * + * @author David Rowlands + */ +@SuppressWarnings({"serial", "rawtypes"}) +public class SimpleCallable implements Callable, ExternalizableLite, PortableObject +{ + /** + * {@inheritDoc} + */ + public Object call() throws Exception + { + Thread.sleep(1); + + return "Hello Client!"; + } + + + /** + * {@inheritDoc} + */ + public void readExternal(final DataInput arg0) throws IOException + { + } + + + /** + * {@inheritDoc} + */ + public void readExternal(final PofReader arg0) throws IOException + { + } + + + /** + * {@inheritDoc} + */ + public void writeExternal(final DataOutput arg0) throws IOException + { + } + + + /** + * {@inheritDoc} + */ + public void writeExternal(final PofWriter arg0) throws IOException + { + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallableExtendTaskTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallableExtendTaskTests.java new file mode 100644 index 00000000..2354a5de --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallableExtendTaskTests.java @@ -0,0 +1,127 @@ +/* + * File: SimpleCallableTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.callable; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; + +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; + +import com.oracle.tools.runtime.coherence.Cluster; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Date; + +import java.util.concurrent.ExecutionException; + +/** + * A sample demonstrating a Callable using the processing pattern and extend client with + * task processor defined on client. + * + * Copyright (c) 2013. All Rights Reserved. Oracle Corporation.
+ * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. + * + * @author David Rowlands + */ +public class SimpleCallableExtendTaskTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(proxyCacheConfig, pofConfig, 0, 2, true); + } + + + /** + * The simpleCallable method initializes the pattern and submits the Callable for execution, then waits for the result. + * + * @throws InterruptedException if execution was interrupted + * @throws ExecutionException if execution failed + */ + @Test + public void simpleCallable() throws InterruptedException, ExecutionException, Throwable + { + extendClientInit(pofConfig, extendClientTaskCacheConfig); + + ProcessingSession session = null; + + try + { + session = new DefaultProcessingSession(StringBasedIdentifier.newInstance("SimpleCallableSample" + + System.currentTimeMillis())); + + final ArrayList submissionlist = new ArrayList(); + + for (int i = 0; i < 30; i++) + { + final SubmissionOutcome outcome = session.submit(new SimpleCallable(), + new DefaultSubmissionConfiguration(), + new SubmissionCallback("Submission:" + i)); + + // And add it to a list to keep track of it + submissionlist.add(outcome); + } + + + for (int i = 0; i < submissionlist.size(); i++) + { + SubmissionOutcome outcome = submissionlist.get(i); + System.out.println("Result:" + Integer.toString(i) + ":" + outcome.get().toString()); + + final Date submittime = new Date(outcome.getSubmissionTime()); + + System.out.println("Submitted at:" + submittime.toString() + " Latency:" + + Long.toString(outcome.getWaitDuration()) + " Execution took " + + Long.toString(outcome.getExecutionDuration()) + " msec."); + } + + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallableTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallableTests.java new file mode 100644 index 00000000..a17c370d --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SimpleCallableTests.java @@ -0,0 +1,127 @@ +/* + * File: SimpleCallableTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.callable; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; + +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; + +import com.oracle.tools.runtime.coherence.Cluster; + +import org.junit.Test; + +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Date; + +import java.util.concurrent.ExecutionException; + +/** + * A sample demonstrating a Callable using the processing pattern. + * + * Copyright (c) 2013. All Rights Reserved. Oracle Corporation.
+ * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. + * + * @author David Rowlands + * + */ +public class SimpleCallableTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(singleCacheConfig, pofConfig, 0, 2, true); + } + + + /** + * The simpleCallable method initializes the pattern and submits the Callable for execution, then waits for the result. + * + * @throws InterruptedException if execution was interrupted + * @throws ExecutionException if execution failed + */ + @Test + public void simpleCallable() throws InterruptedException, ExecutionException, Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = new DefaultProcessingSession(StringBasedIdentifier.newInstance("SimpleCallableSample" + + System.currentTimeMillis())); + + final ArrayList submissionlist = new ArrayList(); + + for (int i = 0; i < 30; i++) + { + final SubmissionOutcome outcome = session.submit(new SimpleCallable(), + new DefaultSubmissionConfiguration(), + new SubmissionCallback("Submission:" + i)); + + // And add it to a list to keep track of it + submissionlist.add(outcome); + } + + + for (int i = 0; i < submissionlist.size(); i++) + { + SubmissionOutcome outcome = submissionlist.get(i); + System.out.println("Result:" + Integer.toString(i) + ":" + outcome.get().toString()); + + final Date submittime = new Date(outcome.getSubmissionTime()); + + System.out.println("Submitted at:" + submittime.toString() + " Latency:" + + Long.toString(outcome.getWaitDuration()) + " Execution took " + + Long.toString(outcome.getExecutionDuration()) + " msec."); + } + + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SubmissionCallback.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SubmissionCallback.java new file mode 100644 index 00000000..8891a7f5 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/callable/SubmissionCallback.java @@ -0,0 +1,99 @@ +/* + * File: SubmissionCallback.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.callable; + +import com.oracle.coherence.patterns.processing.SubmissionOutcomeListener; + +/** + * A sample demonstrating a Callback used in the processing pattern. + * + * Copyright (c) 2013. All Rights Reserved. Oracle Corporation.
+ * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. + * + * @author David Rowlands + * + */ +public class SubmissionCallback implements SubmissionOutcomeListener +{ + private String m_sTaskName; + + + /** + * Constructs a {@link SubmissionCallback} + * + * @param sTaskName + */ + public SubmissionCallback(String sTaskName) + { + m_sTaskName = sTaskName; + } + + + /** + * {@inheritDoc} + */ + public void onDone(Object oResult) + { + System.out.println(m_sTaskName + ": Submission done"); + } + + + /** + * {@inheritDoc} + */ + public void onFailed(Object oResult) + { + System.out.println(m_sTaskName + ": Submission failed"); + } + + + /** + * {@inheritDoc} + */ + public void onProgress(Object oProgress) + { + System.out.println(m_sTaskName + ": Submission progress:" + oProgress.toString()); + } + + + /** + * {@inheritDoc} + */ + public void onStarted() + { + System.out.println(m_sTaskName + ": Submission started"); + } + + + /** + * {@inheritDoc} + */ + public void onSuspended() + { + System.out.println(m_sTaskName + ": Submission suspended"); + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/misc/AbstractClusterTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/misc/AbstractClusterTests.java new file mode 100755 index 00000000..f8eff97b --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/misc/AbstractClusterTests.java @@ -0,0 +1,290 @@ +/* + * File: AbstractClusterTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.misc; + +import static com.oracle.tools.deferred.DeferredHelper.eventually; +import static com.oracle.tools.deferred.DeferredHelper.invoking; +import static org.hamcrest.CoreMatchers.is; + +import com.oracle.tools.deferred.DeferredAssert; +import com.oracle.tools.runtime.coherence.Cluster; +import com.oracle.tools.runtime.coherence.ClusterBuilder; +import com.oracle.tools.runtime.coherence.ClusterMember; +import com.oracle.tools.runtime.coherence.ClusterMemberSchema; +import com.oracle.tools.runtime.console.SystemApplicationConsole; +import com.oracle.tools.runtime.java.JavaApplicationBuilder; +import com.oracle.tools.runtime.java.NativeJavaApplicationBuilder; +import com.oracle.tools.runtime.java.container.Container; +import com.oracle.tools.runtime.network.AvailablePortIterator; +import com.tangosol.net.CacheFactory; +import com.tangosol.util.Base; + +import org.junit.After; +import org.junit.Before; + +import java.util.Iterator; + +/** + * An abstract class used for process pattern tests. + * + * Copyright (c) 2013. All Rights Reserved. Oracle Corporation.
+ * Oracle is a registered trademark of Oracle Corporation and/or its affiliates. + * + * @author David Rowlands + */ +public abstract class AbstractClusterTests +{ + /** + * single server processing pattern cache configuration file. + */ + public final static String singleCacheConfig = "coherence-processingpattern-test-single-server-cache-config.xml"; + + /** + * grid processing pattern cache configuration file. + */ + public final static String gridCacheConfig = "coherence-processingpattern-test-grid-server-cache-config.xml"; + + /** + * extend client cache configuration file. + */ + public final static String extendClientCacheConfig = + "coherence-processingpattern-test-extendclient-cache-config.xml"; + + /** + * extend client single task processing cache configuration file. + */ + public final static String extendClientTaskCacheConfig = + "coherence-processingpattern-test-extend-taskprocessing-cache-config.xml"; + + /** + * extend client single task processing cache configuration file. + */ + public final static String proxyCacheConfig = + "coherence-processingpattern-test-proxy-cache-config.xml"; + + /** + * pof configuration file. + */ + public final static String pofConfig = "coherence-processingpattern-test-pof-config.xml"; + + /** + * Cluster used by tests. + */ + private Cluster m_cluster; + + /** + * The AvailablePortIterator must be a singleton since it allocates ports + * across tests. + */ + private static AvailablePortIterator s_availablePortIterator; + + + + /** + * Initialize the test and start a cache server(s). + */ + @Before + public void startup() + { + m_cluster = startCluster(); + } + + + /** + * Shutdown the cluster. + */ + @After + public void shutdown() + { + shutdownCluster(m_cluster); + } + + + /** + * Default starting of Cluster. + * Can be extended by tests as needed. + * + * @return Cluster the started cluster + */ + public Cluster startCluster() + { + return startTestCluster(singleCacheConfig, pofConfig, 0, 1, true); + } + + + /** + * Default shutdown of Cluster + * Can be extended by tests as needed. + */ + public void shutdownCluster(Cluster cluster) + { + if (cluster != null) + { + shutdownTestCluster(cluster); + } + } + + + /** + * Common logic to initialize extend client configuration. + * + * @param pofConfig - pof configuration file used extend client + * @param cacheConfig - cache configuration file + */ + public void extendClientInit(String pofConfig, + String cacheConfig) + { + System.setProperty("tangosol.pof.config", pofConfig); + System.setProperty("tangosol.coherence.cacheconfig", extendClientCacheConfig); + + // turn off local clustering so we don't connect with the process just started + System.setProperty("tangosol.coherence.tcmp.enabled", "false"); + + Iterator members = m_cluster.iterator(); + + if (members.hasNext()) + { + String remPort = members.next().getSystemProperty("proxy.port"); + + System.setProperty("remote.port", remPort); + } + + } + + + /** + * Shutdown a server within cluster. + */ + public void shutdownServer() + { + Iterator membersIter = m_cluster.iterator(); + ClusterMember server = null; + + while (membersIter.hasNext()) + { + server = (ClusterMember) membersIter.next(); + } + + if (server != null) + { + server.destroy(); + } + + } + + + + /** + * Create the cluster and start it. + * + * @return this object + */ + public Cluster startTestCluster(String sCachConfig, + String sPofConfig, + int unicastPort, + int memberCount, + boolean fStorageEnabled) + { + + Cluster cluster = null; + + // ensure this process does not start or join a cluster + // System.setProperty("tangosol.coherence.tcmp.enabled", "false"); + int clusterPort = unicastPort == 0 ? Container.getAvailablePorts().next() : unicastPort; + + try + { + JavaApplicationBuilder bldrApp = + new NativeJavaApplicationBuilder(); + + ClusterBuilder clusterBuilder = new ClusterBuilder(); + + for (int i = 1; i <= memberCount; i++) + { + ClusterMemberSchema schema = + new ClusterMemberSchema().setEnvironmentInherited(true).setPreferIPv4(true) + .setClusterPort(clusterPort) + .setSystemProperty("test.unicast.port", + String.valueOf(clusterPort)).setSystemProperty("proxy.port", + Container.getAvailablePorts().next()) + .setCacheConfigURI(sCachConfig) + .setSingleServerMode() + .setStorageEnabled(fStorageEnabled) + .setJMXPort(Container.getAvailablePorts()) + .setRemoteJMXManagement(true) + .setJMXManagementMode(ClusterMemberSchema + .JMXManagementMode + .ALL).setJMXSupport(true) + .addOption("-ea"); + + if (sPofConfig != null) + { + schema.setPofConfigURI(sPofConfig); + schema.setPofEnabled(true); + } + + System.out.println("Adding builder " + i); + clusterBuilder.addBuilder(bldrApp, schema, "processing-pattern-" + i, 1); + } + + cluster = clusterBuilder.realize(new SystemApplicationConsole()); + + while (cluster.getClusterSize() < memberCount) + { + System.out.println("Cluster size is " + cluster.getClusterSize()); + Base.sleep(4000); + } + + DeferredAssert.assertThat(eventually(invoking(cluster).getClusterSize()), is(memberCount)); + + return cluster; + + } + catch (Exception e) + { + throw Base.ensureRuntimeException(e); + } + } + + + /** + * Shutdown the cluster. + */ + public void shutdownTestCluster(Cluster cluster) + { + CacheFactory.shutdown(); + + if (cluster != null) + { + cluster.destroy(); + } + + // wait until cluster has been shut down + DeferredAssert.assertThat(eventually(invoking(cluster).getClusterSize()), is(0)); + } + +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/CancelSubmissionTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/CancelSubmissionTests.java new file mode 100644 index 00000000..b19066aa --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/CancelSubmissionTests.java @@ -0,0 +1,112 @@ +/* + * File: CancelSubmissionTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.runnable; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; + +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.SubmissionRetentionPolicy; +import com.oracle.coherence.patterns.processing.SubmissionState; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; + +import com.oracle.tools.runtime.coherence.Cluster; + +import org.junit.Test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * This is a test that exercises the ability to control + * the lifecycle of a Submission directly. + */ +public class CancelSubmissionTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(gridCacheConfig, pofConfig, 0, 1, true); + } + + + /** + * A test that checks that a Runnable can be canceled after submission. + */ + @Test + public void testCancelSubmission() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = new DefaultProcessingSession(StringBasedIdentifier.newInstance("RunnableLifecycleTestSession")); + + System.out.println("Testing CANCELLING SUBMISSIONS"); + + String taskName = "RunnableToCancel"; + SubmissionOutcome outcome = session.submit(new DoNothingRunnable(15000), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.ExplicitRemove, + null); + + System.out.println("Wait a second before CANCELLING submission"); + + Thread.currentThread(); + Thread.sleep(1000); + session.cancelSubmission(outcome.getIdentifier()); + outcome.get(); + System.out.println("After get:" + outcome.getSubmissionState()); + assertTrue(outcome.getSubmissionState() == SubmissionState.CANCELLED); + System.out.println("Waiting 3 seconds to complete cancelling of job"); + Thread.currentThread(); + Thread.sleep(3000); + + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/DoNothingRunnable.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/DoNothingRunnable.java new file mode 100644 index 00000000..e001d098 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/DoNothingRunnable.java @@ -0,0 +1,141 @@ +/* + * File: DoNothingRunnable.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.runnable; + +import com.tangosol.io.ExternalizableLite; + +import com.tangosol.io.pof.PofReader; +import com.tangosol.io.pof.PofWriter; +import com.tangosol.io.pof.PortableObject; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +/** + *

A {@link DoNothingRunnable} just prints out that it is running.

+ * + * @author Christer Fahlgren + */ +@SuppressWarnings("serial") +public class DoNothingRunnable implements Runnable, ExternalizableLite, PortableObject +{ + /** + * A long indicating how long to sleep in milliseconds. + */ + private long milliSecsToSleep; + + + /** + * Constructs ... + * + */ + public DoNothingRunnable() + { + } + + + /** + * Constructs ... + * + * + * @param milliSecsToSleep + */ + public DoNothingRunnable(long milliSecsToSleep) + { + this.milliSecsToSleep = milliSecsToSleep; + } + + + /** + * {@inheritDoc} + */ + public void run() + { + System.out.println("Executing the DONOTHINGRUNNABLE sleeping " + milliSecsToSleep); + + if (milliSecsToSleep > 0) + { + try + { + Thread.currentThread(); + Thread.sleep(milliSecsToSleep); + System.out.println("FINISHED SLEEPING"); + + } + catch (InterruptedException e) + { + System.out.println("RUNNABLE INTERRUPTED"); + Thread.currentThread().interrupt(); // preserve interruption status + e.printStackTrace(); + } + catch (Throwable t) + { + System.out.println("RUNNABLE INTERRUPTED THROWABLE:" + t); + Thread.currentThread().interrupt(); // preserve interruption status + t.printStackTrace(); + } + } + + } + + + /** + * {@inheritDoc} + */ + public void readExternal(DataInput in) throws IOException + { + milliSecsToSleep = in.readLong(); + } + + + /** + * {@inheritDoc} + */ + public void writeExternal(DataOutput out) throws IOException + { + out.writeLong(milliSecsToSleep); + } + + + /** + * {@inheritDoc} + */ + public void readExternal(PofReader reader) throws IOException + { + milliSecsToSleep = reader.readLong(0); + } + + + /** + * {@inheritDoc} + */ + public void writeExternal(PofWriter writer) throws IOException + { + writer.writeLong(0, milliSecsToSleep); + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/RunnableLifecycleTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/RunnableLifecycleTests.java new file mode 100644 index 00000000..495e4633 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/runnable/RunnableLifecycleTests.java @@ -0,0 +1,190 @@ +/* + * File: RunnableLifecycleTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.runnable; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; + +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.SubmissionRetentionPolicy; +import com.oracle.coherence.patterns.processing.SubmissionState; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; + +import com.oracle.tools.runtime.coherence.Cluster; + +import com.tangosol.io.pof.PortableException; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * This is a test that exercises the ability to control + * the lifecycle of a Submission directly. + * + * @author David Rowlands + */ +public class RunnableLifecycleTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(gridCacheConfig, pofConfig, 0, 1, true); + } + + + /** + * A test that checks that runnables with no result are removed with RemoveOnFinalState policy. + */ + @Test + public void testRunnableNoResultLifecycle() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = new DefaultProcessingSession(StringBasedIdentifier.newInstance("RunnableLifecycleTestSession")); + + String taskName = "RunnableLifecycle"; + SubmissionOutcome outcome = session.submit(new DoNothingRunnable(2000), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.RemoveOnFinalState, + null); + + assertTrue(session.submissionExists(outcome.getIdentifier())); + Thread.currentThread(); + Thread.sleep(5000); + + // After having waited for one second, the runnable should have run and have been removed. + // Now we submit a second identically named runnable + session.submit(new DoNothingRunnable(), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.RemoveOnFinalState, + null); + + Thread.currentThread(); + Thread.sleep(1000); + + // And after having waited another second, the second one should have run and have been deleted + + // We verify that the submission is gone + assertFalse(session.submissionExists(StringBasedIdentifier.newInstance(taskName))); + + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } + + + /** + * A test that checks that runnables with no result are not removed with ExplicitRemove policy. + */ + @Test + public void testRunnableNoResultLifecycleExplicitRemove() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = new DefaultProcessingSession(StringBasedIdentifier.newInstance("RunnableLifecycleTestSession")); + + System.out.println("Cluster started - now running testRunnableNoResultLifecycleExplicitRemove"); + + String taskName = "RunnableLifecycle"; + SubmissionOutcome outcome = session.submit(new DoNothingRunnable(), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.ExplicitRemove, + null); + + Thread.currentThread(); + Thread.sleep(1000); + + assertTrue(outcome.getSubmissionState() == SubmissionState.DONE); + + try + { + // After having waited for one second, the runnable should have run and still be there + // Now we submit a second identically named runnable + session.submit(new DoNothingRunnable(), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.RemoveOnFinalState, + null); + } + catch (PortableException e) + { + if (e.getName().equals("Portable(java.lang.IllegalStateException)")) + { + // The above should throw an exception because the submission still exists + System.out.println("An expected IllegalStateException testRunnableNoResultLifecycleExplicitRemove"); + } + else + { + throw e; + } + } + + } + catch (Exception t) + { + System.out.println("Unexpected Exception in testRunnableNoResultLifecycleExplicitRemove"); + System.out.println("caught exception:" + t); + } + finally + { + if (session != null) + { + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/CancelTaskTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/CancelTaskTests.java new file mode 100644 index 00000000..8fca9ddc --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/CancelTaskTests.java @@ -0,0 +1,111 @@ +/* + * File: CancelTaskTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.junit.Test; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.SubmissionRetentionPolicy; +import com.oracle.coherence.patterns.processing.SubmissionState; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; +import com.oracle.tools.runtime.coherence.Cluster; + +/** + * This is a test that exercises canceling of a task + * + * @author Christer Fahlgren + */ +public class CancelTaskTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(gridCacheConfig, pofConfig, 0, 1, true); + } + + + /** + * A test that checks that a Runnable can be canceled after submission. + */ + @Test + public void testCancelTask() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = + new DefaultProcessingSession(StringBasedIdentifier.newInstance("RunnableLifecycleTestSession")); + + System.out.println("Testing CANCELLING TASK"); + String taskName = "TaskToCancel"; + SubmissionOutcome outcome = session.submit(new CancelableTask(6000), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.ExplicitRemove, + null); + + System.out.println("Wait a second before CANCELLING Task"); + assertTrue(session.submissionExists(outcome.getIdentifier())); + Thread.currentThread(); + Thread.sleep(500); + session.cancelSubmission(outcome.getIdentifier()); + outcome.get(); + System.out.println("After get:" + outcome.getSubmissionState()); + assertTrue(outcome.getSubmissionState() == SubmissionState.CANCELLED); + System.out.println("Waiting 3 seconds to complete cancelling of task"); + Thread.currentThread(); + Thread.sleep(3000); + + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/CancelableTask.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/CancelableTask.java new file mode 100644 index 00000000..636e8193 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/CancelableTask.java @@ -0,0 +1,157 @@ +/* + * File: CancelableTask.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import com.tangosol.io.ExternalizableLite; + +import com.tangosol.io.pof.PofReader; +import com.tangosol.io.pof.PofWriter; +import com.tangosol.io.pof.PortableObject; + +import com.tangosol.util.ExternalizableHelper; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +/** + * Taks that is used in Cancellation testing. + * + * @author David Rowlands + */ +public class CancelableTask implements ResumableTask, ExternalizableLite, PortableObject +{ + private long sleepDuration; + + + /** + * Constructs ... + * + */ + public CancelableTask() + { + } + + + /** + * Constructs ... + * + * + * @param sleepDuration + */ + public CancelableTask(int sleepDuration) + { + this.sleepDuration = sleepDuration; + } + + + /** + * Method description + * + * @param in + * + * @throws IOException + */ + public void readExternal(DataInput in) throws IOException + { + sleepDuration = ExternalizableHelper.readLong(in); + } + + + /** + * Method description + * + * @param out + * + * @throws IOException + */ + public void writeExternal(DataOutput out) throws IOException + { + ExternalizableHelper.writeLong(out, sleepDuration); + } + + + /** + * Method description + * + * @param reader + * + * @throws IOException + */ + public void readExternal(PofReader reader) throws IOException + { + sleepDuration = reader.readLong(10); + } + + + /** + * Method description + * + * @param writer + * + * @throws IOException + */ + public void writeExternal(PofWriter writer) throws IOException + { + writer.writeLong(10, sleepDuration); + } + + + /** + * Method description + * + * @param environment + * + * @return + */ + public Object run(TaskExecutionEnvironment environment) + { + try + { + Thread.sleep(sleepDuration); + } + catch (InterruptedException e) + { + System.out.println("Thread was interrupted during sleep - stack trace as follows:"); + e.printStackTrace(); + } + + return null; + } + + + /** + * Method description + * + * @return + */ + @Override + public String toString() + { + return "CancelableTask [sleepDuration=" + sleepDuration + "]"; + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/DuplicateIdentifierTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/DuplicateIdentifierTests.java new file mode 100644 index 00000000..74f8ec0f --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/DuplicateIdentifierTests.java @@ -0,0 +1,116 @@ +/* + * File: DuplicateIdentifierTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; + +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.SubmissionRetentionPolicy; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; + +import com.tangosol.net.CacheFactory; +import com.tangosol.net.NamedCache; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +/** + * Test multiple task using the same indentifiers. + * + * @author Christer Fahlgren + */ +public class DuplicateIdentifierTests extends AbstractClusterTests +{ + /** + * A test that checks that an exception is thrown for duplicate identifiers. + */ + @Test + public void testDuplicateIdentifier() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = new DefaultProcessingSession(StringBasedIdentifier.newInstance("DuplicateIdentifierSession")); + + String taskName = "DuplicateIdentifier"; + + System.out.println("Submitting first task"); + + SubmissionOutcome outcome = session.submit(new TestTask(taskName), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.ExplicitRemove, + null); + + try + { + System.out.println("Submitting second task"); + session.submit(new TestTask(taskName), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.ExplicitRemove, + null); + } + catch (IllegalStateException e) + { + System.out.println("Expected IllegalStateException thrown during submit of second task:" + e); + } + + NamedCache cache = CacheFactory.getCache("coherence.patterns.processing.submissions"); + + assertEquals(cache.size(), 1); + System.out.println("Now lets wait for the completion of first outcome."); + System.out.print(outcome.get()); + System.out.println("\n"); + System.out.println("========================================"); + System.out.println("TEST COMPLETED."); + + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/GetIdentifiersTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/GetIdentifiersTests.java new file mode 100644 index 00000000..899ce64e --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/GetIdentifiersTests.java @@ -0,0 +1,127 @@ +/* + * File: GetIdentifiersTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import com.oracle.coherence.common.identifiers.Identifier; +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; + +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.SubmissionRetentionPolicy; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; + +import com.oracle.tools.runtime.coherence.Cluster; + +import org.junit.Test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.Iterator; + +/** + * Test to ensure test identifiers are created and handled correctly. + * + * @author Christer Fahlgren + */ +public class GetIdentifiersTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(gridCacheConfig, pofConfig, 0, 1, true); + } + + + /** + * A test that creates tasks with specific identifiers and then tests for their existence. + */ + @Test + public void testGetIdentifiers() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = new DefaultProcessingSession(StringBasedIdentifier.newInstance("GetIdentifiersSession")); + + String taskName = "firstIdentifier"; + SubmissionOutcome outcome = session.submit(new TestTask(taskName), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.ExplicitRemove, + new SubmissionCallback(taskName)); + + String taskName2 = "secondIdentifier"; + SubmissionOutcome secondoutcome = session.submit(new TestTask(taskName2), + new DefaultSubmissionConfiguration(null), + StringBasedIdentifier.newInstance(taskName2), + SubmissionRetentionPolicy.ExplicitRemove, + new SubmissionCallback(taskName2)); + + assertTrue(session.submissionExists(StringBasedIdentifier.newInstance(taskName))); + assertTrue(session.submissionExists(StringBasedIdentifier.newInstance(taskName2))); + assertFalse(session.submissionExists(StringBasedIdentifier.newInstance("doesn't exist"))); + + Iterator iter = session.getIdentifierIterator(); + ArrayList ids = new ArrayList(); + + while (iter.hasNext()) + { + Identifier id = iter.next(); + + ids.add(id); + System.out.println("Id in list:" + id); + } + + assertTrue(ids.contains(StringBasedIdentifier.newInstance(taskName))); + assertTrue(ids.contains(StringBasedIdentifier.newInstance(taskName2))); + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/NoRemoveTaskTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/NoRemoveTaskTests.java new file mode 100644 index 00000000..eecac480 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/NoRemoveTaskTests.java @@ -0,0 +1,170 @@ +/* + * File: NoRemoveTaskTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; + +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.SubmissionRetentionPolicy; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; + +import com.oracle.tools.runtime.coherence.Cluster; + +import com.tangosol.net.CacheFactory; +import com.tangosol.net.NamedCache; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.text.DateFormat; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +/** + * Verify submission retention policy. + * + * @author Christer Fahlgren + */ +public class NoRemoveTaskTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(gridCacheConfig, pofConfig, 0, 1, true); + } + + + /** + * A test that creates tasks, and controls the lifecycle directly. + */ + @Test + public void testNoRemoveTask() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + + ProcessingSession session = null; + + try + { + session = + new DefaultProcessingSession(StringBasedIdentifier + .newInstance("TaskExecutionSample" + + DateFormat.getDateTimeInstance().format(System.currentTimeMillis()))); + + ArrayList tasklist = new ArrayList(); + + for (int i = 0; i < 5; i++) + { + String taskName = "TestTask:" + Integer.toString(i); + Map attrMap = new HashMap(); + + attrMap.put("type", "grid"); + System.out.println("Submitting test tasks " + i); + + SubmissionOutcome outcome = session.submit(new TestTask(taskName), + new DefaultSubmissionConfiguration(attrMap), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.ExplicitRemove, + new SubmissionCallback(taskName)); + + tasklist.add(outcome); + } + + NamedCache cache = CacheFactory.getCache("coherence.patterns.processing.submissions"); + + System.out.println("Cache size: " + cache.size()); + + for (int i = 0; i < tasklist.size(); i++) + { + System.out.println("Waiting for: " + i); + + System.out.println("Result:" + Integer.toString(i) + ":" + tasklist.get(i).get().toString()); + System.out.println("Took:" + Integer.toString(i) + ":" + tasklist.get(i).getExecutionDuration() + " L:" + + tasklist.get(i).getWaitDuration()); + } + + // Verifying that the submissions didn't get deleted. + assertEquals(cache.size(), tasklist.size()); + + ProcessingSession newsession = new DefaultProcessingSession(StringBasedIdentifier.newInstance("NewOwner")); + ArrayList newtasklist = new ArrayList(); + + for (int i = 0; i < tasklist.size(); i++) + { + System.out.println("Changing owner: " + i); + newtasklist.add(newsession.acquireSubmission(tasklist.get(i).getIdentifier(), + SubmissionRetentionPolicy.ExplicitRemove, null)); + } + + System.out.println("After changing owner Cache size: " + cache.size()); + + // Now since we changed owner for the Submissions, we shall not be able to remove + // them using the original session. + for (int i = 0; i < tasklist.size(); i++) + { + assertFalse(session.discardSubmission(tasklist.get(i).getIdentifier())); + } + + // But we should be able to remove them using the new session. + for (int i = 0; i < newtasklist.size(); i++) + { + assertTrue(newsession.discardSubmission(newtasklist.get(i).getIdentifier())); + } + + System.out.println("after remove Cache size: " + cache.size()); + + System.out.println("Cache size: " + cache.size()); + assertEquals(cache.size(), 0); + System.out.println("Finished"); + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/SimpleTaskTests.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/SimpleTaskTests.java new file mode 100644 index 00000000..05ac8ae2 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/SimpleTaskTests.java @@ -0,0 +1,142 @@ +/* + * File: SimpleTaskTests.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import static org.junit.Assert.fail; + +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +import com.oracle.coherence.common.identifiers.StringBasedIdentifier; +import com.oracle.coherence.patterns.processing.ProcessingSession; +import com.oracle.coherence.patterns.processing.SubmissionOutcome; +import com.oracle.coherence.patterns.processing.SubmissionRetentionPolicy; +import com.oracle.coherence.patterns.processing.internal.DefaultProcessingSession; +import com.oracle.coherence.patterns.processing.internal.DefaultSubmissionConfiguration; +import com.oracle.coherence.patterns.processing.misc.AbstractClusterTests; +import com.oracle.tools.runtime.coherence.Cluster; +import com.tangosol.net.CacheFactory; +import com.tangosol.net.NamedCache; + +/** + * Test submit of several task given a random server failure. + * + * @author Christer Fahlgren + */ +public class SimpleTaskTests extends AbstractClusterTests +{ + /** + * {@inheritDoc} + */ + public Cluster startCluster() + { + return startTestCluster(gridCacheConfig, pofConfig, 0, 2, true); + } + + + // ----- test methods --------------------------------------------------- + + /** + * Test of ResumableTask. + * + * @throws Throwable if something fails + */ + @Test + public void testSimpleTask() throws Throwable + { + extendClientInit(pofConfig, extendClientCacheConfig); + ProcessingSession session = null; + + try + { + session = + new DefaultProcessingSession(StringBasedIdentifier + .newInstance("TaskExecutionSample" + + DateFormat.getDateTimeInstance().format(System.currentTimeMillis()))); + + ArrayList tasklist = new ArrayList(); + + for (int i = 0; i < 6; i++) + { + String taskName = "TestTask:" + Integer.toString(i); + Map attrMap = new HashMap(); + + attrMap.put("type", "grid"); + System.out.println("Submitting test tasks " + i); + + SubmissionOutcome outcome = session.submit(new TestTask(taskName), + new DefaultSubmissionConfiguration(attrMap), + StringBasedIdentifier.newInstance(taskName), + SubmissionRetentionPolicy.RemoveOnFinalState, + new SubmissionCallback(taskName)); + + tasklist.add(outcome); + } + + NamedCache cache = CacheFactory.getCache("coherence.patterns.processing.submissions"); + + System.out.println("Cache size: " + cache.size()); + + for (int i = 0; i < tasklist.size(); i++) + { + if (i == (tasklist.size() / 2)) + { + System.out.println("-----------------------------------"); + System.out.println("- STOPPING ONE SERVER -"); + //shutdownServer(); + System.out.println("-----------------------------------"); + } + + System.out.println("Waiting for: " + i); + System.out.println("Result:" + Integer.toString(i) + ":" + tasklist.get(i).get().toString()); + System.out.println("Took:" + Integer.toString(i) + ":" + tasklist.get(i).getExecutionDuration() + " L:" + + tasklist.get(i).getWaitDuration()); + } + + System.out.println("Cache size: " + cache.size()); + System.out.println("Finished"); + } + catch (Throwable t) + { + System.out.println("Unexpected Exception in " + getClass().getName()); + t.printStackTrace(System.out); + fail(); + } + finally + { + if (session != null) + { + System.out.println("Finally - shutting down cluster"); + session.shutdown(); + } + } + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/SubmissionCallback.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/SubmissionCallback.java new file mode 100644 index 00000000..cee61486 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/SubmissionCallback.java @@ -0,0 +1,96 @@ +/* + * File: SubmissionCallback.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import com.oracle.coherence.patterns.processing.SubmissionOutcomeListener; + +/** + * Callback class reporting on the results of a Task. + * + * @author Christer Fahlgren + */ +public class SubmissionCallback implements SubmissionOutcomeListener +{ + private String m_sTaskName; + + + /** + * Constructs ... + * + * + * @param sTaskName + */ + public SubmissionCallback(String sTaskName) + { + m_sTaskName = sTaskName; + } + + + /** + * {@inheritDoc} + */ + public void onDone(Object oResult) + { + System.out.println(m_sTaskName + ":Submission done"); + } + + + /** + * {@inheritDoc} + */ + public void onFailed(Object oResult) + { + System.out.println(m_sTaskName + ":Submission failed"); + } + + + /** + * {@inheritDoc} + */ + public void onProgress(Object oProgress) + { + System.out.println(m_sTaskName + ":Submission progress:" + oProgress.toString()); + } + + + /** + * {@inheritDoc} + */ + public void onStarted() + { + System.out.println(m_sTaskName + ":Submission started"); + } + + + /** + * {@inheritDoc} + */ + public void onSuspended() + { + System.out.println(m_sTaskName + ":Submission suspended"); + } +} diff --git a/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/TestTask.java b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/TestTask.java new file mode 100644 index 00000000..1b1716bc --- /dev/null +++ b/coherence-processingpattern-tests/src/test/java/com/oracle/coherence/patterns/processing/task/TestTask.java @@ -0,0 +1,155 @@ +/* + * File: TestTask.java + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * The contents of this file are subject to the terms and conditions of + * the Common Development and Distribution License 1.0 (the "License"). + * + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the License by consulting the LICENSE.txt file + * distributed with this file, or by consulting + * or https://oss.oracle.com/licenses/CDDL + * + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file LICENSE.txt. + * + * MODIFICATIONS: + * If applicable, add the following below the License Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyright [year] [name of copyright owner]" + */ + +package com.oracle.coherence.patterns.processing.task; + +import com.tangosol.io.ExternalizableLite; + +import com.tangosol.io.pof.PofReader; +import com.tangosol.io.pof.PofWriter; +import com.tangosol.io.pof.PortableObject; + +import com.tangosol.net.CacheFactory; +import com.tangosol.net.Cluster; + +import com.tangosol.util.ExternalizableHelper; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; + +/** + *

A {@link TestTask} used by the {@link SimpleTaskTest}.

+ * + * @author Christer Fahlgren + */ +public class TestTask implements ResumableTask, ExternalizableLite, PortableObject +{ + /** + * A message. + */ + private String m_sMessage; + + + /** + * Default constructor. + */ + public TestTask() + { + super(); + } + + + /** + * Standard constructor. + * @param message the message for this task + */ + public TestTask(String message) + { + m_sMessage = message; + } + + + /** + * {@inheritDoc} + */ + public void readExternal(DataInput in) throws IOException + { + m_sMessage = ExternalizableHelper.readSafeUTF(in); + } + + + /** + * {@inheritDoc} + */ + public void writeExternal(DataOutput out) throws IOException + { + ExternalizableHelper.writeSafeUTF(out, m_sMessage); + } + + + /** + * {@inheritDoc} + */ + public void readExternal(PofReader reader) throws IOException + { + m_sMessage = reader.readString(10); + } + + + /** + * {@inheritDoc} + */ + public void writeExternal(PofWriter writer) throws IOException + { + writer.writeString(10, m_sMessage); + } + + + /** + * {@inheritDoc} + */ + public Object run(TaskExecutionEnvironment environment) + { + if (!environment.isResuming()) + { + Cluster cluster = CacheFactory.getCluster(); + String MemberID = "Member ID:" + cluster.getLocalMember().getId() + " Cluster name:" + + cluster.getClusterName(); + + System.out.println(MemberID); + environment.reportProgress(50); + + return new Yield(MemberID, 1000); + } + else + { + String messageToReturn = (String) environment.loadCheckpoint(); + + environment.reportProgress(100); + + return messageToReturn; + } + } + + + /** + * {@inheritDoc} + */ + public String toString() + { + return "TestTask:" + getType() + ": " + m_sMessage; + } + + + /** + * {@inheritDoc} + */ + public String getType() + { + return ""; + } +} diff --git a/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-extend-taskprocessing-cache-config.xml b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-extend-taskprocessing-cache-config.xml new file mode 100755 index 00000000..32ea3ad2 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-extend-taskprocessing-cache-config.xml @@ -0,0 +1,67 @@ + + + + + + + coherence.patterns.processing.* + extend-dist + + + + + + extend-dist + + + com.tangosol.io.pof.ConfigurablePofContext + + + + +
localhost
+ 20020 +
+
+ 10s +
+
+ + + + + single + + +
+
+
\ No newline at end of file diff --git a/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-extendclient-cache-config.xml b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-extendclient-cache-config.xml new file mode 100755 index 00000000..0fcc9f46 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-extendclient-cache-config.xml @@ -0,0 +1,63 @@ + + + + + + pof + + + + + + coherence.patterns.processing.* + extend-dist + + + + + + extend-dist + + + + +
localhost
+ 10000 +
+
+
+ 10s +
+
+
+
+ diff --git a/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-grid-server-cache-config.xml b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-grid-server-cache-config.xml new file mode 100755 index 00000000..e935b611 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-grid-server-cache-config.xml @@ -0,0 +1,67 @@ + + +> + + + + ExtendTcpProxyService + + + +
localhost
+ 10000 +
+
+
+ true +
+
+ + + + + + + + + + + + + + + + + grid + + + +
\ No newline at end of file diff --git a/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-pof-config.xml b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-pof-config.xml new file mode 100755 index 00000000..c93567f3 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-pof-config.xml @@ -0,0 +1,63 @@ + + + + + + coherence-pof-config.xml + coherence-common-pof-config.xml + coherence-processingpattern-pof-config.xml + + + + 16500 + com.oracle.coherence.patterns.processing.task.TestTask + + + + + 16501 + com.oracle.coherence.patterns.processing.callable.SimpleCallable + + + + + 16502 + com.oracle.coherence.patterns.processing.runnable.DoNothingRunnable + + + + + 16503 + com.oracle.coherence.patterns.processing.task.CancelableTask + + + + + + + diff --git a/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-proxy-cache-config.xml b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-proxy-cache-config.xml new file mode 100755 index 00000000..a4d437a3 --- /dev/null +++ b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-proxy-cache-config.xml @@ -0,0 +1,59 @@ + + +> + + + + ExtendTcpProxyService + + + +
localhost
+ 10000 +
+
+
+ true +
+
+ + + + + + + + + + + + + +
\ No newline at end of file diff --git a/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-single-server-cache-config.xml b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-single-server-cache-config.xml new file mode 100755 index 00000000..68b43d8e --- /dev/null +++ b/coherence-processingpattern-tests/src/test/resources/coherence-processingpattern-test-single-server-cache-config.xml @@ -0,0 +1,73 @@ + + +> + + + + ExtendTcpProxyService + + + +
localhost
+ 10000 +
+
+
+ true +
+
+ + + + + + + + + + + + + + + + + com.oracle.coherence.patterns.processing.taskprocessor.DefaultTaskProcessor + + String Task Processor + 10 + + + single + + + +
\ No newline at end of file