Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Casals committed Aug 6, 2012
0 parents commit ff86bc2
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 0 deletions.
6 changes: 6 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
To avoid future confusion, we recommend that you include a license with your plugin.
This file is simply a reminder.

For a template license you can have a look at: http://www.opensource.org/licenses/

Atlassian releases most of its modules under a BSD license: http://www.opensource.org/licenses/bsd-license.php
13 changes: 13 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
You have successfully created a plugin using the JIRA plugin archetype!

Here are the SDK commands you'll use immediately:

* atlas-run -- installs this plugin into JIRA and starts it on http://localhost:2990/jira
* atlas-debug -- same as atlas-run, but allows a debugger to attach at port 5005
* atlas-cli -- after atlas-run or atlas-debug, opens a Maven command line window:
- 'pi' reinstalls the plugin into the running JIRA instance
* atlas-help -- prints description for all commands in the SDK

Full documentation is always available at:

https://developer.atlassian.com/display/DOCS/Developing+with+the+Atlassian+Plugin+SDK
83 changes: 83 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.freedomsponsors.plugins</groupId>
<artifactId>jira</artifactId>
<version>1.0-SNAPSHOT</version>
<organization>
<name>FreedomSponsors</name>
<url>http://www.freedomsponsors.org/</url>
</organization>
<name>FreedomSponsors Jira</name>
<description>This is the Jira plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
<!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->
<!--
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-tests</artifactId>
<version>${jira.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-func-tests</artifactId>
<version>${jira.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<instructions/>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>5.0</jira.version>
<amps.version>3.9.3</amps.version>
</properties>
</project>
33 changes: 33 additions & 0 deletions src/main/java/org/freedomsponsors/plugins/jira/SponsorThis.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.freedomsponsors.plugins.jira;

import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.config.properties.APKeys.JiraIndexConfiguration;
import com.atlassian.jira.functest.config.JiraConfig;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.plugin.webfragment.contextproviders.AbstractJiraContextProvider;
import com.atlassian.jira.plugin.webfragment.model.JiraHelper;
import com.atlassian.jira.util.http.JiraUrl;


import java.sql.Timestamp;
import java.util.HashMap;
import java.util.Map;

public class SponsorThis extends AbstractJiraContextProvider
{

@Override
public Map getContextMap(User user, JiraHelper jiraHelper) {
Map contextMap = new HashMap();
//String baseUrl = (String)jiraHelper.getContextParams().get("baseurl");
Issue currentIssue = (Issue) jiraHelper.getContextParams().get("issue");
String issueKey = currentIssue.getKey();
contextMap.put("issueKey", issueKey);
//contextMap.put("baseUrl", baseUrl);


return contextMap;
}


}
21 changes: 21 additions & 0 deletions src/main/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}"/>
</plugin-info>
<web-item key="sponsor-issue" name="Sponsor this issue" section="operations-operations" weight="100">
<label>Sponsor this issue!</label>
<tooltip>Sponsors the issue at FreedomSponsors.org</tooltip>
<link linkId="manage-project-link" absolute="true">http://www.freedomsponsors.org/core/issue/sponsor?trackerURL=${baseurl}/browse/${issue.key}</link>
</web-item>
<resource type="i18n" name="i18n" location="org.freedomsponsors.plugins.jira"/>
<web-panel name="SponsorThis" i18n-name-key="sponsor-this.name" key="sponsor-this" location="atl.jira.view.issue.right.context" weight="1000">
<label key="sponsor-this.title"/>
<description key="sponsor-this.description">The SponsorThis Plugin</description>
<!--<context-provider class="org.freedomsponsors.plugins.jira.SponsorThis"/>-->
<resource name="view" type="velocity" location="sponsorthis.vm"/>
</web-panel>
</atlassian-plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

sponsor-this.name=SponsorThis
sponsor-this.description=The SponsorThis Plugin
sponsor-this.title=Sponsor This!
3 changes: 3 additions & 0 deletions src/main/resources/sponsorthis.vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<p>
<a style="font-weight: bold; color: green;" href="http://www.freedomsponsors.org/core/issue/sponsor?trackerURL=${baseurl}/browse/${issue.key}">Sponsor $issue.key on FreedomSponsors.org $issue.project.url</a>
</p>
11 changes: 11 additions & 0 deletions src/test/java/it/MyPluginTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package it;

import org.junit.Test;

public class MyPluginTest
{
@Test
public void integrationTest()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.freedomsponsors.plugins.jira;

import org.junit.Test;

public class SponsorThisTest
{
@Test
public void testSomething()
{
}
}
3 changes: 3 additions & 0 deletions src/test/resources/TEST_RESOURCES_README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Create any of the test resources you might need in this directory.

Please remove this file before releasing your plugin.
3 changes: 3 additions & 0 deletions src/test/xml/TEST_XML_RESOURCES_README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Create all XML test resources here - these might be needed for populating JIRA instance at the integration-test phase with test data.

Please remove this file before releasing your plugin.

0 comments on commit ff86bc2

Please sign in to comment.