Author: jvanzyl
Date: Mon Dec 12 13:55:27 2005
New Revision: 356389
URL: http://svn.apache.org/viewcvs?rev=356389&view=rev
Log:
o moving pomo over to mojo
Added:
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/jira.properties
(with props)
Modified:
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/main/java/org/apache/maven/issue/jira/JiraSoapClient.java
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/java/org/apache/maven/issue/jira/JiraSoapClientTest.java
Modified:
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/main/java/org/apache/maven/issue/jira/JiraSoapClient.java
URL:
http://svn.apache.org/viewcvs/maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/main/java/org/apache/maven/issue/jira/JiraSoapClient.java?rev=356389&r1=356388&r2=356389&view=diff
==============================================================================
---
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/main/java/org/apache/maven/issue/jira/JiraSoapClient.java
(original)
+++
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/main/java/org/apache/maven/issue/jira/JiraSoapClient.java
Mon Dec 12 13:55:27 2005
@@ -1,39 +1,40 @@
package org.apache.maven.issue.jira;
+import org.apache.maven.issue.jira.authentication.AuthenticationSource;
+import org.apache.maven.issue.jira.project.ProjectRecordSource;
+import org.apache.maven.issue.jira.project.ProjectRecordRetrievalException;
+import org.apache.maven.issue.jira.project.ProjectRecord;
+
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
+import java.rmi.RemoteException;
+import java.util.Map;
+import java.util.Iterator;
public class JiraSoapClient
{
- private String login;
-
- private String password;
-
private URL endpoint;
private String token;
private JiraSoapService service;
+ private AuthenticationSource authenticationSource;
+
// ----------------------------------------------------------------------
// Accessors
// ----------------------------------------------------------------------
- public void setLogin( String login )
- {
- this.login = login;
- }
-
- public void setPassword( String password )
+ public void setEndpoint( URL endpoint )
{
- this.password = password;
+ this.endpoint = endpoint;
}
- public void setEndpoint( URL endpoint )
+ public void setAuthenticationSource( AuthenticationSource
authenticationSource )
{
- this.endpoint = endpoint;
+ this.authenticationSource = authenticationSource;
}
// ----------------------------------------------------------------------
@@ -43,11 +44,90 @@
public void initialize()
throws Exception
{
- JiraSoapServiceService jiraSoapServiceGetter = new
JiraSoapServiceServiceLocator();
+ JiraSoapServiceService jiraSoapServiceLocator = new
JiraSoapServiceServiceLocator();
+
+ service = jiraSoapServiceLocator.getJirasoapserviceV2( endpoint );
+
+ authenticationSource.initialize();
+
+ token = service.login( authenticationSource.getLogin(),
authenticationSource.getPassword() );
+ }
+
+ // ----------------------------------------------------------------------
+ // Projects
+ // ----------------------------------------------------------------------
+
+ /**
+ * Create a series of projects from a ProjectRecordSource
+ * @param source
+ * @throws RemoteException
+ * @throws ProjectRecordRetrievalException
+ */
+ public void createProjects( ProjectRecordSource source )
+ throws RemoteException, ProjectRecordRetrievalException
+ {
+ for ( Iterator i = source.getRecords(); i.hasNext(); )
+ {
+ ProjectRecord record = (ProjectRecord) i.next();
+
+ createProject( record.getKey(), record.getLeadId(),
record.getName(), record.getDescription() );
+ }
+ }
+
+ public String createProject( String projectKey, String leadId, String
projectName, String projectDescription )
+ throws RemoteException
+ {
+ RemoteProject project = new RemoteProject();
+
+ project.setKey( projectKey );
+
+ project.setLead( leadId );
+
+ project.setName( projectName );
+
+ project.setDescription( projectDescription );
+
+ //
----------------------------------------------------------------------
+ // Permission Scheme
+ //
----------------------------------------------------------------------
+
+ RemotePermissionScheme defaultPermScheme = new
RemotePermissionScheme();
+
+ defaultPermScheme.setId( new Long( 0 ) );
+
+ project.setPermissionScheme( defaultPermScheme );
+
+ //
----------------------------------------------------------------------
+ // Notification Scheme
+ //
----------------------------------------------------------------------
+
+ RemoteScheme notificationScheme = new RemoteScheme();
+
+ notificationScheme.setId( new Long( 0 ) );
+
+ project.setNotificationScheme( notificationScheme );
+
+ //
----------------------------------------------------------------------
+ //
+ //
----------------------------------------------------------------------
+
+ RemoteProject returnedProject = service.createProjectFromObject(
token, project );
+
+ projectKey = returnedProject.getKey();
+
+ return projectKey;
+ }
+
+ public void addVersion( String projectKey, String version )
+ throws RemoteException
+ {
+ RemoteVersion remoteVersion = new RemoteVersion();
+
+ remoteVersion.setName( version );
- service = jiraSoapServiceGetter.getJirasoapserviceV2( endpoint );
+ remoteVersion.setSequence( new Long( 6 ) );
- token = service.login( login, password );
+ service.addVersion( token, projectKey, remoteVersion );
}
// ----------------------------------------------------------------------
@@ -62,12 +142,12 @@
String componentId,
String versionId,
String assigneeId )
- throws java.rmi.RemoteException
+ throws RemoteException
{
return createIssue( projectKey, summary, description, issueTypeId,
priorityId, componentId, versionId, assigneeId, null );
}
-
+ // Attachments are currently busted in the JIRA soap interface
public RemoteIssue createIssue( String projectKey,
String summary,
String description,
@@ -77,7 +157,7 @@
String versionId,
String assigneeId,
File attachment )
- throws java.rmi.RemoteException
+ throws RemoteException
{
RemoteIssue issue = new RemoteIssue();
@@ -123,7 +203,7 @@
}
public void testGetIssues( String filterId )
- throws java.rmi.RemoteException
+ throws RemoteException
{
RemoteIssue[] issues = service.getIssuesFromFilter( token, filterId );
@@ -134,10 +214,8 @@
}
}
- public void findIssuesWithTerm
- ( String
- term )
- throws java.rmi.RemoteException
+ public void findIssuesWithTerm( String term )
+ throws RemoteException
{
long startTime = System.currentTimeMillis();
@@ -155,7 +233,7 @@
/*
public void updateIssue( String issueKey )
- throws java.rmi.RemoteException
+ throws RemoteException
{
getFieldsForEdit( issueKey );
@@ -169,10 +247,8 @@
}
*/
- public void getFieldsForEdit
- ( String
- issueKey )
- throws java.rmi.RemoteException
+ public void getFieldsForEdit( String issueKey )
+ throws RemoteException
{
// Editing the issue & getting the fields available on edit
System.out.println( "The issue " + issueKey + " has the following
editable fields:" );
@@ -185,7 +261,7 @@
}
public void addComment( String issueKey, String comment )
- throws java.rmi.RemoteException
+ throws RemoteException
{
final RemoteComment remoteComment = new RemoteComment();
@@ -195,7 +271,7 @@
}
public void addAttachemnt( String issueKey, File attachment )
- throws java.rmi.RemoteException
+ throws RemoteException
{
RemoteIssue issue = service.getIssue( token, issueKey );
@@ -203,7 +279,7 @@
}
public void addAttachment( RemoteIssue issue, File attachment )
- throws java.rmi.RemoteException
+ throws RemoteException
{
boolean added = service.addAttachmentToIssue( token, new
String[]{attachment.getAbsolutePath()}, issue );
}
@@ -213,7 +289,7 @@
// ----------------------------------------------------------------------
public void testUpdateGroup()
- throws java.rmi.RemoteException
+ throws RemoteException
{
System.out.println( "Testing group update.." );
RemoteGroup group = service.getGroup( token, "jira-developers" );
@@ -241,7 +317,7 @@
// ----------------------------------------------------------------------
public void testGetAllPermissions()
- throws java.rmi.RemoteException
+ throws RemoteException
{
RemotePermission[] allPermissions = service.getAllPermissions( token );
for ( int i = 0; i < allPermissions.length; i++ )
@@ -252,27 +328,11 @@
}
// ----------------------------------------------------------------------
- // Versions
- // ----------------------------------------------------------------------
-
- public void addVersion( String projectKey, String version )
- throws java.rmi.RemoteException
- {
- RemoteVersion remoteVersion = new RemoteVersion();
-
- remoteVersion.setName( version );
-
- remoteVersion.setSequence( new Long( 6 ) );
-
- service.addVersion( token, projectKey, remoteVersion );
- }
-
- // ----------------------------------------------------------------------
// Custom Fields
// ----------------------------------------------------------------------
public void testGetCustomFields()
- throws java.rmi.RemoteException
+ throws RemoteException
{
final RemoteField[] customFields = service.getCustomFields( token );
for ( int i = 0; i < customFields.length; i++ )
@@ -287,7 +347,7 @@
// ----------------------------------------------------------------------
public void testGetFilters()
- throws java.rmi.RemoteException
+ throws RemoteException
{
System.out.println( "All saved filters:" );
RemoteFilter[] savedFilters = service.getSavedFilters( token );
@@ -299,37 +359,6 @@
}
}
- // ----------------------------------------------------------------------
- // Project
- // ----------------------------------------------------------------------
-
- public String createProject( String projectKey, String leadId, String
projectName, String projectDescription )
- throws java.rmi.RemoteException
- {
- RemoteProject project = new RemoteProject();
-
- project.setKey( projectKey );
-
- project.setLead( leadId );
-
- project.setName( projectName );
-
- project.setDescription( projectDescription );
-
- RemotePermissionScheme defaultPermScheme = new
RemotePermissionScheme();
-
- defaultPermScheme.setId( new Long( 0 ) );
-
- project.setPermissionScheme( defaultPermScheme );
-
- RemoteProject returnedProject = service.createProjectFromObject(
token, project );
-
- projectKey = returnedProject.getKey();
-
- service.deleteProject( token, returnedProject.getKey() );
-
- return projectKey;
- }
public void printIssueDetails( RemoteIssue issue )
{
Modified:
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/java/org/apache/maven/issue/jira/JiraSoapClientTest.java
URL:
http://svn.apache.org/viewcvs/maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/java/org/apache/maven/issue/jira/JiraSoapClientTest.java?rev=356389&r1=356388&r2=356389&view=diff
==============================================================================
---
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/java/org/apache/maven/issue/jira/JiraSoapClientTest.java
(original)
+++
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/java/org/apache/maven/issue/jira/JiraSoapClientTest.java
Mon Dec 12 13:55:27 2005
@@ -5,9 +5,11 @@
import java.io.File;
import java.net.URL;
+import
org.apache.maven.issue.jira.authentication.PropertiesFileAuthenticationSource;
+
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id:$
+ * @version $Id$
*/
public class JiraSoapClientTest
extends TestCase
@@ -25,14 +27,12 @@
client.setEndpoint( new URL(
"http://jira.codehaus.org/rpc/soap/jirasoapservice-v2" ) );
- client.setLogin( "jason" );
-
- client.setPassword( "jira913" );
+ client.setAuthenticationSource( new
PropertiesFileAuthenticationSource() );
client.initialize();
}
- public void testIssueCreationWithAttachment()
+ public void xtestIssueCreationWithAttachment()
throws Exception
{
File pom = new File( basedir, "pom.xml" );
@@ -40,5 +40,11 @@
RemoteIssue issue = client.createIssue( "MNGTEST", "test summary",
"test description", "1", "1", "11797", "11704", "jason", pom );
client.addComment( issue.getKey(), "patch:
http://www.codehaus.org/foo.diff" );
+ }
+
+ public void testProjectCreation()
+ throws Exception
+ {
+ String key = client.createProject( "AAA", "jason", "AAA", "This
project is rockin!" );
}
}
Added:
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/jira.properties
URL:
http://svn.apache.org/viewcvs/maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/jira.properties?rev=356389&view=auto
==============================================================================
---
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/jira.properties
(added)
+++
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/jira.properties
Mon Dec 12 13:55:27 2005
@@ -0,0 +1,2 @@
+user: jason
+password: monkey
Propchange:
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/jira.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/issue/maven-issue-providers/maven-issue-provider-jira/src/test/resources/jira.properties
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"