Exemplo n.º 1
0
  public void testZCreate() throws RemoteException, UnexpectedErrorFault, InvalidTypeFault {
    try {
      ZApi zapi = new ZApi();
      assertTrue("Logged in", zapi.isLoggedIn);

      Product testProd = new Product();
      testProd.setName("JTest Product");
      testProd.setDescription("JTest Description");
      Calendar sdate = Calendar.getInstance();
      Calendar edate = Calendar.getInstance();
      sdate.add(Calendar.YEAR, -50);
      edate.add(Calendar.YEAR, 50);
      testProd.setEffectiveStartDate(sdate);
      testProd.setEffectiveEndDate(edate);

      SaveResult[] sr = zapi.zCreate(new ZObject[] {testProd});
      assertTrue("Created Product", sr[0].getSuccess());

    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }