GetSignedUrlTaskParameters extends GetUrlTaskParameters { public String serialize() { JaxbJsonSerializer<GetSignedUrlTaskParameters> serializer = new JaxbJsonSerializer<>(GetSignedUrlTaskParameters.class); try { return serializer.serialize(this); } catch (IOException e) { throw new TaskDataException( "Unable to create task parameters due to: " + e.getMessage()); } } GetSignedUrlTaskParameters(); String getSpaceId(); void setSpaceId(String spaceId); String getContentId(); void setContentId(String contentId); String getResourcePrefix(); void setResourcePrefix(String resourcePrefix); int getMinutesToExpire(); void setMinutesToExpire(int minutesToExpire); String getIpAddress(); void setIpAddress(String ipAddress); String serialize(); static GetSignedUrlTaskParameters deserialize(String taskParameters); static final int USE_DEFAULT_MINUTES_TO_EXPIRE; }
@Test public void testSerialize() { GetSignedUrlTaskParameters taskParams = new GetSignedUrlTaskParameters(); taskParams.setSpaceId(spaceId); taskParams.setContentId(contentId); taskParams.setResourcePrefix(resourcePrefix); taskParams.setMinutesToExpire(minutesToExpire); taskParams.setIpAddress(ipAddress); String result = taskParams.serialize(); String cleanResult = result.replaceAll("\\s+", ""); assertThat(cleanResult, containsString("\"spaceId\":\"" + spaceId + "\"")); assertThat(cleanResult, containsString("\"contentId\":\"" + contentId + "\"")); assertThat(cleanResult, containsString("\"resourcePrefix\":\"" + resourcePrefix + "\"")); assertThat(cleanResult, containsString("\"minutesToExpire\":" + minutesToExpire)); assertThat(cleanResult, containsString("\"ipAddress\":\"" + ipAddress + "\"")); }