Rename ActorProxy invoke to invokeMethod. (#420)

Co-authored-by: Mukundan Sundararajan <musundar@microsoft.com>
Co-authored-by: Artur Souza <artursouza.ms@outlook.com>
This commit is contained in:
kerr 2020-12-19 06:41:16 +08:00 committed by GitHub
parent a35e41480e
commit 3b51b5b6c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 147 additions and 147 deletions

View File

@ -36,7 +36,7 @@ public interface ActorProxy {
* @param <T> The type to be returned. * @param <T> The type to be returned.
* @return Asynchronous result with the Actor's response. * @return Asynchronous result with the Actor's response.
*/ */
<T> Mono<T> invoke(String methodName, TypeRef<T> type); <T> Mono<T> invokeMethod(String methodName, TypeRef<T> type);
/** /**
* Invokes an Actor method on Dapr. * Invokes an Actor method on Dapr.
@ -46,7 +46,7 @@ public interface ActorProxy {
* @param <T> The type to be returned. * @param <T> The type to be returned.
* @return Asynchronous result with the Actor's response. * @return Asynchronous result with the Actor's response.
*/ */
<T> Mono<T> invoke(String methodName, Class<T> clazz); <T> Mono<T> invokeMethod(String methodName, Class<T> clazz);
/** /**
* Invokes an Actor method on Dapr. * Invokes an Actor method on Dapr.
@ -57,7 +57,7 @@ public interface ActorProxy {
* @param <T> The type to be returned. * @param <T> The type to be returned.
* @return Asynchronous result with the Actor's response. * @return Asynchronous result with the Actor's response.
*/ */
<T> Mono<T> invoke(String methodName, Object data, TypeRef<T> type); <T> Mono<T> invokeMethod(String methodName, Object data, TypeRef<T> type);
/** /**
* Invokes an Actor method on Dapr. * Invokes an Actor method on Dapr.
@ -68,7 +68,7 @@ public interface ActorProxy {
* @param <T> The type to be returned. * @param <T> The type to be returned.
* @return Asynchronous result with the Actor's response. * @return Asynchronous result with the Actor's response.
*/ */
<T> Mono<T> invoke(String methodName, Object data, Class<T> clazz); <T> Mono<T> invokeMethod(String methodName, Object data, Class<T> clazz);
/** /**
* Invokes an Actor method on Dapr. * Invokes an Actor method on Dapr.
@ -76,7 +76,7 @@ public interface ActorProxy {
* @param methodName Method name to invoke. * @param methodName Method name to invoke.
* @return Asynchronous result with the Actor's response. * @return Asynchronous result with the Actor's response.
*/ */
Mono<Void> invoke(String methodName); Mono<Void> invokeMethod(String methodName);
/** /**
* Invokes an Actor method on Dapr. * Invokes an Actor method on Dapr.
@ -85,6 +85,6 @@ public interface ActorProxy {
* @param data Object with the data. * @param data Object with the data.
* @return Asynchronous result with the Actor's response. * @return Asynchronous result with the Actor's response.
*/ */
Mono<Void> invoke(String methodName, Object data); Mono<Void> invokeMethod(String methodName, Object data);
} }

View File

