@Test public void testGeneratedFilename() { AsicContainerNameGenerator nameGenerator = new AsicContainerNameGenerator( AsicContainerNameGeneratorTest::generateRandomPart, 10); String s1 = nameGenerator.createFilenameWithRandom(LONG_QUERY_ID, QUERY_TYPE_REQUEST); assertTrue("The generated filename was too long", s1.length() <= FILENAME_MAX); String s2 = nameGenerator.createFilenameWithRandom(LONG_QUERY_ID, QUERY_TYPE_RESPONSE); assertTrue("The generated filename was too long", s2.length() <= FILENAME_MAX); String s3 = nameGenerator.createFilenameWithRandom(SHORT_QUERY_ID, QUERY_TYPE_REQUEST); assertTrue("The generated filename was too long", s3.length() <= FILENAME_MAX); String s4 = nameGenerator.createFilenameWithRandom(SHORT_QUERY_ID, QUERY_TYPE_RESPONSE); assertTrue("The generated filename was too long", s4.length() <= FILENAME_MAX); }
public String createFilenameWithRandom(String queryId, String queryType) { String processedQueryId = AsicUtils.truncate(AsicUtils.escapeString(queryId), MAX_QUERY_LENGTH); return String.format("%s-%s", processedQueryId, queryType) + String.format("-%s.asice", randomGenerator.get()); }
AsicContainerNameGenerator { public String createFilenameWithRandom(String queryId, String queryType) { String processedQueryId = AsicUtils.truncate(AsicUtils.escapeString(queryId), MAX_QUERY_LENGTH); return String.format("%s-%s", processedQueryId, queryType) + String.format("-%s.asice", randomGenerator.get()); } }
AsicContainerNameGenerator { public String createFilenameWithRandom(String queryId, String queryType) { String processedQueryId = AsicUtils.truncate(AsicUtils.escapeString(queryId), MAX_QUERY_LENGTH); return String.format("%s-%s", processedQueryId, queryType) + String.format("-%s.asice", randomGenerator.get()); }  }
AsicContainerNameGenerator { public String createFilenameWithRandom(String queryId, String queryType) { String processedQueryId = AsicUtils.truncate(AsicUtils.escapeString(queryId), MAX_QUERY_LENGTH); return String.format("%s-%s", processedQueryId, queryType) + String.format("-%s.asice", randomGenerator.get()); }  String getArchiveFilename(String queryId, String queryType); String createFilenameWithRandom(String queryId, String queryType); }
AsicContainerNameGenerator { public String createFilenameWithRandom(String queryId, String queryType) { String processedQueryId = AsicUtils.truncate(AsicUtils.escapeString(queryId), MAX_QUERY_LENGTH); return String.format("%s-%s", processedQueryId, queryType) + String.format("-%s.asice", randomGenerator.get()); }  String getArchiveFilename(String queryId, String queryType); String createFilenameWithRandom(String queryId, String queryType);  }