Coverage Report - org.apache.maven.plugins.patchtracker.tracking.jira.JiraSession
 
Classes in this File Line Coverage Branch Coverage Complexity
JiraSession
0 %
0/14
0 %
0/2
1,167
 
 1  
 package org.apache.maven.plugins.patchtracker.tracking.jira;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.axis.encoding.Base64;
 23  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.JiraSoapService;
 24  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.RemoteAuthenticationException;
 25  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.RemoteComment;
 26  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.RemoteComponent;
 27  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.RemoteException;
 28  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.RemoteIssue;
 29  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.RemotePermissionException;
 30  
 import org.apache.maven.plugins.patchtracker.tracking.jira.soap.RemoteValidationException;
 31  
 
 32  
 import java.util.Arrays;
 33  
 import java.util.Collections;
 34  
 import java.util.List;
 35  
 
 36  
 /**
 37  
  * @author Olivier Lamy
 38  
  */
 39  
 public class JiraSession
 40  
 {
 41  
     private final JiraSoapService service;
 42  
 
 43  
     /**
 44  
      * security token is used by the server to associate SOAP invocations with the user.
 45  
      */
 46  
     private final String token;
 47  
 
 48  
     private final String projectKey;
 49  
 
 50  
     public JiraSession( JiraSoapService service, String token, String projectKey )
 51  0
     {
 52  0
         this.service = service;
 53  0
         this.token = token;
 54  0
         this.projectKey = projectKey;
 55  0
     }
 56  
 
 57  
     public RemoteIssue createIssue( RemoteIssue remoteIssue )
 58  
         throws RemotePermissionException, RemoteValidationException, RemoteAuthenticationException, RemoteException,
 59  
         java.rmi.RemoteException
 60  
     {
 61  0
         return service.createIssue( token, remoteIssue );
 62  
     }
 63  
 
 64  
     public boolean addBase64EncodedAttachmentsToIssue( String issueKey, String fileName, String attachmentContent )
 65  
         throws RemotePermissionException, RemoteValidationException, RemoteAuthenticationException, RemoteException,
 66  
         java.rmi.RemoteException
 67  
     {
 68  
 
 69  0
         return service.addBase64EncodedAttachmentsToIssue( token, issueKey, new String[]{ fileName + ".patch" },
 70  
                                                            new String[]{
 71  
                                                                Base64.encode( attachmentContent.getBytes() ) } );
 72  
     }
 73  
 
 74  
     public RemoteIssue findRemoteIssue( String issueKey )
 75  
         throws RemotePermissionException, RemoteValidationException, RemoteAuthenticationException, RemoteException,
 76  
         java.rmi.RemoteException
 77  
     {
 78  0
         return service.getIssue( token, issueKey );
 79  
     }
 80  
 
 81  
     public void addCommentToIssue( String issueKey, String comment )
 82  
         throws RemotePermissionException, RemoteValidationException, RemoteAuthenticationException, RemoteException,
 83  
         java.rmi.RemoteException
 84  
     {
 85  0
         RemoteComment remoteComment = new RemoteComment();
 86  0
         remoteComment.setBody( comment );
 87  0
         service.addComment( token, issueKey, remoteComment );
 88  0
     }
 89  
 
 90  
     public List<RemoteComponent> getRemoteComponents()
 91  
         throws RemotePermissionException, RemoteValidationException, RemoteAuthenticationException, RemoteException,
 92  
         java.rmi.RemoteException
 93  
     {
 94  0
         RemoteComponent[] remoteComponents = service.getComponents( token, projectKey );
 95  0
         return remoteComponents == null ? Collections.<RemoteComponent>emptyList() : Arrays.asList( remoteComponents );
 96  
     }
 97  
 }