This commit is contained in:
wentch
2016-01-08 12:34:23 +08:00
parent a7a104e2ea
commit e3080ea872
2 changed files with 31 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.test.sncp;
import org.redkale.service.*;
import org.redkale.source.*;
/**
*
* @author zhangjx
*/
public interface SncpTestIService extends Service {
public void insert(@DynCall(DataCallArrayAttribute.class) SncpTestBean... beans);
public String updateBean(@DynCall(SncpTestService.CallAttribute.class) SncpTestBean bean);
}

View File

@@ -9,17 +9,15 @@ import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import org.redkale.net.sncp.*;
import org.redkale.service.Service;
import org.redkale.service.*;
import org.redkale.util.Attribute;
import org.redkale.service.MultiRun;
import org.redkale.source.DataCallArrayAttribute;
import org.redkale.service.DynCall;
/**
*
* @author zhangjx
*/
public class SncpTestService implements Service {
public class SncpTestService implements SncpTestIService {
public static class CallAttribute implements Attribute<SncpTestBean, Long> {
@@ -71,7 +69,7 @@ public class SncpTestService implements Service {
}
public static void main(String[] args) throws Exception {
SncpTestService service = Sncp.createLocalService("", null, SncpTestService.class, new InetSocketAddress("127.0.0.1", 7070), new HashSet(), null, null);
Service service = Sncp.createLocalService("", null, SncpTestService.class, new InetSocketAddress("127.0.0.1", 7070), new HashSet(), null, null);
for(Method method :service.getClass().getDeclaredMethods()) {
System.out.println(method);
}
@@ -88,6 +86,14 @@ public class SncpTestService implements Service {
for(Method method :SncpClient.parseMethod(service.getClass())) {
System.out.println(method);
}
System.out.println("-----------------------------------");service = Sncp.createRemoteService("", null, SncpTestIService.class, new InetSocketAddress("127.0.0.1", 7070), new HashSet(), null);
for(Method method :service.getClass().getDeclaredMethods()) {
System.out.println(method);
}
System.out.println("-----------------------------------");
for(Method method :SncpClient.parseMethod(service.getClass())) {
System.out.println(method);
}
System.out.println("-----------------------------------");
}
}