Giter Site home page Giter Site logo

aphrodite's Introduction

Build Status Aphrodite

An API for retrieving and updating SET issues from multiple issue trackers.

Contributing


Contributions welcome, but make sure your code passes checkstyle and respects the formatting style before submitting a PR. Furthermore, all new files must contain the JBOSS copyright notice, templates for different IDEs can be found here.

Commit Guidelines

Where possible, please try to link a commit to the GitHub issue that it aims to solve. Commit messages should be in the format "Issue #<Insert issue number here>: <Insert relevant message>". Note, ensure that there is a space before "#" so that GitHub can automatically transform the string into a link to the relevant issue.

#Configuration

Add aphrodite to your pom:

    <dependency>
      <groupId>org.jboss.set</groupId>
      <artifactId>aphrodite</artifactId>
      <version>0.4.1</version>
    </dependency>

Add the remote repository to your pom:

	<repositories>
        <repository>
            <id>aphrodite</id>
            <name>Aphrodite</name>
            <url>
            	https://repository.jboss.org/nexus/content/groups/public/
            </url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
        </repository>
   </repositories>
   
Configuring via json file

Specify the location of the aphrodite.properties.json file via the system property "aphrodite.config". An example properties file can be found here

Aphrodite aphrodite = Aphrodite.instance();
Configuring programmatically
IssueTrackerConfig jiraService =
                new IssueTrackerConfig("https://issues.stage.jboss.org", "your username", "your password", "jira", 200);
List<IssueTrackerConfig> issueTrackerConfigs = new ArrayList<>();
issueTrackerConfigs.add(jiraService);

RepositoryConfig githubService = new RepositoryConfig("https://github.com/", "your username", "your password", "github");
List<RepositoryConfig> repositoryConfigs = new ArrayList<>();
repositoryConfigs.add(githubService);

StreamConfig streamService=new StreamConfig(new URL("https://raw.githubusercontent.com/jboss-set/jboss-streams/master/streams.json"), StreamType.JSON);
List<StreamConfig> streamConfigs=new ArrayList<>();
streamConfigs.add(streamService);

AphroditeConfig config = new AphroditeConfig(issueTrackerConfigs, repositoryConfigs, streamConfigs);
Aphrodite aphrodite = Aphrodite.instance(config);
Closing Aphrodite Resources

The Aphrodite class implements the AutoCloseble interface, so in order for all resources to be closed you must either call the close() method explicitly or utilise a try with resources statement when calling Aphrodite.instance(). For example:

try(Aphrodite aphrodite = Aphrodite.instance()){
    // perform some aphrodite operations
}

Or

 Aphrodite aphrodite = Aphrodite.instance();
 // perform some aphrodite operations
 aphrodite.close();
Cache configuration

Aphrodite supports conditional-requests by using OkHttp to provide a pluggable connector through HttpConnector.

In order to use the HTTP response cache, you need to define the cache attributes through system properties:

  • cacheDir: cache directory
  • cacheName: cache name
  • cacheSize: cache size in MB

e.g. Configuration in WildFly / JBoss EAP Server Standalone.xml

<property name="cacheDir" value="/path/to/cache"/>
<property name="cacheName" value="github-cache"/>
<property name="cacheSize" value="10"/>

Aphrodite starts with no cache mode if there is no cache properties configuration.

Example Usage


jira example
// 1.Get individual Issue include comments
Issue issue = aphrodite.getIssue(new URL("https://issues.stage.jboss.org/browse/WFLY-100"));

// 2.Update issue
issue.setAssignee(new User("[email protected]","redhat"));
aphrodite.updateIssue(issue);

// 3.Get issues
Collection<URL> urls=new ArrayList<>();
urls.add(new URL("https://issues.stage.jboss.org/browse/WFLY-4816"));
urls.add(new URL("https://issues.stage.jboss.org/browse/WFLY-4817"));
urls.add(new URL("https://issues.stage.jboss.org/browse/WFLY-100"));
List<Issue> issues=aphrodite.getIssues(urls);

// 4.Add comment to issue
aphrodite.addCommentToIssue(issue, new Comment(null,null,"comment test",false));

