S3LogPathResolver { public String getResolvedPath(String baseKeyPrefix, String keySuffix, String cluster) { HashMap<String, String> contextParam = buildContextParam(cluster); String resolvedKeyPrefix = PlaceholderUtil.replaceVariables(baseKeyPrefix, contextParam); return resolvedKeyPrefix + LogFeederConstants.S3_PATH_SEPARATOR + keySuffix; }  String getResolvedPath(String baseKeyPrefix, String keySuffix, String cluster);  }
@Test public void shouldResolveHostName() { String resolvedPath = new S3LogPathResolver().getResolvedPath("my_s3_path/$host", "filename.log", "cl1"); assertEquals("my_s3_path/" + LogFeederUtil.hostName + "/filename.log", resolvedPath); }
@Test public void shouldResolveIpAddress() { String resolvedPath = new S3LogPathResolver().getResolvedPath("my_s3_path/$ip", "filename.log", "cl1"); assertEquals("my_s3_path/" + LogFeederUtil.ipAddress + "/filename.log", resolvedPath); }
@Test public void shouldResolveCluster() { String resolvedPath = new S3LogPathResolver().getResolvedPath("my_s3_path/$cluster", "filename.log", "cl1"); assertEquals("my_s3_path/cl1/filename.log", resolvedPath); }
@Test public void shouldResolveCombinations() { String resolvedPath = new S3LogPathResolver().getResolvedPath("my_s3_path/$cluster/$host", "filename.log", "cl1"); assertEquals("my_s3_path/cl1/"+ LogFeederUtil.hostName + "/filename.log", resolvedPath); }