Examples of Xtruct


Examples of thrift.test.Xtruct

      return mapmap;
    }

    public Map<Long, Map<Integer,Insanity>> testInsanity(Insanity argument) {

      Xtruct hello = new Xtruct();
      hello.string_thing = "Hello2";
      hello.byte_thing = 2;
      hello.i32_thing = 2;
      hello.i64_thing = 2;

      Xtruct goodbye = new Xtruct();
      goodbye.string_thing = "Goodbye4";
      goodbye.byte_thing = (byte)4;
      goodbye.i32_thing = 4;
      goodbye.i64_thing = (long)4;
View Full Code Here

Examples of thrift.test.Xtruct

      return insane;
    }

    public Xtruct testMulti(byte arg0, int arg1, long arg2, Map<Short,String> arg3, int arg4, long arg5) {

      Xtruct hello = new Xtruct();;
      hello.string_thing = "Hello2";
      hello.byte_thing = arg0;
      hello.i32_thing = arg1;
      hello.i64_thing = arg2;
      return hello;
View Full Code Here

Examples of thrift.test.Xtruct

        x.message = "This is an Xception";
        throw x;
      } else if (arg0.equals("Xception2")) {
        Xception2 x = new Xception2();
        x.errorCode = 2002;
        x.struct_thing = new Xtruct();
        x.struct_thing.string_thing = "This is an Xception2";
        throw x;
      }

      Xtruct result = new Xtruct();
      result.string_thing = arg1;
      return result;
    }
View Full Code Here

Examples of thrift.test.Xtruct

  @Test
  public void testkeyValueHeader() throws TException {
    TMemoryBuffer buf = new TMemoryBuffer(200);
    THeaderTransport trans = new THeaderTransport(buf);
    TBinaryProtocol prot = new TBinaryProtocol(trans);
    Xtruct out = new Xtruct();

    trans.setHeader("test1", "value1");
    trans.setHeader("test2", "value2");
    out.write(prot);
    trans.flush();

    Xtruct in = new Xtruct();
    in.read(prot);
    HashMap<String, String> headers = trans.getHeaders();
    assertEquals(2, headers.size());
    assertTrue(headers.containsKey("test1"));
    assertTrue(headers.containsKey("test2"));
    assertEquals("value1", headers.get("test1"));
View Full Code Here

Examples of thrift.test.Xtruct

    assertEquals(t, dub);

    /**
     * STRUCT TEST
     */
    Xtruct out = new Xtruct();
    out.string_thing = "Zero";
    out.byte_thing = (byte) 1;
    out.i32_thing = -3;
    out.i64_thing = -5;
    Xtruct in = testClient.testStruct(out);
    assertEquals(out, in);

    /**
     * NESTED STRUCT TEST
     */
    Xtruct2 out2 = new Xtruct2();
    out2.byte_thing = (short)1;
    out2.struct_thing = out;
    out2.i32_thing = 5;
    Xtruct2 in2 = testClient.testNest(out2);
    in = in2.struct_thing;
    assertEquals(out2, in2);

    /**
     * MAP TEST
     */
    Map<Integer,Integer> mapout = new HashMap<Integer,Integer>();
    for (int i = 0; i < 5; ++i) {
      mapout.put(i, i - 10);
    }
    Map<Integer,Integer> mapin = testClient.testMap(mapout);
    assertEquals(mapout, mapin);

    /**
     * SET TEST
     */
    Set<Integer> setout = new HashSet<Integer>();
    for (int i = -2; i < 3; ++i) {
      setout.add(i);
    }
    Set<Integer> setin = testClient.testSet(setout);
    assertEquals(setout, setin);

    /**
     * LIST TEST
     */
    List<Integer> listout = new ArrayList<Integer>();
    for (int i = -2; i < 3; ++i) {
      listout.add(i);
    }
    List<Integer> listin = testClient.testList(listout);
    assertEquals(listout, listin);

    /**
     * ENUM TEST
     */
    int ret = testClient.testEnum(Numberz.ONE);

    ret = testClient.testEnum(Numberz.TWO);

    ret = testClient.testEnum(Numberz.THREE);

    ret = testClient.testEnum(Numberz.FIVE);

    ret = testClient.testEnum(Numberz.EIGHT);

    /**
     * TYPEDEF TEST
     */
    long uid = testClient.testTypedef(309858235082523L);

    /**
     * NESTED MAP TEST
     */
    Map<Integer,Map<Integer,Integer>> mm =
      testClient.testMapMap(1);

    /**
     * INSANITY TEST
     */
    insane = new Insanity();
    insane.userMap = new HashMap<Integer, Long>();
    insane.userMap.put(Numberz.FIVE, (long)5000);
    Xtruct truck = new Xtruct();
    truck.string_thing = "Truck";
    truck.byte_thing = (byte)8;
    truck.i32_thing = 8;
    truck.i64_thing = 8;
    insane.xtructs = new ArrayList<Xtruct>();
View Full Code Here

Examples of thrift.test.Xtruct

    public Xtruct testStruct(Xtruct thing) {
      return thing;
    }

    public Xtruct2 testNest(Xtruct2 nest) {
      Xtruct thing = nest.struct_thing;
      return nest;
    }
View Full Code Here

Examples of thrift.test.Xtruct

      return mapmap;
    }

    public Map<Long, Map<Integer,Insanity>> testInsanity(Insanity argument) {

      Xtruct hello = new Xtruct();
      hello.string_thing = "Hello2";
      hello.byte_thing = 2;
      hello.i32_thing = 2;
      hello.i64_thing = 2;

      Xtruct goodbye = new Xtruct();
      goodbye.string_thing = "Goodbye4";
      goodbye.byte_thing = (byte)4;
      goodbye.i32_thing = 4;
      goodbye.i64_thing = (long)4;
View Full Code Here

Examples of thrift.test.Xtruct

      return insane;
    }

    public Xtruct testMulti(byte arg0, int arg1, long arg2, Map<Short,String> arg3, int arg4, long arg5) {

      Xtruct hello = new Xtruct();;
      hello.string_thing = "Hello2";
      hello.byte_thing = arg0;
      hello.i32_thing = arg1;
      hello.i64_thing = arg2;
      return hello;
View Full Code Here

Examples of thrift.test.Xtruct

        x.message = "This is an Xception";
        throw x;
      } else if (arg0.equals("Xception2")) {
        Xception2 x = new Xception2();
        x.errorCode = 2002;
        x.struct_thing = new Xtruct();
        x.struct_thing.string_thing = "This is an Xception2";
        throw x;
      }

      Xtruct result = new Xtruct();
      result.string_thing = arg1;
      return result;
    }
View Full Code Here

Examples of thrift.test.Xtruct

                       thing.i64_thing + "})\n");
      return thing;
    }

    public Xtruct2 testNest(Xtruct2 nest) {
      Xtruct thing = nest.struct_thing;
      System.out.print("testNest({" +
                       nest.byte_thing + ", {" +
                       "\"" + thing.string_thing + "\", " +
                       thing.byte_thing + ", " +
                       thing.i32_thing + ", " +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.