@AfterClass public static void oneTimeTearDown() { // one-time cleanup code try { Utility.deleteCalendarResourceIfExists(testCalRes); Utility.deleteCalendarResourceIfExists("foobar" + testCalRes); Utility.deleteDomainIfExists(testCalResDomain); } catch (Exception ex) { System.err.println("Exception " + ex.toString() + " thrown inside oneTimeTearDown"); } }
@Test public void createCalendarResourceTest() throws Exception { int len; Utility.deleteCalendarResourceIfExists(testCalRes); Utility.ensureDomainExists(testCalResDomain); testCreateCalendarResourceRequest createReq = new testCreateCalendarResourceRequest(); createReq.setName(testCalRes); createReq.setPassword("test123"); createReq.getA().add(Utility.mkAttr("displayName", "WSDL Test Cal Resource")); createReq.getA().add(Utility.mkAttr("zimbraCalResType", "Location")); createReq.getA().add(Utility.mkAttr("zimbraCalResLocationDisplayName", "Harare")); Utility.addSoapAdminAuthHeader((WSBindingProvider) eif); testCreateCalendarResourceResponse resp = eif.createCalendarResourceRequest(createReq); Assert.assertNotNull("CreateCalendarResourceResponse object", resp); testCalendarResourceInfo calResInfo = resp.getCalresource(); Assert.assertNotNull("CalendarResourceInfo object", calResInfo); Assert.assertEquals( "createCalendarResourceResponse <calResource> 'name' attribute", testCalRes, calResInfo.getName()); String testCalendarResourceId = calResInfo.getId(); len = testCalendarResourceId.length(); Assert.assertTrue( "length of <calResource> 'id' attribute length is " + len + " - should be longer than 10", len > 10); len = calResInfo.getA().size(); Assert.assertTrue( "CreateCalendarResourceResponse <calResource> has " + len + " <a> children - should have at least 12", len >= 12); }
@Test public void renameCalendarResourceTest() throws Exception { int len; String testCalendarResourceId = Utility.ensureCalendarResourceExists(testCalRes, testCalResDisplayName); String respId; testRenameCalendarResourceRequest renameCalendarResourceReq = new testRenameCalendarResourceRequest(); renameCalendarResourceReq.setId(testCalendarResourceId); renameCalendarResourceReq.setNewName("foobar" + testCalRes); testRenameCalendarResourceResponse renameCalendarResourceResp = eif.renameCalendarResourceRequest(renameCalendarResourceReq); Assert.assertNotNull(renameCalendarResourceResp); testCalendarResourceInfo calResInfo = renameCalendarResourceResp.getCalresource(); Assert.assertNotNull(calResInfo); Assert.assertEquals( "renameCalendarResourceResponse <calResource> 'name' attribute", "foobar" + testCalRes, calResInfo.getName()); respId = calResInfo.getId(); Assert.assertEquals( "renameCalendarResourceResponse <calResource> 'id' attribute", testCalendarResourceId, respId); len = calResInfo.getA().size(); Assert.assertTrue( "renameCalendarResourceResponse <calResource> has " + len + " <a> children - should have at least 50", len >= 50); Utility.deleteCalendarResourceIfExists("foobar" + testCalRes); }