Skip to content

Commit

Permalink
add jira test environment project
Browse files Browse the repository at this point in the history
  • Loading branch information
kompiro committed Jun 21, 2013
1 parent 85c17e6 commit df3f07c
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jira/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 the Apache2 license: http://opensource.org/licenses/Apache-2.0
13 changes: 13 additions & 0 deletions jira/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
You have successfully created an Atlassian Plugin!

Here are the SDK commands you'll use immediately:

* atlas-run -- installs this plugin into the product and starts it on localhost
* 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 product instance
* atlas-help -- prints description for all commands in the SDK

Full documentation is always available at:

https://developer.atlassian.com/display/DOCS/Introduction+to+the+Atlassian+Plugin+SDK
116 changes: 116 additions & 0 deletions jira/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?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>com.change_vision</groupId>
<artifactId>jira-test-runtime</artifactId>
<version>1.0-SNAPSHOT</version>

<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>

<name>test</name>
<description>This is the com.change_vision.test:test 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.10</version>
<scope>test</scope>
</dependency>

<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>

<!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
<!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
<!--
<dependency>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-client</artifactId>
<version>${testkit.version}</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>
<!-- Uncomment to install TestKit backdoor in JIRA. -->
<!--
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-plugin</artifactId>
<version>${testkit.version}</version>
</pluginArtifact>
</pluginArtifacts>
-->
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<jira.version>6.0.2</jira.version>
<amps.version>4.2.2</amps.version>
<plugin.testrunner.version>1.1.1</plugin.testrunner.version>
<!-- TestKit version 5.x for JIRA 5.x, 6.x for JIRA 6.x -->
<testkit.version>5.2.26</testkit.version>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.change_vision.test;

public interface MyPluginComponent
{
String getName();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.change_vision.test;

import com.atlassian.sal.api.ApplicationProperties;

public class MyPluginComponentImpl implements MyPluginComponent
{
private final ApplicationProperties applicationProperties;

public MyPluginComponentImpl(ApplicationProperties applicationProperties)
{
this.applicationProperties = applicationProperties;
}

public String getName()
{
if(null != applicationProperties)
{
return "myComponent:" + applicationProperties.getDisplayName();
}

return "myComponent";
}
}
32 changes: 32 additions & 0 deletions jira/src/main/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<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}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>

<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="test"/>

<!-- add our web resources -->
<web-resource key="test-resources" name="test Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="test.css" location="/css/test.css"/>
<resource type="download" name="test.js" location="/js/test.js"/>
<resource type="download" name="images/" location="/images"/>

<context>test</context>
</web-resource>

<!-- publish our component -->
<component key="myPluginComponent" class="com.change_vision.test.MyPluginComponentImpl" public="true">
<interface>com.change_vision.test.MyPluginComponent</interface>
</component>

<!-- import from the product container -->
<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />

</atlassian-plugin>
Empty file.
Binary file added jira/src/main/resources/images/pluginIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added jira/src/main/resources/images/pluginLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
2 changes: 2 additions & 0 deletions jira/src/main/resources/test.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#put any key/value pairs here
my.plugin.name=MyPlugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package it.com.change_vision.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import com.atlassian.plugins.osgi.test.AtlassianPluginsTestRunner;
import com.change_vision.test.MyPluginComponent;
import com.atlassian.sal.api.ApplicationProperties;

import static org.junit.Assert.assertEquals;

@RunWith(AtlassianPluginsTestRunner.class)
public class MyComponentWiredTest
{
private final ApplicationProperties applicationProperties;
private final MyPluginComponent myPluginComponent;

public MyComponentWiredTest(ApplicationProperties applicationProperties,MyPluginComponent myPluginComponent)
{
this.applicationProperties = applicationProperties;
this.myPluginComponent = myPluginComponent;
}

@Test
public void testMyName()
{
assertEquals("names do not match!", "myComponent:" + applicationProperties.getDisplayName(),myPluginComponent.getName());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ut.com.change_vision.test;

import org.junit.Test;
import com.change_vision.test.MyPluginComponent;
import com.change_vision.test.MyPluginComponentImpl;

import static org.junit.Assert.assertEquals;

public class MyComponentUnitTest
{
@Test
public void testMyName()
{
MyPluginComponent component = new MyPluginComponentImpl(null);
assertEquals("names do not match!", "myComponent",component.getName());
}
}
14 changes: 14 additions & 0 deletions jira/src/test/resources/atlassian-plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<atlassian-plugin key="${project.groupId}.${project.artifactId}-tests" 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>

<!-- from our base plugin -->
<component-import key="myComponent" interface="com.change_vision.test.MyPluginComponent"/>

<!-- from the product container -->
<component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />

</atlassian-plugin>

0 comments on commit df3f07c

Please sign in to comment.