// 5.Add comments to issues
Issue issue2 = aphrodite.getIssue(new URL("https://issues.stage.jboss.org/browse/WFLY-100"));
Map<Issue,Comment> maps=new HashMap<>();
maps.put(issue, new Comment("comment test",false));
maps.put(issue2, new Comment("comment test",false));
aphrodite.addCommentToIssue(maps);

// 6.Search Issues
SearchCriteria sc = new SearchCriteria.Builder()
        .setStatus(IssueStatus.MODIFIED)
        .setProduct("JBoss Enterprise Application Platform 6")
        .build();
List<Issue> result = aphrodite.searchIssues(sc);
bugzila example
//it's same as the jira test,you only need change the URL

// 1.Get individual issue include comments
Issue issue = aphrodite.getIssue(new URL("https://bugzilla.redhat.com/show_bug.cgi?id=1184440"));

// 2.Update issue
issue.setStatus(IssueStatus.ASSIGNED);
aphrodite.updateIssue(issue);
github example
// 1.Get code repository
Repository repo=aphrodite.getRepository(new URL("https://github.com/ryanemerson/aphrodite_test"));

// 2.Get individual patch
Patch patch=aphrodite.getPatch(new URL("https://github.com/ryanemerson/aphrodite_test/pull/1"));

// 3.Get all patches associated with a given issue
List<Patch> patches=aphrodite.getPatchesAssociatedWith(new Issue(new URL("https://issues.jboss.org/browse/WFLY-100")));

// 4.Get patches by status
List<Patch> patches=aphrodite.getPatchesByStatus(repo, PatchStatus.CLOSED);

// 5.Add a comment to patch
aphrodite.addCommentToPatch(patch, "Example Comment");

// 6.Add label to patch,the label name must can be found in the patch
aphrodite.addLabelToPatch(patch, "bug");

// 7.Find patches related with the patch
List<Patch> patches=aphrodite.findPatchesRelatedTo(patch);

// 8.Retrieve all labels associated with the repository
Repository repo=new Repository(new URL("https://github.com/jboss-set/aphrodite_test"));
List<Label> labels=aphrodite.getLabelsFromRepository(repo);

// 9.Retrieve all labels associated from the patch
List<Label> labelss=aphrodite.getLabelsFromPatch(patch);

// 10.delete a label from patch
aphrodite.removeLabelFromPatch(patch, "Test");

// 11.Set the labels for the provided patch
List<Label> labels=new ArrayList<>();
labels.add(new Label("Test"));
labels.add(new Label("TestLabel"));
aphrodite.setLabelsToPatch(patch, labels);

// 12.Retrieve the current CI status of the latest commit associated with a given patch
 CommitStatus status=aphrodite.getCommitStatusFromPatch(patch); 
 
stream example
// 1.Get all streams from a url
List<Stream> ss=aphrodite.getAllStreams();

// 2.Get stream by stream's name eg:"wildfly"
Stream stream=aphrodite.getStream("wildfly");

// 3.Retrieve all unique Repositories that exists across all Streams
List<Repository> repositories=aphrodite.getDistinctURLRepositoriesFromStreams();

// 4.Retrieve all Repositories associated with a given Stream eg:"wildfly"
List<Repository> urls=aphrodite.getDistinctURLRepositoriesByStream("wildfly");

// 5.Find all the streams associated to the given repository and codebase
//repository_url,eg:"https://github.com/aeshell/aesh"
//code_branch,eg:"master"
Repository repo=new Repository(new URL("https://github.com/aeshell/aesh"));
Codebase code=new Codebase("master");
List<Stream> ss=aphrodite.getStreamsBy(repo, code);

// 6.Get the StreamComponent which specifies the given repository and codebase
Repository repo=new Repository(new URL("https://github.com/aeshell/aesh"));
Codebase code=new Codebase("master");
StreamComponent name=aphrodite.getComponentBy(repo, code);
		

aphrodite's People

Contributors

baranowb avatar bayern39 avatar elguardian avatar gonthim avatar istudens avatar mmarus avatar rpelisse avatar ryanemerson avatar soul2zimate avatar wolfc avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.