コード例 #1
0
 @Test
 public void testValidVersion() {
   UriInfo uriInfo = MockUriInfo.from("http://localhost/v1/slot/lifecycle?binary=*:apple:*");
   String slotsVersion =
       VersionsUtil.createSlotsVersion(
           coordinator.getAllSlotsStatus(
               SlotFilterBuilder.build(uriInfo, false, ImmutableList.<UUID>of())));
   assertOkResponse(
       resource.setState("running", uriInfo, slotsVersion), RUNNING, apple1SlotId, apple2SlotId);
 }
コード例 #2
0
 @Test
 public void testInvalidVersion() {
   UriInfo uriInfo = MockUriInfo.from("http://localhost/v1/slot/lifecycle?binary=*:apple:*");
   try {
     resource.setState("running", uriInfo, "invalid-version");
     fail("Expected VersionConflictException");
   } catch (VersionConflictException e) {
     assertEquals(e.getName(), AIRSHIP_SLOTS_VERSION_HEADER);
     assertEquals(
         e.getVersion(),
         VersionsUtil.createSlotsVersion(
             coordinator.getAllSlotsStatus(
                 SlotFilterBuilder.build(uriInfo, false, ImmutableList.<UUID>of()))));
   }
 }