forked from mindlessroman/java-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test multiple reminder state types + improve timer tests. (dapr#855)
Signed-off-by: Artur Souza <[email protected]> Signed-off-by: Mahmut Canga <[email protected]>
- Loading branch information
1 parent
8378bb0
commit 7ade730
Showing
15 changed files
with
395 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
sdk-tests/src/test/java/io/dapr/it/actors/app/ActorReminderDataParam.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright 2021 The Dapr Authors | ||
* Licensed 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 io.dapr.it.actors.app; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.dapr.utils.TypeRef; | ||
|
||
/** | ||
* This class is for passing string or binary data to the Actor for registering reminder later on during test. | ||
*/ | ||
public class ActorReminderDataParam { | ||
|
||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); | ||
|
||
private String data; | ||
|
||
private byte[] binaryData; | ||
|
||
private String typeHint; | ||
|
||
public ActorReminderDataParam() { | ||
} | ||
|
||
public ActorReminderDataParam(String data, String typeHint) { | ||
this.data = data; | ||
this.typeHint = typeHint; | ||
} | ||
|
||
public ActorReminderDataParam(byte[] data, String typeHint) { | ||
this.binaryData = data; | ||
this.typeHint = typeHint; | ||
} | ||
|
||
public String getData() { | ||
return data; | ||
} | ||
|
||
public void setData(String data) { | ||
this.data = data; | ||
} | ||
|
||
public byte[] getBinaryData() { | ||
return binaryData; | ||
} | ||
|
||
public void setBinaryData(byte[] binaryData) { | ||
this.binaryData = binaryData; | ||
} | ||
|
||
public String getTypeHint() { | ||
return typeHint; | ||
} | ||
|
||
public void setTypeHint(String typeHint) { | ||
this.typeHint = typeHint; | ||
} | ||
|
||
public <T> T asObject(TypeRef<T> type) throws Exception { | ||
if (this.data != null) { | ||
return OBJECT_MAPPER.readValue(this.data, OBJECT_MAPPER.constructType(type.getType())); | ||
} else if (this.binaryData != null) { | ||
return OBJECT_MAPPER.readValue(this.binaryData, OBJECT_MAPPER.constructType(type.getType())); | ||
} | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.