@Test public void testIvyArtifact_WithClassifier() { String patternStr = IVY_ARTIFACT_PATTERN1; String path = "com.my.group/mymodule/1.0.0/jar/foobar-1.0.0-myclassifier.jar"; Pattern pattern = Pattern.compile(patternStr); BinaryArtifact ba = ArtifactUtil.parse(pattern, path); assertNotNull(ba); assertEquals("com.my.group", ba.getArtifactGroupId()); assertEquals("mymodule", ba.getArtifactModule()); assertEquals("1.0.0", ba.getArtifactVersion()); assertEquals("foobar", ba.getArtifactName()); assertEquals("myclassifier", ba.getArtifactClassifier()); assertEquals("jar", ba.getArtifactExtension()); }
@Test public void testIvy_WithSlashes() { String patternStr = IVY_PATTERN1; String path = "com/my/group/mymodule/1.0.0/ivy-1.0.0.xml"; Pattern pattern = Pattern.compile(patternStr); BinaryArtifact ba = ArtifactUtil.parse(pattern, path); assertNotNull(ba); assertEquals("com.my.group", ba.getArtifactGroupId()); assertEquals("mymodule", ba.getArtifactModule()); assertEquals("1.0.0", ba.getArtifactVersion()); assertEquals("ivy", ba.getArtifactName()); assertEquals(null, ba.getArtifactClassifier()); assertEquals("xml", ba.getArtifactExtension()); }
@Test public void testMisc2_1() { String patternStr = MISC_PATTERN2; String path = "myjob/20/folder1/folder2/My-Project-1.0.master.20.zip"; Pattern pattern = Pattern.compile(patternStr); BinaryArtifact ba = ArtifactUtil.parse(pattern, path); assertNotNull(ba); assertEquals("myjob", ba.getArtifactGroupId()); assertEquals(null, ba.getArtifactModule()); assertEquals("1.0.master.20", ba.getArtifactVersion()); assertEquals("My-Project", ba.getArtifactName()); assertEquals(null, ba.getArtifactClassifier()); assertEquals("zip", ba.getArtifactExtension()); }
@Test public void testMisc2_3() { String patternStr = MISC_PATTERN2; String path = "JOB_Helloworld/125/app-app-app-5.1.0.master.125.zip"; Pattern pattern = Pattern.compile(patternStr); BinaryArtifact ba = ArtifactUtil.parse(pattern, path); assertNotNull(ba); assertEquals("JOB_Helloworld", ba.getArtifactGroupId()); assertEquals(null, ba.getArtifactModule()); assertEquals("5.1.0.master.125", ba.getArtifactVersion()); assertEquals("app-app-app", ba.getArtifactName()); assertEquals(null, ba.getArtifactClassifier()); assertEquals("zip", ba.getArtifactExtension()); }
@Test public void testMaven_NoExt() { String patternStr = MAVEN_PATTERN1; String path = "com.my.group/mymodule/1.0.0/mymodule-1.0.0"; Pattern pattern = Pattern.compile(patternStr); BinaryArtifact ba = ArtifactUtil.parse(pattern, path); assertNotNull(ba); assertEquals("com.my.group", ba.getArtifactGroupId()); assertEquals("mymodule", ba.getArtifactModule()); assertEquals("1.0.0", ba.getArtifactVersion()); assertEquals("mymodule", ba.getArtifactName()); assertEquals(null, ba.getArtifactClassifier()); assertEquals(null, ba.getArtifactExtension()); }