forked from ecd-plugin/ecd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
source attach: fix issues - add tests - remove jaxb/plexus/nexus/cvs
- Loading branch information
nbauma109
committed
May 9, 2024
1 parent
d6ac7c8
commit 2e94c09
Showing
27 changed files
with
347 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry exported="true" kind="lib" path="target/lib/commons-io-2.16.1.jar"/> | ||
<classpathentry kind="src" output="bin" path="src"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/bin/ | ||
/.settings/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.sf.feeling.decompiler.source.attach.tests</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
32 changes: 32 additions & 0 deletions
32
org.sf.feeling.decompiler.source.attach.tests/META-INF/MANIFEST.MF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Enhanced Class Decompiler Source Attach | ||
Bundle-SymbolicName: org.sf.feeling.decompiler.source.attach.tests;singleton:=true | ||
Bundle-Version: 2024.3.1 | ||
Bundle-Activator: org.sf.feeling.decompiler.source.attach.SourceAttachPlugin | ||
Bundle-Localization: plugin | ||
Require-Bundle: org.eclipse.ui, | ||
org.eclipse.core.runtime, | ||
org.eclipse.core.expressions, | ||
org.eclipse.jdt.core, | ||
org.eclipse.jdt.ui, | ||
org.eclipse.core.resources, | ||
org.eclipse.core.databinding, | ||
org.eclipse.jface.databinding, | ||
org.eclipse.core.databinding.beans, | ||
org.sf.feeling.decompiler, | ||
org.apache.ant, | ||
org.eclipse.jgit;resolution:=optional, | ||
com.jcraft.jsch;resolution:=optional, | ||
org.eclipse.m2e.jdt;resolution:=optional, | ||
org.junit, | ||
org.eclipse.jdt.junit4.runtime, | ||
org.eclipse.jdt.junit.core, | ||
org.eclipse.jdt.junit.runtime, | ||
org.sf.feeling.decompiler.source.attach | ||
Bundle-RequiredExecutionEnvironment: JavaSE-17 | ||
Bundle-ActivationPolicy: lazy | ||
Bundle-Vendor: ECD Project Team | ||
Bundle-ClassPath: target/lib/commons-io-2.16.1.jar, | ||
. | ||
Automatic-Module-Name: org.sf.feeling.decompiler.source.attach.tests |
6 changes: 6 additions & 0 deletions
6
org.sf.feeling.decompiler.source.attach.tests/build.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
target/lib/,\ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.github.ecd-plugin</groupId> | ||
<artifactId>com.github.ecd-plugin.ecd</artifactId> | ||
<version>2024.3.1</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>org.sf.feeling.decompiler.source.attach.tests</artifactId> | ||
<packaging>eclipse-test-plugin</packaging> | ||
|
||
</project> |
65 changes: 65 additions & 0 deletions
65
...sts/src/org/sf/feeling/decompiler/source/attach/finder/AbstractSourceCodeFinderTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package org.sf.feeling.decompiler.source.attach.finder; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.MalformedURLException; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.sf.feeling.decompiler.util.HashUtils; | ||
|
||
public abstract class AbstractSourceCodeFinderTests { | ||
|
||
protected void testFindCommonsIo(String serviceUrl) throws Exception { | ||
String gavUrl = "https://repo1.maven.org/maven2/commons-io/commons-io/2.16.0/"; | ||
String fileName = "commons-io-2.16.0"; | ||
testFind(serviceUrl, gavUrl, fileName); | ||
} | ||
|
||
protected void testFindSlf4jNop(String serviceUrl) throws Exception { | ||
String gavUrl = "https://repo1.maven.org/maven2/org/slf4j/slf4j-nop/2.1.0-alpha1/"; | ||
String fileName = "slf4j-nop-2.1.0-alpha1"; | ||
testFind(serviceUrl, gavUrl, fileName); | ||
} | ||
|
||
protected void testFindAsmUtil(String serviceUrl) throws Exception { | ||
String gavUrl = "https://repo1.maven.org/maven2/org/ow2/asm/asm-util/9.7/"; | ||
String fileName = "asm-util-9.7"; | ||
testFind(serviceUrl, gavUrl, fileName); | ||
} | ||
|
||
protected void testFindJunit(String serviceUrl) throws Exception { | ||
String gavUrl = "https://maven.alfresco.com/nexus/content/groups/public/junit/junit/4.11-20120805-1225/"; | ||
String fileName = "junit-4.11-20120805-1225"; | ||
testFind(serviceUrl, gavUrl, fileName); | ||
} | ||
|
||
protected void testFind(String serviceUrl, String gavUrl, String fileName) | ||
throws MalformedURLException, IOException { | ||
AbstractSourceCodeFinder directLinkSourceCodeFinder = newSourceCodeFinder(serviceUrl); | ||
List<SourceFileResult> results = new ArrayList<>(); | ||
File downloadDir = new File("target"); | ||
File jarFile = new File(downloadDir, fileName + ".jar"); | ||
URL url = new URL(gavUrl + fileName + ".jar"); | ||
File srcFile = new File(downloadDir, fileName + "-sources.jar"); | ||
URL srcUrl = new URL(gavUrl + fileName + "-sources.jar"); | ||
FileUtils.copyURLToFile(url, jarFile); | ||
FileUtils.copyURLToFile(srcUrl, srcFile); | ||
if (jarFile.exists()) { | ||
String sha1 = HashUtils.sha1Hash(jarFile); | ||
directLinkSourceCodeFinder.find(jarFile.getAbsolutePath(), sha1, results); | ||
assertNotNull(results); | ||
assertEquals(1, results.size()); | ||
String expectedSha1 = HashUtils.sha1Hash(srcFile); | ||
String actualSha1 = HashUtils.sha1Hash(new File(results.get(0).getSource())); | ||
assertEquals(expectedSha1, actualSha1); | ||
} | ||
} | ||
|
||
protected abstract AbstractSourceCodeFinder newSourceCodeFinder(String serviceUrl); | ||
} |
18 changes: 18 additions & 0 deletions
18
...s/src/org/sf/feeling/decompiler/source/attach/finder/ArtifactorySourceCodeFinderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.sf.feeling.decompiler.source.attach.finder; | ||
|
||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_REPO_GRAILS_ORG_GRAILS; | ||
|
||
import org.junit.Test; | ||
|
||
public class ArtifactorySourceCodeFinderTest extends AbstractSourceCodeFinderTests { | ||
|
||
@Test | ||
public void testFindGrails() throws Exception { | ||
testFindAsmUtil(HTTPS_REPO_GRAILS_ORG_GRAILS); | ||
} | ||
|
||
@Override | ||
protected AbstractSourceCodeFinder newSourceCodeFinder(String serviceUrl) { | ||
return new ArtifactorySourceCodeFinder(serviceUrl); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...sts/src/org/sf/feeling/decompiler/source/attach/finder/MavenRepoSourceCodeFinderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.sf.feeling.decompiler.source.attach.finder; | ||
|
||
import org.junit.Test; | ||
|
||
public class MavenRepoSourceCodeFinderTest extends AbstractSourceCodeFinderTests { | ||
|
||
@Test | ||
public void testFindSlf4jNop() throws Exception { | ||
testFindAsmUtil(null); | ||
} | ||
|
||
@Override | ||
protected AbstractSourceCodeFinder newSourceCodeFinder(String serviceUrl) { | ||
return new MavenRepoSourceCodeFinder(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
....tests/src/org/sf/feeling/decompiler/source/attach/finder/Nexus3SourceCodeFinderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.sf.feeling.decompiler.source.attach.finder; | ||
|
||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_REPOSITORY_CLOUDERA_COM_ARTIFACTORY; | ||
|
||
import org.junit.Test; | ||
|
||
public class Nexus3SourceCodeFinderTest extends AbstractSourceCodeFinderTests { | ||
|
||
@Test | ||
public void testFindCloudera() throws Exception { | ||
testFindCommonsIo(HTTPS_REPOSITORY_CLOUDERA_COM_ARTIFACTORY); | ||
} | ||
|
||
@Override | ||
protected AbstractSourceCodeFinder newSourceCodeFinder(String serviceUrl) { | ||
return new Nexus3SourceCodeFinder(serviceUrl); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...h.tests/src/org/sf/feeling/decompiler/source/attach/finder/NexusSourceCodeFinderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package org.sf.feeling.decompiler.source.attach.finder; | ||
|
||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_MAVEN_ALFRESCO_COM_NEXUS_INDEX_HTML; | ||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_MAVEN_NUXEO_ORG_NEXUS_INDEX_HTML; | ||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_NEXUS_XWIKI_ORG_NEXUS_INDEX_HTML; | ||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_OSS_SONATYPE_ORG_INDEX_HTML; | ||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_REPOSITORY_APACHE_ORG_INDEX_HTML; | ||
import static org.sf.feeling.decompiler.source.attach.finder.SourceCodeFinderFacade.HTTPS_REPOSITORY_OW2_ORG_NEXUS_INDEX_HTML; | ||
|
||
import org.junit.Test; | ||
|
||
public class NexusSourceCodeFinderTest extends AbstractSourceCodeFinderTests { | ||
|
||
@Test | ||
public void testOSS() throws Exception { | ||
testFindSlf4jNop(HTTPS_OSS_SONATYPE_ORG_INDEX_HTML); | ||
} | ||
|
||
@Test | ||
public void testApache() throws Exception { | ||
testFindCommonsIo(HTTPS_REPOSITORY_APACHE_ORG_INDEX_HTML); | ||
} | ||
|
||
@Test | ||
public void testOW2() throws Exception { | ||
testFindAsmUtil(HTTPS_REPOSITORY_OW2_ORG_NEXUS_INDEX_HTML); | ||
} | ||
|
||
@Test | ||
public void testNuxeo() throws Exception { | ||
testFindSlf4jNop(HTTPS_MAVEN_NUXEO_ORG_NEXUS_INDEX_HTML); | ||
} | ||
|
||
@Test | ||
public void testAlfresco() throws Exception { | ||
testFindJunit(HTTPS_MAVEN_ALFRESCO_COM_NEXUS_INDEX_HTML); | ||
} | ||
|
||
@Test | ||
public void testXWiki() throws Exception { | ||
testFindAsmUtil(HTTPS_NEXUS_XWIKI_ORG_NEXUS_INDEX_HTML); | ||
} | ||
|
||
@Override | ||
protected AbstractSourceCodeFinder newSourceCodeFinder(String serviceUrl) { | ||
return new NexusSourceCodeFinder(serviceUrl); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.