@ -74,7 +74,7 @@ class ActorProxyImpl implements ActorProxy, InvocationHandler {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public <T> Mono<T> invoke(String methodName, Object data, TypeRef<T> type) { public <T> Mono<T> invokeMethod(String methodName, Object data, TypeRef<T> type) {
return this.daprClient.invoke(actorType, actorId.toString(), methodName, this.serialize(data)) return this.daprClient.invoke(actorType, actorId.toString(), methodName, this.serialize(data))
.filter(s -> s.length > 0) .filter(s -> s.length > 0)
.map(s -> deserialize(s, type)); .map(s -> deserialize(s, type));
@ -84,15 +84,15 @@ class ActorProxyImpl implements ActorProxy, InvocationHandler {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public <T> Mono<T> invoke(String methodName, Object data, Class<T> clazz) { public <T> Mono<T> invokeMethod(String methodName, Object data, Class<T> clazz) {
return this.invoke(methodName, data, TypeRef.get(clazz)); return this.invokeMethod(methodName, data, TypeRef.get(clazz));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public <T> Mono<T> invoke(String methodName, TypeRef<T> type) { public <T> Mono<T> invokeMethod(String methodName, TypeRef<T> type) {
return this.daprClient.invoke(actorType, actorId.toString(), methodName, null) return this.daprClient.invoke(actorType, actorId.toString(), methodName, null)
.filter(s -> s.length > 0) .filter(s -> s.length > 0)
.map(s -> deserialize(s, type)); .map(s -> deserialize(s, type));
@ -102,15 +102,15 @@ class ActorProxyImpl implements ActorProxy, InvocationHandler {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public <T> Mono<T> invoke(String methodName, Class<T> clazz) { public <T> Mono<T> invokeMethod(String methodName, Class<T> clazz) {
return this.invoke(methodName, TypeRef.get(clazz)); return this.invokeMethod(methodName, TypeRef.get(clazz));
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Mono<Void> invoke(String methodName) { public Mono<Void> invokeMethod(String methodName) {
return this.daprClient.invoke(actorType, actorId.toString(), methodName, null).then(); return this.daprClient.invoke(actorType, actorId.toString(), methodName, null).then();
} }
@ -118,7 +118,7 @@ class ActorProxyImpl implements ActorProxy, InvocationHandler {
* {@inheritDoc} * {@inheritDoc}
*/ */
@Override @Override
public Mono<Void> invoke(String methodName, Object data) { public Mono<Void> invokeMethod(String methodName, Object data) {
return this.daprClient.invoke(actorType, actorId.toString(), methodName, this.serialize(data)).then(); return this.daprClient.invoke(actorType, actorId.toString(), methodName, this.serialize(data)).then();
} }
@ -140,25 +140,25 @@ class ActorProxyImpl implements ActorProxy, InvocationHandler {
if (method.getReturnType().equals(Mono.class)) { if (method.getReturnType().equals(Mono.class)) {
ActorMethod actorMethodAnnotation = method.getDeclaredAnnotation(ActorMethod.class); ActorMethod actorMethodAnnotation = method.getDeclaredAnnotation(ActorMethod.class);
if (actorMethodAnnotation == null) { if (actorMethodAnnotation == null) {
return invoke(method.getName()); return invokeMethod(method.getName());
} }
return invoke(method.getName(), actorMethodAnnotation.returns()); return invokeMethod(method.getName(), actorMethodAnnotation.returns());
} }
return invoke(method.getName(), method.getReturnType()).block(); return invokeMethod(method.getName(), method.getReturnType()).block();
} }
if (method.getReturnType().equals(Mono.class)) { if (method.getReturnType().equals(Mono.class)) {
ActorMethod actorMethodAnnotation = method.getDeclaredAnnotation(ActorMethod.class); ActorMethod actorMethodAnnotation = method.getDeclaredAnnotation(ActorMethod.class);
if (actorMethodAnnotation == null) { if (actorMethodAnnotation == null) {
return invoke(method.getName(), args[0]); return invokeMethod(method.getName(), args[0]);
} }
return invoke(method.getName(), args[0], actorMethodAnnotation.returns()); return invokeMethod(method.getName(), args[0], actorMethodAnnotation.returns());
} }
return invoke(method.getName(), args[0], method.getReturnType()).block(); return invokeMethod(method.getName(), args[0], method.getReturnType()).block();
} }
/** /**

View File

@ -49,7 +49,7 @@ public class ActorProxyImplTest {
new DefaultObjectSerializer(), new DefaultObjectSerializer(),
daprClient); daprClient);
Mono<MyData> result = actorProxy.invoke("getData", MyData.class); Mono<MyData> result = actorProxy.invokeMethod("getData", MyData.class);
MyData myData = result.block(); MyData myData = result.block();
Assert.assertNotNull(myData); Assert.assertNotNull(myData);
Assert.assertEquals("valueA", myData.getPropertyA()); Assert.assertEquals("valueA", myData.getPropertyA());
@ -260,7 +260,7 @@ public class ActorProxyImplTest {
new DefaultObjectSerializer(), new DefaultObjectSerializer(),
daprClient); daprClient);
Mono<MyData> result = actorProxy.invoke("getData", MyData.class); Mono<MyData> result = actorProxy.invokeMethod("getData", MyData.class);
MyData myData = result.block(); MyData myData = result.block();
Assert.assertNull(myData); Assert.assertNull(myData);
} }
@ -277,7 +277,7 @@ public class ActorProxyImplTest {
new DefaultObjectSerializer(), new DefaultObjectSerializer(),
daprClient); daprClient);
Mono<MyData> result = actorProxy.invoke("getData", MyData.class); Mono<MyData> result = actorProxy.invokeMethod("getData", MyData.class);
result.doOnSuccess(x -> result.doOnSuccess(x ->
Assert.fail("Not exception was throw")) Assert.fail("Not exception was throw"))
@ -302,7 +302,7 @@ public class ActorProxyImplTest {
saveData.setPropertyA("valueA"); saveData.setPropertyA("valueA");
saveData.setPropertyB("valueB"); saveData.setPropertyB("valueB");
Mono<MyData> result = actorProxy.invoke("getData", saveData, MyData.class); Mono<MyData> result = actorProxy.invokeMethod("getData", saveData, MyData.class);
MyData myData = result.block(); MyData myData = result.block();
Assert.assertNotNull(myData); Assert.assertNotNull(myData);
Assert.assertEquals("valueA", myData.getPropertyA()); Assert.assertEquals("valueA", myData.getPropertyA());
@ -326,7 +326,7 @@ public class ActorProxyImplTest {
saveData.setPropertyA("valueA"); saveData.setPropertyA("valueA");
saveData.setPropertyB("valueB"); saveData.setPropertyB("valueB");
Mono<MyData> result = actorProxy.invoke("getData", saveData, MyData.class); Mono<MyData> result = actorProxy.invokeMethod("getData", saveData, MyData.class);
result.doOnSuccess(x -> result.doOnSuccess(x ->
Assert.fail("Not exception was throw")) Assert.fail("Not exception was throw"))
.doOnError(Throwable::printStackTrace .doOnError(Throwable::printStackTrace
@ -350,7 +350,7 @@ public class ActorProxyImplTest {
saveData.setPropertyA("valueA"); saveData.setPropertyA("valueA");
saveData.setPropertyB("valueB"); saveData.setPropertyB("valueB");
Mono<MyData> result = actorProxy.invoke("getData", saveData, MyData.class); Mono<MyData> result = actorProxy.invokeMethod("getData", saveData, MyData.class);
MyData myData = result.block(); MyData myData = result.block();
Assert.assertNull(myData); Assert.assertNull(myData);
} }
@ -373,7 +373,7 @@ public class ActorProxyImplTest {
saveData.setPropertyB("valueB"); saveData.setPropertyB("valueB");
saveData.setMyData(saveData); saveData.setMyData(saveData);
Mono<MyData> result = actorProxy.invoke("getData", saveData, MyData.class); Mono<MyData> result = actorProxy.invokeMethod("getData", saveData, MyData.class);
result.doOnSuccess(x -> result.doOnSuccess(x ->
Assert.fail("Not exception was throw")) Assert.fail("Not exception was throw"))
.doOnError(Throwable::printStackTrace .doOnError(Throwable::printStackTrace
@ -397,7 +397,7 @@ public class ActorProxyImplTest {
new DefaultObjectSerializer(), new DefaultObjectSerializer(),
daprClient); daprClient);
Mono<Void> result = actorProxy.invoke("getData", saveData); Mono<Void> result = actorProxy.invokeMethod("getData", saveData);
Void emptyResponse = result.block(); Void emptyResponse = result.block();
Assert.assertNull(emptyResponse); Assert.assertNull(emptyResponse);
} }
@ -420,7 +420,7 @@ public class ActorProxyImplTest {
new DefaultObjectSerializer(), new DefaultObjectSerializer(),
daprClient); daprClient);
Mono<Void> result = actorProxy.invoke("getData", saveData); Mono<Void> result = actorProxy.invokeMethod("getData", saveData);
Void emptyResponse = result.doOnError(Throwable::printStackTrace).block(); Void emptyResponse = result.doOnError(Throwable::printStackTrace).block();
Assert.assertNull(emptyResponse); Assert.assertNull(emptyResponse);
} }
@ -437,7 +437,7 @@ public class ActorProxyImplTest {
new DefaultObjectSerializer(), new DefaultObjectSerializer(),
daprClient); daprClient);
Mono<Void> result = actorProxy.invoke("getData"); Mono<Void> result = actorProxy.invokeMethod("getData");
Void emptyResponse = result.block(); Void emptyResponse = result.block();
Assert.assertNull(emptyResponse); Assert.assertNull(emptyResponse);
} }

View File

@ -98,7 +98,7 @@ public class ActorCustomSerializerTest {
ActorProxy actorProxy = createActorProxy(); ActorProxy actorProxy = createActorProxy();
MyData d = new MyData("hi", 3); MyData d = new MyData("hi", 3);
MyData response = actorProxy.invoke("classInClassOut", d, MyData.class).block(); MyData response = actorProxy.invokeMethod("classInClassOut", d, MyData.class).block();
Assert.assertEquals("hihi", response.getName()); Assert.assertEquals("hihi", response.getName());
Assert.assertEquals(6, response.getNum()); Assert.assertEquals(6, response.getNum());
@ -107,7 +107,7 @@ public class ActorCustomSerializerTest {
@Test @Test
public void stringInStringOut() { public void stringInStringOut() {
ActorProxy actorProxy = createActorProxy(); ActorProxy actorProxy = createActorProxy();
String response = actorProxy.invoke("stringInStringOut", "oi", String.class).block(); String response = actorProxy.invokeMethod("stringInStringOut", "oi", String.class).block();
Assert.assertEquals("oioi", response); Assert.assertEquals("oioi", response);
} }
@ -115,7 +115,7 @@ public class ActorCustomSerializerTest {
@Test @Test
public void intInIntOut() { public void intInIntOut() {
ActorProxy actorProxy = createActorProxy(); ActorProxy actorProxy = createActorProxy();
int response = actorProxy.invoke("intInIntOut", 2, int.class).block(); int response = actorProxy.invokeMethod("intInIntOut", 2, int.class).block();
Assert.assertEquals(4, response); Assert.assertEquals(4, response);
} }

View File

@ -139,7 +139,7 @@ public class ActorNoStateTest {
Assert.assertEquals( Assert.assertEquals(
proxy.getActorId().toString(), proxy.getActorId().toString(),
proxy.invoke("getMyId", String.class).block()); proxy.invokeMethod("getMyId", String.class).block());
} }
@Test @Test
@ -149,7 +149,7 @@ public class ActorNoStateTest {
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
Assert.assertEquals( Assert.assertEquals(
"abcabc", "abcabc",
proxy.invoke("stringInStringOut", "abc", String.class).block()); proxy.invokeMethod("stringInStringOut", "abc", String.class).block());
} }
@Test @Test
@ -159,11 +159,11 @@ public class ActorNoStateTest {
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
Assert.assertEquals( Assert.assertEquals(
false, false,
proxy.invoke("stringInBooleanOut", "hello world", Boolean.class).block()); proxy.invokeMethod("stringInBooleanOut", "hello world", Boolean.class).block());
Assert.assertEquals( Assert.assertEquals(
true, true,
proxy.invoke("stringInBooleanOut", "true", Boolean.class).block()); proxy.invokeMethod("stringInBooleanOut", "true", Boolean.class).block());
} }
@Test(expected = IllegalMonitorStateException.class) @Test(expected = IllegalMonitorStateException.class)
@ -171,7 +171,7 @@ public class ActorNoStateTest {
ActorProxy actorProxy = createActorProxy(); ActorProxy actorProxy = createActorProxy();
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
actorProxy.invoke("stringInVoidOutIntentionallyThrows", "hello world").block(); actorProxy.invokeMethod("stringInVoidOutIntentionallyThrows", "hello world").block();
} }
@Test @Test
@ -180,7 +180,7 @@ public class ActorNoStateTest {
MyData d = new MyData("hi", 3); MyData d = new MyData("hi", 3);
// this should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // this should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
MyData response = actorProxy.invoke("classInClassOut", d, MyData.class).block(); MyData response = actorProxy.invokeMethod("classInClassOut", d, MyData.class).block();
Assert.assertEquals( Assert.assertEquals(
"hihi", "hihi",

View File

@ -289,33 +289,33 @@ public class ActorStatefulTest {
public void happyGetSetDeleteContains() { public void happyGetSetDeleteContains() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertEquals( Assert.assertEquals(
proxy.getActorId().toString(), proxy.invoke("getIdString", String.class).block()); proxy.getActorId().toString(), proxy.invokeMethod("getIdString", String.class).block());
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
proxy.invoke("setMessage", "hello world").block(); proxy.invokeMethod("setMessage", "hello world").block();
Assert.assertTrue(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("hasMessage", Boolean.class).block());
Assert.assertEquals( Assert.assertEquals(
"hello world", proxy.invoke("getMessage", String.class).block()); "hello world", proxy.invokeMethod("getMessage", String.class).block());
Assert.assertEquals( Assert.assertEquals(
executeSayMethod("hello world"), executeSayMethod("hello world"),
proxy.invoke("setMessage", "hello world", String.class).block()); proxy.invokeMethod("setMessage", "hello world", String.class).block());
proxy.invoke("deleteMessage").block(); proxy.invokeMethod("deleteMessage").block();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
} }
@Test(expected = IllegalStateException.class) @Test(expected = IllegalStateException.class)
public void lazyGet() { public void lazyGet() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
proxy.invoke("setMessage", "first message").block(); proxy.invokeMethod("setMessage", "first message").block();
// Creates the mono plan but does not call it yet. // Creates the mono plan but does not call it yet.
Mono<String> getMessageCall = proxy.invoke("getMessage", String.class); Mono<String> getMessageCall = proxy.invokeMethod("getMessage", String.class);
proxy.invoke("deleteMessage").block(); proxy.invokeMethod("deleteMessage").block();
// Call should fail because the message was deleted. // Call should fail because the message was deleted.
getMessageCall.block(); getMessageCall.block();
@ -324,96 +324,96 @@ public class ActorStatefulTest {
@Test @Test
public void lazySet() { public void lazySet() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
// Creates the mono plan but does not call it yet. // Creates the mono plan but does not call it yet.
Mono<Void> setMessageCall = proxy.invoke("setMessage", "first message"); Mono<Void> setMessageCall = proxy.invokeMethod("setMessage", "first message");
// No call executed yet, so message should not be set. // No call executed yet, so message should not be set.
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
setMessageCall.block(); setMessageCall.block();
// Now the message has been set. // Now the message has been set.
Assert.assertTrue(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("hasMessage", Boolean.class).block());
} }
@Test @Test
public void lazyContains() { public void lazyContains() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
// Creates the mono plan but does not call it yet. // Creates the mono plan but does not call it yet.
Mono<Boolean> hasMessageCall = proxy.invoke("hasMessage", Boolean.class); Mono<Boolean> hasMessageCall = proxy.invokeMethod("hasMessage", Boolean.class);
// Sets the message. // Sets the message.
proxy.invoke("setMessage", "hello world").block(); proxy.invokeMethod("setMessage", "hello world").block();
// Now we check if message is set. // Now we check if message is set.
hasMessageCall.block(); hasMessageCall.block();
// Now the message should be set. // Now the message should be set.
Assert.assertTrue(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("hasMessage", Boolean.class).block());
} }
@Test @Test
public void lazyDelete() { public void lazyDelete() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
proxy.invoke("setMessage", "first message").block(); proxy.invokeMethod("setMessage", "first message").block();
// Message is set. // Message is set.
Assert.assertTrue(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("hasMessage", Boolean.class).block());
// Created the mono plan but does not execute it yet. // Created the mono plan but does not execute it yet.
Mono<Void> deleteMessageCall = proxy.invoke("deleteMessage"); Mono<Void> deleteMessageCall = proxy.invokeMethod("deleteMessage");
// Message is still set. // Message is still set.
Assert.assertTrue(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("hasMessage", Boolean.class).block());
deleteMessageCall.block(); deleteMessageCall.block();
// Now message is not set. // Now message is not set.
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
} }
@Test @Test
public void lazyAdd() { public void lazyAdd() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
proxy.invoke("setMessage", "first message").block(); proxy.invokeMethod("setMessage", "first message").block();
// Message is set. // Message is set.
Assert.assertTrue(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("hasMessage", Boolean.class).block());
// Created the mono plan but does not execute it yet. // Created the mono plan but does not execute it yet.
Mono<Void> addMessageCall = proxy.invoke("addMessage", "second message"); Mono<Void> addMessageCall = proxy.invokeMethod("addMessage", "second message");
// Message is still set. // Message is still set.
Assert.assertEquals("first message", Assert.assertEquals("first message",
proxy.invoke("getMessage", String.class).block()); proxy.invokeMethod("getMessage", String.class).block());
// Delete message // Delete message
proxy.invoke("deleteMessage").block(); proxy.invokeMethod("deleteMessage").block();
// Should work since previous message was deleted. // Should work since previous message was deleted.
addMessageCall.block(); addMessageCall.block();
// New message is still set. // New message is still set.
Assert.assertEquals("second message", Assert.assertEquals("second message",
proxy.invoke("getMessage", String.class).block()); proxy.invokeMethod("getMessage", String.class).block());
} }
@Test @Test
public void onActivateAndOnDeactivate() { public void onActivateAndOnDeactivate() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertTrue(proxy.invoke("isActive", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("isActive", Boolean.class).block());
Assert.assertFalse(DEACTIVATED_ACTOR_IDS.contains(proxy.getActorId().toString())); Assert.assertFalse(DEACTIVATED_ACTOR_IDS.contains(proxy.getActorId().toString()));
proxy.invoke("hasMessage", Boolean.class).block(); proxy.invokeMethod("hasMessage", Boolean.class).block();
this.manager.deactivateActor(proxy.getActorId()).block(); this.manager.deactivateActor(proxy.getActorId()).block();
@ -424,15 +424,15 @@ public class ActorStatefulTest {
public void onPreMethodAndOnPostMethod() { public void onPreMethodAndOnPostMethod() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
proxy.invoke("hasMessage", Boolean.class).block(); proxy.invokeMethod("hasMessage", Boolean.class).block();
MyMethodContext preContext = MyMethodContext preContext =
proxy.invoke("getPreCallMethodContext", MyMethodContext.class).block(); proxy.invokeMethod("getPreCallMethodContext", MyMethodContext.class).block();
Assert.assertEquals("hasMessage", preContext.getName()); Assert.assertEquals("hasMessage", preContext.getName());
Assert.assertEquals(ActorCallType.ACTOR_INTERFACE_METHOD.toString(), preContext.getType()); Assert.assertEquals(ActorCallType.ACTOR_INTERFACE_METHOD.toString(), preContext.getType());
MyMethodContext postContext = MyMethodContext postContext =
proxy.invoke("getPostCallMethodContext", MyMethodContext.class).block(); proxy.invokeMethod("getPostCallMethodContext", MyMethodContext.class).block();
Assert.assertEquals("hasMessage", postContext.getName()); Assert.assertEquals("hasMessage", postContext.getName());
Assert.assertEquals(ActorCallType.ACTOR_INTERFACE_METHOD.toString(), postContext.getType()); Assert.assertEquals(ActorCallType.ACTOR_INTERFACE_METHOD.toString(), postContext.getType());
} }
@ -444,12 +444,12 @@ public class ActorStatefulTest {
this.manager.invokeTimer(proxy.getActorId(), "mytimer", "{ \"callback\": \"hasMessage\" }".getBytes()).block(); this.manager.invokeTimer(proxy.getActorId(), "mytimer", "{ \"callback\": \"hasMessage\" }".getBytes()).block();
MyMethodContext preContext = MyMethodContext preContext =
proxy.invoke("getPreCallMethodContext", MyMethodContext.class).block(); proxy.invokeMethod("getPreCallMethodContext", MyMethodContext.class).block();
Assert.assertEquals("mytimer", preContext.getName()); Assert.assertEquals("mytimer", preContext.getName());
Assert.assertEquals(ActorCallType.TIMER_METHOD.toString(), preContext.getType()); Assert.assertEquals(ActorCallType.TIMER_METHOD.toString(), preContext.getType());
MyMethodContext postContext = MyMethodContext postContext =
proxy.invoke("getPostCallMethodContext", MyMethodContext.class).block(); proxy.invokeMethod("getPostCallMethodContext", MyMethodContext.class).block();
Assert.assertEquals("mytimer", postContext.getName()); Assert.assertEquals("mytimer", postContext.getName());
Assert.assertEquals(ActorCallType.TIMER_METHOD.toString(), postContext.getType()); Assert.assertEquals(ActorCallType.TIMER_METHOD.toString(), postContext.getType());
} }
@ -467,7 +467,7 @@ public class ActorStatefulTest {
public void invokeTimerAfterUnregister() { public void invokeTimerAfterUnregister() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
proxy.invoke("unregisterTimerAndReminder").block(); proxy.invokeMethod("unregisterTimerAndReminder").block();
// This call succeeds because the SDK does not control register/unregister timer, the Dapr runtime does. // This call succeeds because the SDK does not control register/unregister timer, the Dapr runtime does.
this.manager.invokeTimer(proxy.getActorId(), "mytimer", "{ \"callback\": \"hasMessage\" }".getBytes()).block(); this.manager.invokeTimer(proxy.getActorId(), "mytimer", "{ \"callback\": \"hasMessage\" }".getBytes()).block();
@ -490,12 +490,12 @@ public class ActorStatefulTest {
this.manager.invokeReminder(proxy.getActorId(), "myreminder", params).block(); this.manager.invokeReminder(proxy.getActorId(), "myreminder", params).block();
MyMethodContext preContext = MyMethodContext preContext =
proxy.invoke("getPreCallMethodContext", MyMethodContext.class).block(); proxy.invokeMethod("getPreCallMethodContext", MyMethodContext.class).block();
Assert.assertEquals("myreminder", preContext.getName()); Assert.assertEquals("myreminder", preContext.getName());
Assert.assertEquals(ActorCallType.REMINDER_METHOD.toString(), preContext.getType()); Assert.assertEquals(ActorCallType.REMINDER_METHOD.toString(), preContext.getType());
MyMethodContext postContext = MyMethodContext postContext =
proxy.invoke("getPostCallMethodContext", MyMethodContext.class).block(); proxy.invokeMethod("getPostCallMethodContext", MyMethodContext.class).block();
Assert.assertEquals("myreminder", postContext.getName()); Assert.assertEquals("myreminder", postContext.getName());
Assert.assertEquals(ActorCallType.REMINDER_METHOD.toString(), postContext.getType()); Assert.assertEquals(ActorCallType.REMINDER_METHOD.toString(), postContext.getType());
} }
@ -517,8 +517,8 @@ public class ActorStatefulTest {
MyMethodContext expectedContext = new MyMethodContext().setName("MyName").setType("MyType"); MyMethodContext expectedContext = new MyMethodContext().setName("MyName").setType("MyType");
proxy.invoke("setMethodContext", expectedContext).block(); proxy.invokeMethod("setMethodContext", expectedContext).block();
MyMethodContext context = proxy.invoke("getMethodContext", MyMethodContext.class).block(); MyMethodContext context = proxy.invokeMethod("getMethodContext", MyMethodContext.class).block();
Assert.assertEquals(expectedContext.getName(), context.getName()); Assert.assertEquals(expectedContext.getName(), context.getName());
Assert.assertEquals(expectedContext.getType(), context.getType()); Assert.assertEquals(expectedContext.getType(), context.getType());
@ -528,8 +528,8 @@ public class ActorStatefulTest {
public void intTypeRequestResponseInStateStore() { public void intTypeRequestResponseInStateStore() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertEquals(1, (int)proxy.invoke("incrementAndGetCount", 1, int.class).block()); Assert.assertEquals(1, (int)proxy.invokeMethod("incrementAndGetCount", 1, int.class).block());
Assert.assertEquals(6, (int)proxy.invoke("incrementAndGetCount", 5, int.class).block()); Assert.assertEquals(6, (int)proxy.invokeMethod("incrementAndGetCount", 5, int.class).block());
} }
@Test(expected = NumberFormatException.class) @Test(expected = NumberFormatException.class)
@ -537,68 +537,68 @@ public class ActorStatefulTest {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
// Zero is a magic input that will make method throw an exception. // Zero is a magic input that will make method throw an exception.
proxy.invoke("incrementAndGetCount", 0, int.class).block(); proxy.invokeMethod("incrementAndGetCount", 0, int.class).block();
} }
@Test(expected = IllegalStateException.class) @Test(expected = IllegalStateException.class)
public void intTypeWithRuntimeException() { public void intTypeWithRuntimeException() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
proxy.invoke("getCountButThrowsException", int.class).block(); proxy.invokeMethod("getCountButThrowsException", int.class).block();
} }
@Test(expected = IllegalStateException.class) @Test(expected = IllegalStateException.class)
public void actorRuntimeException() { public void actorRuntimeException() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
proxy.invoke("forceDuplicateException").block(); proxy.invokeMethod("forceDuplicateException").block();
} }
@Test(expected = IllegalCharsetNameException.class) @Test(expected = IllegalCharsetNameException.class)
public void actorMethodException() { public void actorMethodException() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
proxy.invoke("throwsWithoutSaving").block(); proxy.invokeMethod("throwsWithoutSaving").block();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
} }
@Test @Test
public void rollbackChanges() { public void rollbackChanges() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
// Runs a method that will add one message but fail because tries to add a second one. // Runs a method that will add one message but fail because tries to add a second one.
proxy.invoke("forceDuplicateException") proxy.invokeMethod("forceDuplicateException")
.onErrorResume(throwable -> Mono.empty()) .onErrorResume(throwable -> Mono.empty())
.block(); .block();
// No message is set // No message is set
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
} }
@Test @Test
public void partialChanges() { public void partialChanges() {
ActorProxy proxy = newActorProxy(); ActorProxy proxy = newActorProxy();
Assert.assertFalse(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertFalse(proxy.invokeMethod("hasMessage", Boolean.class).block());
// Runs a method that will add one message, commit but fail because tries to add a second one. // Runs a method that will add one message, commit but fail because tries to add a second one.
proxy.invoke("forcePartialChange") proxy.invokeMethod("forcePartialChange")
.onErrorResume(throwable -> Mono.empty()) .onErrorResume(throwable -> Mono.empty())
.block(); .block();
// Message is set. // Message is set.
Assert.assertTrue(proxy.invoke("hasMessage", Boolean.class).block()); Assert.assertTrue(proxy.invokeMethod("hasMessage", Boolean.class).block());
// It is first message and not the second due to a save() in the middle but an exception in the end. // It is first message and not the second due to a save() in the middle but an exception in the end.
Assert.assertEquals("first message", Assert.assertEquals("first message",
proxy.invoke("getMessage", String.class).block()); proxy.invokeMethod("getMessage", String.class).block());
} }
private ActorProxy newActorProxy() { private ActorProxy newActorProxy() {

View File

@ -223,7 +223,7 @@ public class DerivedActorTest {
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
Assert.assertEquals( Assert.assertEquals(
"abcabc", "abcabc",
proxy.invoke("stringInStringOut", "abc", String.class).block()); proxy.invokeMethod("stringInStringOut", "abc", String.class).block());
} }
@Test @Test
@ -233,11 +233,11 @@ public class DerivedActorTest {
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
Assert.assertEquals( Assert.assertEquals(
false, false,
proxy.invoke("stringInBooleanOut", "hello world", Boolean.class).block()); proxy.invokeMethod("stringInBooleanOut", "hello world", Boolean.class).block());
Assert.assertEquals( Assert.assertEquals(
true, true,
proxy.invoke("stringInBooleanOut", "true", Boolean.class).block()); proxy.invokeMethod("stringInBooleanOut", "true", Boolean.class).block());
} }
@Test @Test
@ -247,14 +247,14 @@ public class DerivedActorTest {
// stringInVoidOut() has not been invoked so this is false // stringInVoidOut() has not been invoked so this is false
Assert.assertEquals( Assert.assertEquals(
false, false,
actorProxy.invoke("methodReturningVoidInvoked", Boolean.class).block()); actorProxy.invokeMethod("methodReturningVoidInvoked", Boolean.class).block());
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
actorProxy.invoke("stringInVoidOut", "hello world").block(); actorProxy.invokeMethod("stringInVoidOut", "hello world").block();
Assert.assertEquals( Assert.assertEquals(
true, true,
actorProxy.invoke("methodReturningVoidInvoked", Boolean.class).block()); actorProxy.invokeMethod("methodReturningVoidInvoked", Boolean.class).block());
} }
@Test(expected = IllegalMonitorStateException.class) @Test(expected = IllegalMonitorStateException.class)
@ -262,7 +262,7 @@ public class DerivedActorTest {
ActorProxy actorProxy = createActorProxyForActorChild(); ActorProxy actorProxy = createActorProxyForActorChild();
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
actorProxy.invoke("stringInVoidOutIntentionallyThrows", "hello world").block(); actorProxy.invokeMethod("stringInVoidOutIntentionallyThrows", "hello world").block();
} }
@Test @Test
@ -271,7 +271,7 @@ public class DerivedActorTest {
MyData d = new MyData("hi", 3); MyData d = new MyData("hi", 3);
// this should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // this should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
MyData response = actorProxy.invoke("classInClassOut", d, MyData.class).block(); MyData response = actorProxy.invokeMethod("classInClassOut", d, MyData.class).block();
Assert.assertEquals( Assert.assertEquals(
"hihi", "hihi",
@ -288,26 +288,26 @@ public class DerivedActorTest {
Assert.assertEquals( Assert.assertEquals(
"www", "www",
actorProxy.invoke("onlyImplementedInParentStringInStringOut", "w", String.class).block()); actorProxy.invokeMethod("onlyImplementedInParentStringInStringOut", "w", String.class).block());
Assert.assertEquals( Assert.assertEquals(
true, true,
actorProxy.invoke("onlyImplementedInParentStringInBooleanOut", "icecream", Boolean.class).block()); actorProxy.invokeMethod("onlyImplementedInParentStringInBooleanOut", "icecream", Boolean.class).block());
// onlyImplementedInParentStringInVoidOut() has not been invoked so this is false // onlyImplementedInParentStringInVoidOut() has not been invoked so this is false
Assert.assertEquals( Assert.assertEquals(
false, false,
actorProxy.invoke("methodReturningVoidInvoked", Boolean.class).block()); actorProxy.invokeMethod("methodReturningVoidInvoked", Boolean.class).block());
actorProxy.invoke("onlyImplementedInParentStringInVoidOut", "icecream", Boolean.class).block(); actorProxy.invokeMethod("onlyImplementedInParentStringInVoidOut", "icecream", Boolean.class).block();
// now it should return true. // now it should return true.
Assert.assertEquals( Assert.assertEquals(
true, true,
actorProxy.invoke("methodReturningVoidInvoked", Boolean.class).block()); actorProxy.invokeMethod("methodReturningVoidInvoked", Boolean.class).block());
MyData d = new MyData("hi", 3); MyData d = new MyData("hi", 3);
MyData response = actorProxy.invoke("onlyImplementedInParentClassInClassOut", d, MyData.class).block(); MyData response = actorProxy.invokeMethod("onlyImplementedInParentClassInClassOut", d, MyData.class).block();
Assert.assertEquals( Assert.assertEquals(
"hihihi", "hihihi",

View File

@ -121,7 +121,7 @@ public class ThrowFromPreAndPostActorMethodsTest {
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
Assert.assertEquals( Assert.assertEquals(
false, false,
proxy.invoke("stringInBooleanOut", "hello world", Boolean.class).block()); proxy.invokeMethod("stringInBooleanOut", "hello world", Boolean.class).block());
} }
// IllegalMonitorStateException should be intentionally thrown. This type was chosen for this test just because // IllegalMonitorStateException should be intentionally thrown. This type was chosen for this test just because
@ -133,7 +133,7 @@ public class ThrowFromPreAndPostActorMethodsTest {
// these should only call the actor methods for ActorChild. The implementations in ActorParent will throw. // these should only call the actor methods for ActorChild. The implementations in ActorParent will throw.
Assert.assertEquals( Assert.assertEquals(
true, true,
proxy.invoke("stringInBooleanOut", "true", Boolean.class).block()); proxy.invokeMethod("stringInBooleanOut", "true", Boolean.class).block());
} }
private static ActorId newActorId() { private static ActorId newActorId() {

View File

@ -71,7 +71,7 @@ public class ActorReminderFailoverIT extends BaseIT {
public void tearDown() { public void tearDown() {
// call unregister // call unregister
logger.debug("Calling actor method 'stopReminder' to unregister reminder"); logger.debug("Calling actor method 'stopReminder' to unregister reminder");
proxy.invoke("stopReminder", "myReminder").block(); proxy.invokeMethod("stopReminder", "myReminder").block();
} }
/** /**
@ -83,7 +83,7 @@ public class ActorReminderFailoverIT extends BaseIT {
clientAppRun.use(); clientAppRun.use();
logger.debug("Invoking actor method 'startReminder' which will register a reminder"); logger.debug("Invoking actor method 'startReminder' which will register a reminder");
proxy.invoke("startReminder", "myReminder").block(); proxy.invokeMethod("startReminder", "myReminder").block();
logger.debug("Pausing 7 seconds to allow reminder to fire"); logger.debug("Pausing 7 seconds to allow reminder to fire");
Thread.sleep(7000); Thread.sleep(7000);
@ -92,7 +92,7 @@ public class ActorReminderFailoverIT extends BaseIT {
validateMethodCalls(logs, METHOD_NAME, 3); validateMethodCalls(logs, METHOD_NAME, 3);
int originalActorHostIdentifier = Integer.parseInt( int originalActorHostIdentifier = Integer.parseInt(
proxy.invoke("getIdentifier", String.class).block()); proxy.invokeMethod("getIdentifier", String.class).block());
if (originalActorHostIdentifier == firstAppRun.getHttpPort()) { if (originalActorHostIdentifier == firstAppRun.getHttpPort()) {
firstAppRun.stop(); firstAppRun.stop();
} }
@ -110,7 +110,7 @@ public class ActorReminderFailoverIT extends BaseIT {
validateMethodCalls(newLogs2, METHOD_NAME, countMethodCalls(newLogs, METHOD_NAME) + 4); validateMethodCalls(newLogs2, METHOD_NAME, countMethodCalls(newLogs, METHOD_NAME) + 4);
int newActorHostIdentifier = Integer.parseInt( int newActorHostIdentifier = Integer.parseInt(
proxy.invoke("getIdentifier", String.class).block()); proxy.invokeMethod("getIdentifier", String.class).block());
assertNotEquals(originalActorHostIdentifier, newActorHostIdentifier); assertNotEquals(originalActorHostIdentifier, newActorHostIdentifier);
} }

View File

@ -59,7 +59,7 @@ public class ActorReminderRecoveryIT extends BaseIT {
public void tearDown() { public void tearDown() {
// call unregister // call unregister
logger.debug("Calling actor method 'stopReminder' to unregister reminder"); logger.debug("Calling actor method 'stopReminder' to unregister reminder");
proxy.invoke("stopReminder", "myReminder").block(); proxy.invokeMethod("stopReminder", "myReminder").block();
} }
/** /**
@ -69,7 +69,7 @@ public class ActorReminderRecoveryIT extends BaseIT {
@Test @Test
public void reminderRecoveryTest() throws Exception { public void reminderRecoveryTest() throws Exception {
logger.debug("Invoking actor method 'startReminder' which will register a reminder"); logger.debug("Invoking actor method 'startReminder' which will register a reminder");
proxy.invoke("startReminder", "myReminder").block(); proxy.invokeMethod("startReminder", "myReminder").block();
logger.debug("Pausing 7 seconds to allow reminder to fire"); logger.debug("Pausing 7 seconds to allow reminder to fire");
Thread.sleep(7000); Thread.sleep(7000);

View File

@ -76,18 +76,18 @@ public class ActorStateIT extends BaseIT {
// Validate conditional read works. // Validate conditional read works.
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readMessage where data is not present yet ... "); logger.debug("Invoking readMessage where data is not present yet ... ");
String result = proxy.invoke("readMessage", String.class).block(); String result = proxy.invokeMethod("readMessage", String.class).block();
assertNull(result); assertNull(result);
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking writeMessage ... "); logger.debug("Invoking writeMessage ... ");
proxy.invoke("writeMessage", message).block(); proxy.invokeMethod("writeMessage", message).block();
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readMessage where data is probably still cached ... "); logger.debug("Invoking readMessage where data is probably still cached ... ");
String result = proxy.invoke("readMessage", String.class).block(); String result = proxy.invokeMethod("readMessage", String.class).block();
assertEquals(message, result); assertEquals(message, result);
}, 5000); }, 5000);
@ -96,45 +96,45 @@ public class ActorStateIT extends BaseIT {
mydata.value = "My data value."; mydata.value = "My data value.";
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking writeData with object ... "); logger.debug("Invoking writeData with object ... ");
proxy.invoke("writeData", mydata).block(); proxy.invokeMethod("writeData", mydata).block();
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readData where data is probably still cached ... "); logger.debug("Invoking readData where data is probably still cached ... ");
StatefulActor.MyData result = proxy.invoke("readData", StatefulActor.MyData.class).block(); StatefulActor.MyData result = proxy.invokeMethod("readData", StatefulActor.MyData.class).block();
assertEquals(mydata.value, result.value); assertEquals(mydata.value, result.value);
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking writeName ... "); logger.debug("Invoking writeName ... ");
proxy.invoke("writeName", name).block(); proxy.invokeMethod("writeName", name).block();
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readName where data is probably still cached ... "); logger.debug("Invoking readName where data is probably still cached ... ");
String result = proxy.invoke("readName", String.class).block(); String result = proxy.invokeMethod("readName", String.class).block();
assertEquals(name, result); assertEquals(name, result);
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking writeName with empty content... "); logger.debug("Invoking writeName with empty content... ");
proxy.invoke("writeName", "").block(); proxy.invokeMethod("writeName", "").block();
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readName where empty content is probably still cached ... "); logger.debug("Invoking readName where empty content is probably still cached ... ");
String result = proxy.invoke("readName", String.class).block(); String result = proxy.invokeMethod("readName", String.class).block();
assertEquals("", result); assertEquals("", result);
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking writeBytes ... "); logger.debug("Invoking writeBytes ... ");
proxy.invoke("writeBytes", bytes).block(); proxy.invokeMethod("writeBytes", bytes).block();
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readBytes where data is probably still cached ... "); logger.debug("Invoking readBytes where data is probably still cached ... ");
byte[] result = proxy.invoke("readBytes", byte[].class).block(); byte[] result = proxy.invokeMethod("readBytes", byte[].class).block();
assertArrayEquals(bytes, result); assertArrayEquals(bytes, result);
}, 5000); }, 5000);
@ -165,26 +165,26 @@ public class ActorStateIT extends BaseIT {
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readMessage where data is not cached ... "); logger.debug("Invoking readMessage where data is not cached ... ");
String result = newProxy.invoke("readMessage", String.class).block(); String result = newProxy.invokeMethod("readMessage", String.class).block();
assertEquals(message, result); assertEquals(message, result);
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readData where data is not cached ... "); logger.debug("Invoking readData where data is not cached ... ");
StatefulActor.MyData result = newProxy.invoke("readData", StatefulActor.MyData.class).block(); StatefulActor.MyData result = newProxy.invokeMethod("readData", StatefulActor.MyData.class).block();
assertEquals(mydata.value, result.value); assertEquals(mydata.value, result.value);
}, 5000); }, 5000);
logger.debug("Finished testing actor string state."); logger.debug("Finished testing actor string state.");
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readName where empty content is not cached ... "); logger.debug("Invoking readName where empty content is not cached ... ");
String result = newProxy.invoke("readName", String.class).block(); String result = newProxy.invokeMethod("readName", String.class).block();
assertEquals("", result); assertEquals("", result);
}, 5000); }, 5000);
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking readBytes where content is not cached ... "); logger.debug("Invoking readBytes where content is not cached ... ");
byte[] result = newProxy.invoke("readBytes", byte[].class).block(); byte[] result = newProxy.invokeMethod("readBytes", byte[].class).block();
assertArrayEquals(bytes, result); assertArrayEquals(bytes, result);
}, 5000); }, 5000);
} }

View File

@ -54,7 +54,7 @@ public class ActorTimerRecoveryIT extends BaseIT {
ActorProxy proxy = proxyBuilder.build(actorId); ActorProxy proxy = proxyBuilder.build(actorId);
logger.debug("Invoking actor method 'startTimer' which will register a timer"); logger.debug("Invoking actor method 'startTimer' which will register a timer");
proxy.invoke("startTimer", "myTimer").block(); proxy.invokeMethod("startTimer", "myTimer").block();
logger.debug("Pausing 7 seconds to allow timer to fire"); logger.debug("Pausing 7 seconds to allow timer to fire");
Thread.sleep(7000); Thread.sleep(7000);
@ -80,7 +80,7 @@ public class ActorTimerRecoveryIT extends BaseIT {
// call unregister // call unregister
logger.debug("Calling actor method 'stopTimer' to unregister timer"); logger.debug("Calling actor method 'stopTimer' to unregister timer");
proxy.invoke("stopTimer", "myTimer").block(); proxy.invokeMethod("stopTimer", "myTimer").block();
} }
} }

View File

@ -89,13 +89,13 @@ public class ActorTurnBasedConcurrencyIT extends BaseIT {
logger.debug("Invoking Say from Proxy"); logger.debug("Invoking Say from Proxy");
callWithRetry(() -> { callWithRetry(() -> {
logger.debug("Invoking Say from Proxy"); logger.debug("Invoking Say from Proxy");
String sayResponse = proxy.invoke("say", "message", String.class).block(); String sayResponse = proxy.invokeMethod("say", "message", String.class).block();
logger.debug("asserting not null response: [" + sayResponse + "]"); logger.debug("asserting not null response: [" + sayResponse + "]");
assertNotNull(sayResponse); assertNotNull(sayResponse);
}, 60000); }, 60000);
logger.debug("Invoking actor method 'startTimer' which will register a timer"); logger.debug("Invoking actor method 'startTimer' which will register a timer");
proxy.invoke("startTimer", "myTimer").block(); proxy.invokeMethod("startTimer", "myTimer").block();
// invoke a bunch of calls in parallel to validate turn-based concurrency // invoke a bunch of calls in parallel to validate turn-based concurrency
logger.debug("Invoking an actor method 'say' in parallel"); logger.debug("Invoking an actor method 'say' in parallel");
@ -108,12 +108,12 @@ public class ActorTurnBasedConcurrencyIT extends BaseIT {
// the actor method called below should reverse the input // the actor method called below should reverse the input
String msg = "message" + i; String msg = "message" + i;
String reversedString = new StringBuilder(msg).reverse().toString(); String reversedString = new StringBuilder(msg).reverse().toString();
String output = proxy.invoke("say", "message" + i, String.class).block(); String output = proxy.invokeMethod("say", "message" + i, String.class).block();
assertTrue(reversedString.equals(output)); assertTrue(reversedString.equals(output));
}); });
logger.debug("Calling method to register reminder named " + REMINDER_NAME); logger.debug("Calling method to register reminder named " + REMINDER_NAME);
proxy.invoke("startReminder", REMINDER_NAME).block(); proxy.invokeMethod("startReminder", REMINDER_NAME).block();
logger.debug("Pausing 7 seconds to allow timer and reminders to fire"); logger.debug("Pausing 7 seconds to allow timer and reminders to fire");
Thread.sleep(7000); Thread.sleep(7000);
@ -126,14 +126,14 @@ public class ActorTurnBasedConcurrencyIT extends BaseIT {
// call unregister // call unregister
logger.debug("Calling actor method 'stopTimer' to unregister timer"); logger.debug("Calling actor method 'stopTimer' to unregister timer");
proxy.invoke("stopTimer", "myTimer").block(); proxy.invokeMethod("stopTimer", "myTimer").block();
logger.debug("Calling actor method 'stopReminder' to unregister reminder"); logger.debug("Calling actor method 'stopReminder' to unregister reminder");
proxy.invoke("stopReminder", REMINDER_NAME).block(); proxy.invokeMethod("stopReminder", REMINDER_NAME).block();
// make some more actor method calls and sleep a bit to see if the timer fires (it should not) // make some more actor method calls and sleep a bit to see if the timer fires (it should not)
sayMessages.parallelStream().forEach( i -> { sayMessages.parallelStream().forEach( i -> {
proxy.invoke("say", "message" + i, String.class).block(); proxy.invokeMethod("say", "message" + i, String.class).block();
}); });
logger.debug("Pausing 5 seconds to allow time for timer and reminders to fire if there is a bug. They should not since we have unregistered them."); logger.debug("Pausing 5 seconds to allow time for timer and reminders to fire if there is a bug. They should not since we have unregistered them.");

View File

@ -54,7 +54,7 @@ public class MyActorTestUtils {
* @return List of call log. * @return List of call log.
*/ */
static List<MethodEntryTracker> fetchMethodCallLogs(ActorProxy proxy) { static List<MethodEntryTracker> fetchMethodCallLogs(ActorProxy proxy) {
ArrayList<String> logs = proxy.invoke("getCallLog", ArrayList.class).block(); ArrayList<String> logs = proxy.invokeMethod("getCallLog", ArrayList.class).block();
ArrayList<MethodEntryTracker> trackers = new ArrayList<MethodEntryTracker>(); ArrayList<MethodEntryTracker> trackers = new ArrayList<MethodEntryTracker>();
for(String t : logs) { for(String t : logs) {
String[] toks = t.split("\\|"); String[] toks = t.split("\\|");