diff --git a/emchat-server-java/src/main/resources/logback.xml b/emchat-server-java/src/main/resources/logback.xml
index 4d1c9dc..08b81d4 100644
--- a/emchat-server-java/src/main/resources/logback.xml
+++ b/emchat-server-java/src/main/resources/logback.xml
@@ -3,7 +3,7 @@
logback
-
+
diff --git a/emchat-server-java/src/test/com/easemob/SendMessageTest.java b/emchat-server-java/src/test/com/easemob/SendMessageTest.java
index 6138bc3..53cbbd5 100644
--- a/emchat-server-java/src/test/com/easemob/SendMessageTest.java
+++ b/emchat-server-java/src/test/com/easemob/SendMessageTest.java
@@ -1,6 +1,8 @@
package com.easemob;
import com.easemob.server.example.api.impl.EasemobSendMessage;
+import com.google.gson.GsonBuilder;
+import com.google.gson.annotations.SerializedName;
import io.swagger.client.model.Msg;
import io.swagger.client.model.MsgContent;
import io.swagger.client.model.UserName;
@@ -13,7 +15,7 @@ public class SendMessageTest {
private EasemobSendMessage easemobSendMessage = new EasemobSendMessage();
@Test
- public void send() {
+ public void sendText() {
Msg msg = new Msg();
MsgContent msgContent = new MsgContent();
msgContent.type(MsgContent.TypeEnum.TXT).msg("helloword");
@@ -23,4 +25,55 @@ public void send() {
Object result = easemobSendMessage.sendMessage(msg);
System.out.println(result);
}
+
+ @Test
+ public void sendImage() {
+ Msg msg = new Msg();
+ ImageMsgContent msgContent = new ImageMsgContent();
+ msgContent.url("http://test_url").secret("test_sec").filename("filename").size(new ImageMsgContent.Size(480, 720))
+ .type(MsgContent.TypeEnum.IMG).msg("this is an image message");
+ UserName userName = new UserName();
+ userName.add("receiver");
+ msg.from("sender").target(userName).targetType("users").msg(msgContent);
+ System.out.println(new GsonBuilder().create().toJson(msg));
+ Object result = easemobSendMessage.sendMessage(msg);
+ System.out.println(result);
+ }
+
+ static class ImageMsgContent extends MsgContent {
+ private String url;
+ private String filename;
+ private String secret;
+ private Size size;
+
+ ImageMsgContent url(String url) {
+ this.url = url;
+ return this;
+ }
+
+ ImageMsgContent filename(String filename) {
+ this.filename = filename;
+ return this;
+ }
+
+ ImageMsgContent secret(String secret) {
+ this.secret = secret;
+ return this;
+ }
+
+ ImageMsgContent size(Size size) {
+ this.size = size;
+ return this;
+ }
+
+ static class Size {
+ private long width;
+ private long height;
+
+ Size(long width, long height) {
+ this.width = width;
+ this.height = height;
+ }
+ }
+ }
}