Mercurial > public > JIRA
changeset 0:92d945347fc0
V2 of the SSDT JIRA Plugins. Uses new Maven 2 based project. Created
for JIRA 3.12.
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/.cvsignore Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,1 @@ +target
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/LICENSE.TXT Tue May 20 17:11:35 2008 -0400 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/README.txt Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,66 @@ + +SSDT JIRA Plugin +---------------- + +This project uses NetBeans with the Maven 2 plugin to build the project. + +Use the "package" goal to build the jar. + +The rest of this README is the default from the JIRA archetype. + +-------------------------------------------------------------- + + + +1. CUSTOMISE THE PLUGIN + +- Run 'mvn eclipse:eclipse' to generate an Eclipse project file. +- Edit pom.xml. Add information about your project, its developers and your organisation. +- Add dependencies as necessary +- Edit the plugin descriptor, src/main/resources/atlassian-plugin.xml. Add or modify plugin modules in your project. +- Edit the plugin code in src/main/java/ or the unit tests in src/test/java/. + +2. BUILD THE PLUGIN + +Building with your plugin with Maven is really easy: + +- Run 'mvn compile' to compile the plugin. +- Run 'mvn test' to run the unit tests. +- Run 'mvn integration-test' to run the integration tests. +- Run 'mvn package' to produce the JAR. + +For the above commands to skip the various test phases add one of the following options to the command: + + -Dmaven.test.skip=true - skips both unit and integration tests + -Dmaven.test.unit.skip=true - skips unit tests + -Dmaven.test.it.skip=true - skips integration tests + +XML data that is usually imported into the JIRA instance by the tests should be placed in: + + src/test/xml/ directory provided + +Packages containing integration tests should start with it. For instance: + it.com.atlassian.jira.plugins.fisheye.TestSomething + it.com.atlassian.jira.plugins.calendar.TestSomethingElse + +Hence these classes should go under src/test/java/it/directory + +The following system properties are available to control the behaviour of the integration test harness: + + tomcat.installer.url - path to the tomcat zip file to install. Default: http://repository.atlassian.com/maven2/org/apache/tomcat/apache-tomcat/5.5.20/apache-tomcat-5.5.20-jdk14.zip + + cargo.wait - if this is set o true - tomcat will be started up and then cargo would suspend allowing you to manually access this JIRA from the browser. + + jira.version - version of JIRA to compile and test against. default is 3.10.2 + + jira.data.version - version of the test resource bundle that contains the bre basic JIRA configuration data for the integration test environment. These versions mimic the actual JIRA versions. However we might only modify and release this project for the reasons of non-backwards compatibility of the new versions of JIRA. Therefore not every version of JIRA will have a corresponding version of the resource bundle. By default this is set to 3.10 which should be migrated and work correctly with the newer versions. + + jira.test-lib.version - version of jira-func-tests JAR to compile and test against. default is 3.10-DEV + + http.port - port on which this instance of JIRA will be accessible on. Default: 8989 + + jira.url - base URL for this instance of JIRA. Default: http://localhost:{http.port}/jira/ + rmi.port + + +Please remove this file before releasing your plugin.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/nb-configuration.xml Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project-shared-configuration> +This file contains additional configuration written by modules in the NetBeans IDE. +The configuration is intended to be shared among all the users of project and +therefore it is assumed to be part of version control checkout. +Without this configuration present, some functionality in the IDE may be limited or fail altogether. + +<spring-data xmlns="http://www.netbeans.org/ns/spring-data/1"> + <config-files/> + <config-file-groups/> + </spring-data> +</project-shared-configuration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/nbactions.xml Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<actions> + <action> + <actionName>CUSTOM-Package</actionName> + <displayName>Package</displayName> + <goals> + <goal>package</goal> + </goals> + </action> + </actions>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/pom.xml Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,122 @@ +<?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"> + + <parent> + <groupId>com.atlassian.jira.plugins</groupId> + <artifactId>jira-plugin-base</artifactId> + <version>5</version> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.nwoca.ssdt.jira</groupId> + <artifactId>ssdt-jira-plugins</artifactId> + <version>2.0-SNAPSHOT</version> + + <name>SSDT JIRA Plugins V2</name> + <packaging>jar</packaging> + <description>Custom plugs by SSDT for work flow.</description> + + <properties> + <atlassian.plugin.key>org.nwoca.ssdt.jira.plugins</atlassian.plugin.key> + <!-- + Change this property to compile your plugin against different JIRA + versions. + --> + <jira.version>3.12</jira.version> + </properties> + + <!-- TODO: Add project description --> + <!-- + <description></description> + <url></url> + --> + + <!-- TODO: Complete developer details --> + <!-- + <developers> + <developer> + <name>John Smith</name> + <organization>Example Company</organization> + </developer> + </developers> + --> + + <!-- TODO: Complete source control details --> + <!-- + <scm> + <connection></connection> + <developerConnection></developerConnection> + <url></url> + </scm> + --> + + <build> + <!-- + The following plugin definitions are required to invoke functions that + build run-time environment for running integration tests against JIRA + --> + <plugins> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.cargo</groupId> + <artifactId>cargo-maven2-plugin</artifactId> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.0.2</version> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>plugin-debug</id> + <build> + <defaultGoal>verify</defaultGoal> + </build> + <activation> + </activation> + <properties> + <http.port>8080</http.port> + <rmi.port>9001</rmi.port> + <maven.test.skip>true</maven.test.skip> + <cargo.wait>true</cargo.wait> + <jvmargs>-Xms128m -Xmx256m -Xdebug -Xnoagent -Xrunjdwp:server=y,transport=dt_socket,address=5005,suspend=n</jvmargs> + <jira.config.directory>plugin-debug</jira.config.directory> + <unpack.jira.config.overwrite>false</unpack.jira.config.overwrite> + </properties> + </profile> + </profiles> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <distributionManagement> + <repository> + <id>atlassian-contrib</id> + <name>Atlassian repository of contributed code</name> + <url>dav:https://maven.atlassian.com/contrib</url> + </repository> + <snapshotRepository> + <id>atlassian-contrib-snapshot</id> + <name>Atlassian repository of contributed code snapshots</name> + <url>dav:https://maven.atlassian.com/contrib-snapshot</url> + </snapshotRepository> + </distributionManagement> + +</project>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/BlockFixedResolutionValidator.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,53 @@ +/* + * RequireDocumentIssueValidator.java + * + * Created on May 14, 2007, 1:04 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package org.nwoca.ssdt.jira; + +import com.atlassian.jira.ComponentManager; +import com.atlassian.jira.ManagerFactory; +import com.atlassian.jira.issue.Issue; +import com.atlassian.jira.issue.MutableIssue; +import com.atlassian.jira.issue.fields.CustomField; +import com.atlassian.jira.issue.link.IssueLink; +import com.atlassian.jira.issue.link.IssueLinkManager; +import com.atlassian.jira.workflow.WorkflowActionsBean; +import com.opensymphony.module.propertyset.PropertySet; +import com.opensymphony.workflow.InvalidInputException; +import com.opensymphony.workflow.Validator; +import com.opensymphony.workflow.WorkflowException; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * Validator blocks Fixed resolution. Use for Workflow steps where "fixed" is + *not appropriate. + * + * @author SMITH + */ +public class BlockFixedResolutionValidator implements Validator { + + + /** + * Creates a new instance of RequireDocumentIssueValidator. + */ + public BlockFixedResolutionValidator() { + } + + public void validate(Map transientVars, Map args, PropertySet ps) + throws InvalidInputException, WorkflowException { + + Issue issue = (Issue) transientVars.get("issue"); + if ("Fixed".equalsIgnoreCase(issue.getResolutionObject().getName()) ) { + throw new InvalidInputException("Can not use 'Fixed' resolution at this step"); + } + + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/BlockFixedResolutionValidatorFactory.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,40 @@ +/* + * RequireDocumentIssueValidatorFactory.java + * + * Created on May 14, 2007, 2:56 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package org.nwoca.ssdt.jira; + +import com.atlassian.jira.plugin.workflow.AbstractWorkflowPluginFactory; +import com.atlassian.jira.plugin.workflow.WorkflowPluginValidatorFactory; +import com.opensymphony.workflow.loader.AbstractDescriptor; +import java.util.Map; + +/** + * + * @author SMITH + */ +public class BlockFixedResolutionValidatorFactory extends + AbstractWorkflowPluginFactory implements WorkflowPluginValidatorFactory { + /** Creates a new instance of RequireDocumentIssueValidatorFactory */ + public BlockFixedResolutionValidatorFactory() { + } + + protected void getVelocityParamsForView(Map map, AbstractDescriptor abstractDescriptor) { + } + + protected void getVelocityParamsForInput(Map map) { + } + + protected void getVelocityParamsForEdit(Map map, AbstractDescriptor abstractDescriptor) { + } + + public Map getDescriptorParams(Map map) { + return map; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/IsTestingUserCondition.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,56 @@ +/* + * IsTestingUserCondition.java + * + * Created on May 11, 2007, 5:07 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package org.nwoca.ssdt.jira; + +import com.atlassian.jira.ManagerFactory; +import com.atlassian.jira.issue.Issue; +import com.atlassian.jira.issue.fields.CustomField; +import com.atlassian.jira.workflow.condition.AbstractJiraCondition; +import java.util.Map; +import com.opensymphony.module.propertyset.PropertySet; +import com.opensymphony.user.User; + +/** + * Our first plugin to simply see if the current user is the "Testing Assignee". + * The plugin is not very clever (e.g. name of custom field is hard-coded) but + * suffices for now. + * + * @author SMITH + */ +public class IsTestingUserCondition extends AbstractJiraCondition { + + /** Creates a new instance of IsTestingUserCondition. */ + public IsTestingUserCondition() { + } + + public boolean passesCondition(Map transientVars, Map args, PropertySet ps) { + + Issue issue = (Issue) transientVars.get("issue"); + + CustomField testerField = ManagerFactory.getCustomFieldManager() + .getCustomFieldObjectByName("QA Assignee"); + + if (testerField == null) { + return false; + } + + User tester = (User)issue.getCustomFieldValue(testerField); + + if (tester == null) { + return false; + } + + User caller = getCaller(transientVars,args); + + return caller.getName().equals(tester.getName()); + + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/IsTestingUserConditionFactory.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,40 @@ +/* + * IsTestingUserConditionFactory.java + * + * Created on May 13, 2007, 7:07 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package org.nwoca.ssdt.jira; +import java.util.Map; + +import com.atlassian.jira.plugin.workflow.AbstractWorkflowPluginFactory; +import com.atlassian.jira.plugin.workflow.WorkflowPluginConditionFactory; +import com.atlassian.jira.util.map.EasyMap; +import com.opensymphony.workflow.loader.AbstractDescriptor; + + +/** + * + * @author SMITH + */ +public class IsTestingUserConditionFactory extends AbstractWorkflowPluginFactory + implements WorkflowPluginConditionFactory { + + protected void getVelocityParamsForEdit(Map arg0, AbstractDescriptor arg1) { + } + + protected void getVelocityParamsForInput(Map arg0) { + } + + protected void getVelocityParamsForView(Map arg0, AbstractDescriptor arg1) { + } + + public Map getDescriptorParams(Map arg0) { + return EasyMap.build(); + } + + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/RequireDocumentIssueValidator.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,88 @@ +/* + * RequireDocumentIssueValidator.java + * + * Created on May 14, 2007, 1:04 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package org.nwoca.ssdt.jira; + +import com.atlassian.jira.ComponentManager; +import com.atlassian.jira.ManagerFactory; +import com.atlassian.jira.issue.Issue; +import com.atlassian.jira.issue.MutableIssue; +import com.atlassian.jira.issue.fields.CustomField; +import com.atlassian.jira.issue.link.IssueLink; +import com.atlassian.jira.issue.link.IssueLinkManager; +import com.atlassian.jira.workflow.WorkflowActionsBean; +import com.opensymphony.module.propertyset.PropertySet; +import com.opensymphony.workflow.InvalidInputException; +import com.opensymphony.workflow.Validator; +import com.opensymphony.workflow.WorkflowException; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * Validator requires to an issue type of "Document" or a sub-task of type "Document". + * + * These are custom issue types used by the SSDT. + * + * @author SMITH + */ +public class RequireDocumentIssueValidator implements Validator { + + + /** + * Creates a new instance of RequireDocumentIssueValidator + */ + public RequireDocumentIssueValidator() { + } + + public void validate(Map transientVars, Map args, PropertySet ps) + throws InvalidInputException, WorkflowException { + + Issue issue = (Issue) transientVars.get("issue"); + CustomField docRequiredField = ManagerFactory.getCustomFieldManager() + .getCustomFieldObjectByName("Documentation Required"); + + if (docRequiredField == null) { + return; + } + + String docRequired = (String)issue.getCustomFieldValue(docRequiredField); + + if (docRequired == null || docRequired.startsWith("No")) { + return; + } + + if (docRequired.startsWith("Yes")) { + + Collection subtasks = issue.getSubTaskObjects(); + for (Object o : subtasks) { + MutableIssue subt = (MutableIssue)o; + if (subt.getIssueTypeObject().getName().equals("Document Subtask")) { + return; + } + } + + IssueLinkManager lm = ComponentManager.getInstance().getIssueLinkManager(); + List links = lm.getOutwardLinks(issue.getId()); + for (Object o : links) { + IssueLink link = (IssueLink)o; + if (link.getIssueLinkType().getName().equals("Documention") ) { + return; + } + } + + throw new InvalidInputException("Issue requiring documentation must have " + + "at least one 'Document' Subtask or a 'Documention' link." ); + + } + + return; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/java/org/nwoca/ssdt/jira/RequireDocumentIssueValidatorFactory.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,40 @@ +/* + * RequireDocumentIssueValidatorFactory.java + * + * Created on May 14, 2007, 2:56 PM + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package org.nwoca.ssdt.jira; + +import com.atlassian.jira.plugin.workflow.AbstractWorkflowPluginFactory; +import com.atlassian.jira.plugin.workflow.WorkflowPluginValidatorFactory; +import com.opensymphony.workflow.loader.AbstractDescriptor; +import java.util.Map; + +/** + * + * @author SMITH + */ +public class RequireDocumentIssueValidatorFactory extends + AbstractWorkflowPluginFactory implements WorkflowPluginValidatorFactory { + /** Creates a new instance of RequireDocumentIssueValidatorFactory */ + public RequireDocumentIssueValidatorFactory() { + } + + protected void getVelocityParamsForView(Map map, AbstractDescriptor abstractDescriptor) { + } + + protected void getVelocityParamsForInput(Map map) { + } + + protected void getVelocityParamsForEdit(Map map, AbstractDescriptor abstractDescriptor) { + } + + public Map getDescriptorParams(Map map) { + return map; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/resources/atlassian-plugin.xml Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,33 @@ + +<atlassian-plugin key="org.nwoca.ssdt.jira.ssdt-jira-plugins" name="SSDT JIRA Plugins V2"> + + <plugin-info> + <description>SSDT JIRA Plugin</description> + <version>2.0</version> + <application-version min="3.12" max="3.12"/> + <vendor name="SSDT" url="http://ssdt.oecn.k12.oh.us/"/> + </plugin-info> + + <workflow-condition + key="istestinguser-condition" + name="Only the QA Assignee" + class="org.nwoca.ssdt.jira.IsTestingUserConditionFactory"> + <description>Condition to allow only the QA Assignee to execute this transition</description> + <condition-class>org.nwoca.ssdt.jira.IsTestingUserCondition</condition-class> + <resource type="velocity" name="view" location="templates/iftestinguser-condition-view.vm"/> + </workflow-condition> + <workflow-validator key="requiredocumentation-validator" name="Check Documentation Issue Required" + class="org.nwoca.ssdt.jira.RequireDocumentIssueValidatorFactory"> + <description>Check if the issue has a required Document Issue linked or sub-task.</description> + <validator-class>org.nwoca.ssdt.jira.RequireDocumentIssueValidator</validator-class> + <resource type="velocity" name="view" + location="templates/requiredocument-validator-view.vm"/> + </workflow-validator> + <workflow-validator key="blockedfixed-validator" name="Prevent Fixed Resolution" + class="org.nwoca.ssdt.jira.BlockFixedResolutionValidatorFactory"> + <description>Prevent "Fixed" Resolution</description> + <validator-class>org.nwoca.ssdt.jira.BlockFixedResolutionValidator</validator-class> + <resource type="velocity" name="view" + location="templates/blockfixed-validator-view.vm"/> + </workflow-validator> +</atlassian-plugin>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/resources/templates/blockfixed-validator-view.vm Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,1 @@ +Prevent "fixed" resolution at this step. \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/resources/templates/iftestinguser-condition-view.vm Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,1 @@ +Current user is the QA Assignee \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/main/resources/templates/requiredocument-validator-view.vm Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,2 @@ +If the issue requires documentation updates then check there is at least one "Document" sub-task or +a "Documentation" link on the issue. \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/test/java/it/IntegrationTestMyPlugin.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,10 @@ +package it; + +import junit.framework.TestCase; + +public class IntegrationTestMyPlugin extends TestCase +{ + public void testSomething() + { + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/test/java/org/nwoca/ssdt/jira/UnitTestMyPlugin.java Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,10 @@ +package org.nwoca.ssdt.jira; + +import junit.framework.TestCase; + +public class UnitTestMyPlugin extends TestCase +{ + public void testSomething() + { + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/test/resources/TEST_RESOURCES_README.txt Tue May 20 17:11:35 2008 -0400 @@ -0,0 +1,4 @@ +Create any of the test resources you might need in this directory. + +Please remove this file before releasing your plugin. + \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ssdt-jira-plugins-v2/plugins/src/test/xml/IntegrationTestData.xml Tue May 20 17:11:35 2008 -0400 @@ -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.