コード例 #1
0
ファイル: SCTMService.java プロジェクト: davel/hudson_plugins
 @Override
 public int getLatestSCTMBuildnumber(String productName, String version) throws SCTMException {
   try {
     String[] builds = adminService.getBuilds(sessionId, productName, version);
     int latestBuildnumber = -1;
     for (String bn : builds) {
       int buildnumber = 0;
       try {
         buildnumber = Integer.parseInt(bn);
         if (buildnumber > latestBuildnumber) latestBuildnumber = buildnumber;
       } catch (NumberFormatException e) {
         LOGGER.warning(
             MessageFormat.format(
                 "Build number ({0}) is not a number. Ignoring it.", buildnumber));
       }
     }
     return latestBuildnumber;
   } catch (RemoteException e) {
     if (handleLostSessionException(e)) return getLatestSCTMBuildnumber(productName, version);
     LOGGER.log(Level.SEVERE, e.getMessage(), e);
     throw new SCTMException(
         MessageFormat.format(
             Messages.getString("SCTMService.err.commonFatalError"),
             e.getMessage())); // $NON-NLS-1$
   }
 }
コード例 #2
0
ファイル: SCTMService.java プロジェクト: davel/hudson_plugins
 private String getProductName(ExecutionNode node) throws RemoteException {
   String testContainerId = getExecutionNodePropertyValue(node, "PROP_TESTCONTAINER");
   String productId =
       planningService
           .getProperty(sessionId, testContainerId, "_node_properties_ProductID_pk_fk")
           .getValue();
   String productName = adminService.getProductNameById(sessionId, Integer.valueOf(productId));
   return productName;
 }
コード例 #3
0
ファイル: SCTMService.java プロジェクト: davel/hudson_plugins
 @Override
 public Collection<String> getAllVersions(int execDefId) throws SCTMException {
   String[] versions = new String[0];
   try {
     ExecutionNode node = getExecDefNode(execDefId);
     versions = adminService.getVersions(execDefId, getProductName(node));
   } catch (RemoteException e) {
     if (handleLostSessionException(e)) return getAllVersions(execDefId);
     LOGGER.log(Level.SEVERE, e.getMessage(), e);
     throw new SCTMException(
         MessageFormat.format(
             Messages.getString("SCTMService.err.commonFatalError"),
             e.getMessage())); // $NON-NLS-1$
   }
   return toList(versions);
 }
コード例 #4
0
ファイル: SCTMService.java プロジェクト: davel/hudson_plugins
 @Override
 public boolean buildNumberExists(String productName, String version, int buildNumber)
     throws SCTMException {
   try {
     String[] builds = adminService.getBuilds(sessionId, productName, version);
     String value = String.valueOf(buildNumber);
     for (String build : builds) {
       if (value.equals(build)) return true;
     }
     return false;
   } catch (RemoteException e) {
     if (handleLostSessionException(e))
       return buildNumberExists(productName, version, buildNumber);
     LOGGER.log(Level.SEVERE, e.getMessage(), e);
     throw new SCTMException(
         MessageFormat.format(
             Messages.getString("SCTMService.err.commonFatalError"),
             e.getMessage())); // $NON-NLS-1$
   }
 }
コード例 #5
0
ファイル: SCTMService.java プロジェクト: davel/hudson_plugins
 @Override
 public boolean addBuildNumber(String productName, String version, int buildNumber)
     throws SCTMException {
   try {
     return adminService.addBuild(
         sessionId,
         productName,
         version,
         String.valueOf(buildNumber),
         "build number generated by hudson continuous integration system",
         true);
   } catch (RemoteException e) {
     if (handleLostSessionException(e)) addBuildNumber(productName, version, buildNumber);
     LOGGER.log(Level.SEVERE, e.getMessage(), e);
     throw new SCTMException(
         MessageFormat.format(
             Messages.getString("SCTMService.err.commonFatalError"),
             e.getMessage())); // $NON-NLS-1$
   }
 }