Skip to content

Commit 51616e5

Browse files
committed
Merge pull request #64 from charlesk40/master
See https://www.jfrog.com/jira/browse/RTFACT-6025
2 parents 4d9fc6f + 426e9fd commit 51616e5

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

api/src/main/java/org/jfrog/artifactory/client/RepositoryHandle.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ public interface RepositoryHandle {
3333
DownloadableArtifact download(String path);
3434

3535
Set<ItemPermission> effectivePermissions();
36-
}
36+
37+
boolean isFolder(String path);
38+
}
39+

services/src/main/groovy/org/jfrog/artifactory/client/impl/RepositoryHandleImpl.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,12 @@ class RepositoryHandleImpl implements RepositoryHandle {
8080
Set<ItemPermission> effectivePermissions() {
8181
this.folder('').effectivePermissions()
8282
}
83+
84+
boolean isFolder(String path) {
85+
String itemInfoJson = artifactory.get("/api/storage/${repoKey}/${path}", ContentType.JSON, String)
86+
JsonSlurper slurper = new JsonSlurper()
87+
def itemInfo = slurper.parseText(itemInfoJson)
88+
return itemInfo.children != null;
89+
}
90+
8391
}

services/src/test/java/org/jfrog/artifactory/client/RepositoryTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,13 @@ public void testGetVirtual() throws Exception {
195195
assertTrue(libsReleases.getKeyPair() == null || libsReleases.getKeyPair().isEmpty());
196196
assertTrue(libsReleases.getRepoLayoutRef() == null || libsReleases.getRepoLayoutRef().isEmpty());
197197
}
198+
199+
@Test(dependsOnMethods = "testCreate")
200+
public void testRepositoryIsFolder() throws IOException {
201+
try {
202+
assertTrue(artifactory.repository(NEW_LOCAL).isFolder("myFolder"));
203+
} catch (Exception e) {
204+
assertTrue(e.getMessage().contains("Internal Server Error"));
205+
}
206+
}
198207
}

0 commit comments

Comments
 (0)