Package com.bj58.spat.gaea.server.util

Examples of com.bj58.spat.gaea.server.util.ClassHelper


    Object expect = obj;
    assertNotNull(expect);
  }

  public void TestEqualObject() throws Exception {
    Serializer serializer = new Serializer();
    List<SimpleClass> scs = new ArrayList<SimpleClass>();
    SimpleClass sc = SimpleClass.Get();
    scs.add(sc);
    scs.add(sc);
    byte[] buffer = serializer.Serialize(scs);
    Object obj = serializer.Derialize(buffer, ArrayList.class);
    List<SimpleClass> scs2 = (List<SimpleClass>) obj;
    assertNotNull(scs2);
    assertTrue(scs2.get(0) == scs2.get(1));
  }
View Full Code Here


    assertTrue(scs2.get(0) == scs2.get(1));
  }

  @Test
  public void TesteInt32() throws Exception {
    Serializer serializer = new Serializer();
    byte[] buffer = serializer.Serialize(123);
    assertNotNull(buffer);
    int num = (Integer) serializer.Derialize(buffer, Integer.class);
    assertEquals(123, num);
  }
View Full Code Here

    assertEquals(123, num);
  }

  @Test
  public void TestDate() throws Exception {
    Serializer serializer = new Serializer();
    Object data = new Date();
    byte[] buffer = serializer.Serialize(data);
    assertNotNull(buffer);
    Object obj = serializer.Derialize(buffer, Date.class);
    Object expect = data;
    assertEquals(expect, obj);
  }
View Full Code Here

    assertEquals(expect, obj);
  }

  @Test
  public void TestInt() throws Exception {
    Serializer serializer = new Serializer();
    Object data = (int) 32;
    byte[] buffer = serializer.Serialize(data);
    assertNotNull(buffer);
    Object obj = serializer.Derialize(buffer, int.class);
    Object expect = data;
    assertEquals(expect, obj);
  }
View Full Code Here

    assertEquals(expect, obj);
  }

  @Test
  public void SerizlizeSqlDate() throws Exception {
    Serializer serializer = new Serializer();
    Object data = new java.sql.Date((new Date()).getTime());
    byte[] buffer = serializer.Serialize(data);
    assertNotNull(buffer);
    Object obj = serializer.Derialize(buffer, java.sql.Date.class);
    Object expect = data;
    assertEquals(expect, obj);
  }
View Full Code Here

    assertEquals(expect, obj);
  }

  @Test
  public void SerizlizeSqlTimestamp() throws Exception {
    Serializer serializer = new Serializer();
    Object data = new java.sql.Timestamp((new Date()).getTime());
    byte[] buffer = serializer.Serialize(data);
    assertNotNull(buffer);
    Object obj = serializer.Derialize(buffer, java.sql.Timestamp.class);
    Object expect = data;
    assertEquals(expect, obj);
  }
View Full Code Here

    assertEquals(expect, obj);
  }

  @Test
  public void SerizlizeSqlTime() throws Exception {
    Serializer serializer = new Serializer();
    Object data = new java.sql.Time((new Date()).getTime());
    byte[] buffer = serializer.Serialize(data);
    assertNotNull(buffer);
    Object obj = serializer.Derialize(buffer, java.sql.Time.class);
    Object expect = data;
    assertEquals(expect, obj);
  }
View Full Code Here

*/
public class SerializerClassInit implements IInit {

  @Override
  public void init() {
    new Serializer();
  }
View Full Code Here

   * @return
   */
  private String getLogMsg(String msg) {
    StringBuilder sbLog = new StringBuilder();
    sbLog.append(msg);
    GaeaContext context = GaeaContext.getFromThreadLocal();
    if(context != null) {
      sbLog.append("--");
      sbLog.append("remoteIP:");
      sbLog.append(context.getChannel().getRemoteIP());
      sbLog.append("--remotePort:");
      sbLog.append(context.getChannel().getRemotePort());
    }
   
    return sbLog.toString();
  }
View Full Code Here

      public void messageReceived(Object obj) {
        if(context.getServerType() == ServerType.HTTP){
          httpThreadLocal.remove();
        }
        if(obj != null) {
          GaeaContext ctx = (GaeaContext)obj;
          ctx.getServerHandler().writeResponse(ctx);
        } else {
          logger.error("context is null!");
        }
      }
     
View Full Code Here

TOP

Related Classes of com.bj58.spat.gaea.server.util.ClassHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.