diff --git a/test/integration/grails_akka/actor/BaseActor.groovy b/test/integration/grails_akka/actor/BaseActor.groovy deleted file mode 100644 index 1fa0b58..0000000 --- a/test/integration/grails_akka/actor/BaseActor.groovy +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.actor - -import akka.actor.UntypedActor -import akka.event.* - - -/** - * Abstract base actor class, to use (when desired) as base class for all other messages here. - */ -public abstract class BaseActor extends UntypedActor -{ - LoggingAdapter log = Logging.getLogger(getContext().system(), this); - - @Override - public void onReceive(Object message) throws Exception - { - // do nothing here ... but override in subclasses - // String messageClassName = message?.getClass()?.getName(); - } - -} diff --git a/test/integration/grails_akka/actor/GreetingActor.groovy b/test/integration/grails_akka/actor/GreetingActor.groovy deleted file mode 100644 index 3007ab7..0000000 --- a/test/integration/grails_akka/actor/GreetingActor.groovy +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.actor - -import akka.actor.UntypedActor -import akka.event.* - -import grails_akka.actor.* -import grails_akka.command.* -import grails_akka.message.* - - -/** - * Greeting actor, as a sample. - *
- * This code is derived from Akka Samples. - */ -public class GreetingActor extends UntypedActor -{ - LoggingAdapter log = Logging.getLogger(getContext().system(), this) - - @Override - public void onReceive(Object message) throws Exception - { - String messageClassName = message?.getClass()?.getName(); - - if (message == null) - { - log.warning("$messageClassName: null message") - unhandled(message) - } - else if (message instanceof Greeting) - { - log.info("$messageClassName: Hello \"" + ((Greeting) message)?.who + "\"") - } - // else if (message instanceof BaseMessage) // but it's abstract ... - // { - // log.info("$messageClassName: Hello BaseMessage instance") - // } - else if (message instanceof Stop) - { - log.info(messageClassName + ": " + "Stop this actor now ...") - // Stops this actor and all its supervised children - getContext().stop(getSelf()) - } - else if (message instanceof Shutdown) - { - log.info(messageClassName + ": " + "Shutdown this akka system now ...") - // Shutdown the entire akka system - getContext.getSystem().shutdown() - } - else if (message instanceof Wait) - { - long sleep = ((Wait) message).msec - log.info(messageClassName + ": " + "Waiting for " + sleep + " milliseconds now ...") - // Sleep this actor for the given time - long startSleep = System.currentTimeMillis() - // sleep this actor - // note that this is not the right way, but should be ok in this small test ... - // because Thread.sleep breaks actors management as it will monopolize all threads of the used executor - Thread.sleep(sleep) - // TODO: probably it's needed something like this - // getContext.getSystem().getScheduler().scheduleOnce(sleep, sender, "Done") - long stopSleep = System.currentTimeMillis() - log.info("Wait: " + "End Waiting, after " + (stopSleep - startSleep) + " milliseconds.") - } - else - { - log.warning("Unknown message type $messageClassName, contents: \"" + message?.toString() + "\"") - unhandled(message) - } - } - -} diff --git a/test/integration/grails_akka/command/ActorCommand.groovy b/test/integration/grails_akka/command/ActorCommand.groovy deleted file mode 100644 index 565e2b6..0000000 --- a/test/integration/grails_akka/command/ActorCommand.groovy +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.command - -import akka.actor.* - -import groovy.transform.* - - -/** - * Command that send the given message to the given actor. - */ -@EqualsAndHashCode -// @Immutable -@ToString -public class ActorCommand implements Command -{ - // read only properties, with public getter generated by Groovy, but not setter - final ActorRef actor; - final Serializable message; - - /** - * Constructor - * - * @param actor - * The Actor Reference, must be not null. - * - * @param message - * The Serializable message to send, must be not null. - */ - public ActorCommand(ActorRef actor, Serializable message) - { - if (actor == null) - throw new IllegalArgumentException("actor must be not null."); - if (message == null) - throw new IllegalArgumentException("message must be not null."); - - this.actor = actor; - this.message = message; - } - - @Override - public void execute() - { - actor.tell(message); - } - -} diff --git a/test/integration/grails_akka/command/Command.groovy b/test/integration/grails_akka/command/Command.groovy deleted file mode 100644 index 2aa6e74..0000000 --- a/test/integration/grails_akka/command/Command.groovy +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.command - -/** - * The Command pattern. - */ -public interface Command -{ - public void execute(); -} diff --git a/test/integration/grails_akka/command/GenericCommand.groovy b/test/integration/grails_akka/command/GenericCommand.groovy deleted file mode 100644 index b254b4c..0000000 --- a/test/integration/grails_akka/command/GenericCommand.groovy +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.command - -/** - * GenericCommand, with command details in the given map. - *
- * Subclass and override the execute method for similar concrete implementation of command. - */ -public class GenericCommand implements Command -{ - // read only property, with public getter generated by Groovy, but not setter - final Map arguments; - - public GenericCommand(Map arguments) - { - if (arguments == null) - throw new IllegalArgumentException("arguments Map must be not null."); - - this.arguments = arguments; - } - - @Override - public void execute() - { - // do nothing here ... but override in subclasses - } - -} diff --git a/test/integration/grails_akka/command/GenericCommandArguments.groovy b/test/integration/grails_akka/command/GenericCommandArguments.groovy deleted file mode 100644 index 33a0af2..0000000 --- a/test/integration/grails_akka/command/GenericCommandArguments.groovy +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.command - -/** - * Enum with standard keys to use as keys (but as Strings) in the GenericCommand arguments map. - */ -public enum GenericCommandArguments -{ - NAME -} diff --git a/test/integration/grails_akka/message/BaseMessage.groovy b/test/integration/grails_akka/message/BaseMessage.groovy deleted file mode 100644 index c02f20c..0000000 --- a/test/integration/grails_akka/message/BaseMessage.groovy +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.message - -/** - * Abstract base message class, to use (when desired) as base class for all other messages here. - *
- * Used a kind of message to send to actors. - *
- * This code is derived from Akka Samples. - */ -public abstract class BaseMessage implements Serializable -{ - - public BaseMessage() - { - } - -} diff --git a/test/integration/grails_akka/message/GenericMessage.groovy b/test/integration/grails_akka/message/GenericMessage.groovy deleted file mode 100644 index 2d9b727..0000000 --- a/test/integration/grails_akka/message/GenericMessage.groovy +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.message - -import groovy.transform.* - - -/** - * GenericMessage. - *
- * Used a kind of message to send to actors. - */ -@EqualsAndHashCode -@ToString -public class GenericMessage extends BaseMessage implements Serializable -{ - // read only property, with public getter generated by Groovy, but not setter - final T message; - - public GenericMessage(T message) - { - this.message = message; - } - -} diff --git a/test/integration/grails_akka/message/Greeting.groovy b/test/integration/grails_akka/message/Greeting.groovy deleted file mode 100644 index d63f786..0000000 --- a/test/integration/grails_akka/message/Greeting.groovy +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.message - -/** - * Greeting message, as a sample. - *
- * Used a kind of message to send to actors. - *
- * This code is derived from Akka Samples. - */ -public class Greeting implements Serializable -{ - public final String who; - - public Greeting(String who) - { - this.who = who; - } - -} diff --git a/test/integration/grails_akka/message/ImmutableMessage.groovy b/test/integration/grails_akka/message/ImmutableMessage.groovy deleted file mode 100644 index 681d7f0..0000000 --- a/test/integration/grails_akka/message/ImmutableMessage.groovy +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.message - -/** - * ImmutableMessage, as a sample. - *
- * Used a kind of message to send to actors. - *
- * This code is derived from Akka Samples. - */ -public class ImmutableMessage -{ - private final int sequenceNumber; - private final List values; - - public ImmutableMessage(int sequenceNumber, List values) - { - this.sequenceNumber = sequenceNumber; - this.values = Collections.unmodifiableList(new ArrayList(values)); - } - - public int getSequenceNumber() { - return sequenceNumber; - } - - public List getValues() { - return values; - } - -} diff --git a/test/integration/grails_akka/message/Shutdown.groovy b/test/integration/grails_akka/message/Shutdown.groovy deleted file mode 100644 index b9cc79e..0000000 --- a/test/integration/grails_akka/message/Shutdown.groovy +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.message - -import groovy.transform.* - - -/** - * Shutdown message, as a sample. - *
- * Used a kind of message to send to actors. - */ -// @EqualsAndHashCode -@Immutable -// @ToString -public class Shutdown extends BaseMessage implements Serializable -{ - -} diff --git a/test/integration/grails_akka/message/Stop.groovy b/test/integration/grails_akka/message/Stop.groovy deleted file mode 100644 index a651301..0000000 --- a/test/integration/grails_akka/message/Stop.groovy +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.message - -import groovy.transform.* - - -/** - * Stop message, as a sample. - *
- * Used a kind of message to send to actors. - */ -// @EqualsAndHashCode -@Immutable -// @ToString -public class Stop extends BaseMessage implements Serializable -{ - -} diff --git a/test/integration/grails_akka/message/Wait.groovy b/test/integration/grails_akka/message/Wait.groovy deleted file mode 100644 index 6582450..0000000 --- a/test/integration/grails_akka/message/Wait.groovy +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package grails_akka.message - -import groovy.transform.* - - -/** - * Waiting message, as a sample. - *
- * Used a kind of message to send to actors. - */ -@EqualsAndHashCode -// @Immutable -@ToString -public class Wait implements Serializable -{ - final long msec; - - public Wait(long msec) - { - // this.msec = (msec < 0) ? 0l : msec; - if (msec < 0) - throw new IllegalArgumentException("Waiting time must be 0 or positive."); - - this.msec = msec; - } - -}