Ejemplo n.º 1
0
 @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$
   }
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 @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);
 }
Ejemplo n.º 4
0
 @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$
   }
 }
Ejemplo n.º 5
0
 @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$
   }
 }