@Test public void isPrivateTest() throws Exception { String serviceId = generateRandomString(10); String contentType = "image/gif"; JSONObject headers = new JSONObject(); setAmbryHeadersForPut(headers, null, serviceId, Container.DEFAULT_PRIVATE_CONTAINER, contentType, null); headers.put(RestUtils.Headers.PRIVATE, "!(true || false)"); RestRequest restRequest = createRestRequest(RestMethod.POST, "/", headers); try { RestUtils.isPrivate(restRequest.getArgs()); fail("An exception was expected but none were thrown"); } catch (RestServiceException e) { assertEquals("Unexpected RestServiceErrorCode", RestServiceErrorCode.InvalidArgs, e.getErrorCode()); } headers.put(RestUtils.Headers.PRIVATE, JSONObject.NULL); restRequest = createRestRequest(RestMethod.POST, "/", headers); assertFalse("isPrivate should be false because it was not set", RestUtils.isPrivate(restRequest.getArgs())); headers.put(RestUtils.Headers.PRIVATE, "false"); restRequest = createRestRequest(RestMethod.POST, "/", headers); assertFalse("isPrivate should be false because it was set to false", RestUtils.isPrivate(restRequest.getArgs())); headers.put(RestUtils.Headers.PRIVATE, "true"); restRequest = createRestRequest(RestMethod.POST, "/", headers); assertTrue("isPrivate should be true because it was set to true", RestUtils.isPrivate(restRequest.getArgs())); }
public static boolean isPrivate(Map<String, Object> args) throws RestServiceException { return getBooleanHeader(args, Headers.PRIVATE, false); }
RestUtils { public static boolean isPrivate(Map<String, Object> args) throws RestServiceException { return getBooleanHeader(args, Headers.PRIVATE, false); } }
RestUtils { public static boolean isPrivate(Map<String, Object> args) throws RestServiceException { return getBooleanHeader(args, Headers.PRIVATE, false); }  }
RestUtils { public static boolean isPrivate(Map<String, Object> args) throws RestServiceException { return getBooleanHeader(args, Headers.PRIVATE, false); }  static BlobProperties buildBlobProperties(Map<String, Object> args); static byte[] buildUserMetadata(Map<String, Object> args); static Map<String, String> buildUserMetadata(byte[] userMetadata); static GetBlobOptions buildGetBlobOptions(Map<String, Object> args, SubResource subResource,
      GetOption getOption, int blobSegmentIdx); static Pair<String, Long> buildContentRangeAndLength(ByteRange range, long blobSize,
      boolean resolveRangeOnEmptyBlob); static RequestPath getRequestPath(RestRequest restRequest); static Long getTimeFromDateString(String dateString); static long toSecondsPrecisionInMs(long ms); static GetOption getGetOption(RestRequest restRequest, GetOption defaultGetOption); static boolean isPrivate(Map<String, Object> args); static boolean isChunkUpload(Map<String, Object> args); static void ensureRequiredHeadersOrThrow(RestRequest restRequest, Set<String> requiredHeaders); static String getHeader(Map<String, ?> args, String header, boolean required); static Long getLongHeader(Map<String, ?> args, String header, boolean required); static T getNumericalHeader(Map<String, ?> args, String header, boolean required,
      Function<String, T> converter); static boolean getBooleanHeader(Map<String, Object> args, String header, boolean required); static Account getAccountFromArgs(Map<String, Object> args); static Container getContainerFromArgs(Map<String, Object> args); static void accountAndContainerNamePreconditionCheck(RestRequest restRequest); static boolean setUserMetadataHeaders(byte[] userMetadata, RestResponseChannel restResponseChannel); }
RestUtils { public static boolean isPrivate(Map<String, Object> args) throws RestServiceException { return getBooleanHeader(args, Headers.PRIVATE, false); }  static BlobProperties buildBlobProperties(Map<String, Object> args); static byte[] buildUserMetadata(Map<String, Object> args); static Map<String, String> buildUserMetadata(byte[] userMetadata); static GetBlobOptions buildGetBlobOptions(Map<String, Object> args, SubResource subResource,
      GetOption getOption, int blobSegmentIdx); static Pair<String, Long> buildContentRangeAndLength(ByteRange range, long blobSize,
      boolean resolveRangeOnEmptyBlob); static RequestPath getRequestPath(RestRequest restRequest); static Long getTimeFromDateString(String dateString); static long toSecondsPrecisionInMs(long ms); static GetOption getGetOption(RestRequest restRequest, GetOption defaultGetOption); static boolean isPrivate(Map<String, Object> args); static boolean isChunkUpload(Map<String, Object> args); static void ensureRequiredHeadersOrThrow(RestRequest restRequest, Set<String> requiredHeaders); static String getHeader(Map<String, ?> args, String header, boolean required); static Long getLongHeader(Map<String, ?> args, String header, boolean required); static T getNumericalHeader(Map<String, ?> args, String header, boolean required,
      Function<String, T> converter); static boolean getBooleanHeader(Map<String, Object> args, String header, boolean required); static Account getAccountFromArgs(Map<String, Object> args); static Container getContainerFromArgs(Map<String, Object> args); static void accountAndContainerNamePreconditionCheck(RestRequest restRequest); static boolean setUserMetadataHeaders(byte[] userMetadata, RestResponseChannel restResponseChannel); static final String HTTP_DATE_FORMAT; static final String BYTE_RANGE_UNITS; static final String SIGNED_ID_PREFIX; static final String JSON_CONTENT_TYPE; }