Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISPW/Git - Add Build function to ISPW Operations Plugin in Jenkins https://agile.compuware.com/browse/CWE-151163
- Loading branch information
1 parent
7164480
commit edc96a6
Showing
9 changed files
with
549 additions
and
3 deletions.
There are no files selected for viewing
126 changes: 126 additions & 0 deletions
126
src/main/java/com/compuware/ispw/model/rest/BuildResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
/** | ||
* These materials contain confidential information and trade secrets of Compuware Corporation. You shall maintain the materials | ||
* as confidential and shall not disclose its contents to any third party except as may be required by law or regulation. Use, | ||
* disclosure, or reproduction is prohibited without the prior express written permission of Compuware Corporation. | ||
* | ||
* All Compuware products listed within the materials are trademarks of Compuware Corporation. All other company or product | ||
* names are trademarks of their respective owners. | ||
* | ||
* Copyright (c) 2019 Compuware Corporation. All rights reserved. | ||
*/ | ||
package com.compuware.ispw.model.rest; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
/** | ||
* | ||
*/ | ||
@XmlRootElement(name="build") | ||
@XmlAccessorType(XmlAccessType.NONE) | ||
public class BuildResponse | ||
{ | ||
@XmlElement(name = "setId") | ||
private String setId; | ||
@XmlElement(name = "assignmentId") | ||
private String assignmentId; | ||
@XmlElement(name = "message") | ||
private String message; | ||
@XmlElement(name = "url") | ||
private String url; | ||
@XmlElement(name = "tasks") | ||
private List<TaskInfo> tasksBuilt = new ArrayList<>(); | ||
|
||
/** | ||
* @return the setId | ||
*/ | ||
public String getSetId() | ||
{ | ||
return setId; | ||
} | ||
|
||
/** | ||
* @param setId | ||
* the setId to set | ||
*/ | ||
public void setSetId(String setId) | ||
{ | ||
this.setId = setId; | ||
} | ||
|
||
/** | ||
* @return the assignmentId | ||
*/ | ||
public String getAssignmentId() | ||
{ | ||
return assignmentId; | ||
} | ||
|
||
/** | ||
* @param assignmentId | ||
* the assignmentId to set | ||
*/ | ||
public void setAssignmentId(String assignmentId) | ||
{ | ||
this.assignmentId = assignmentId; | ||
} | ||
|
||
/** | ||
* @return the message | ||
*/ | ||
public String getMessage() | ||
{ | ||
return message; | ||
} | ||
|
||
/** | ||
* @param message the message to set | ||
*/ | ||
public void setMessage(String message) | ||
{ | ||
this.message = message; | ||
} | ||
|
||
/** | ||
* @return the url | ||
*/ | ||
public String getUrl() | ||
{ | ||
return url; | ||
} | ||
|
||
/** | ||
* @param url the url to set | ||
*/ | ||
public void setUrl(String url) | ||
{ | ||
this.url = url; | ||
} | ||
|
||
/** | ||
* @return the tasksBuilt | ||
*/ | ||
public List<TaskInfo> getTasksBuilt() | ||
{ | ||
return tasksBuilt; | ||
} | ||
|
||
public void addTaskBuilt(TaskInfo builtTask) | ||
{ | ||
tasksBuilt.add(builtTask); | ||
} | ||
|
||
/** | ||
* @param tasksBuilt | ||
* the tasksBuilt to set | ||
*/ | ||
public void setTasksBuilt(List<TaskInfo> tasksBuilt) | ||
{ | ||
this.tasksBuilt = tasksBuilt; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/com/compuware/ispw/restapi/action/BuildAssignmentAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* These materials contain confidential information and trade secrets of Compuware Corporation. You shall maintain the materials | ||
* as confidential and shall not disclose its contents to any third party except as may be required by law or regulation. Use, | ||
* disclosure, or reproduction is prohibited without the prior express written permission of Compuware Corporation. | ||
* | ||
* All Compuware products listed within the materials are trademarks of Compuware Corporation. All other company or product | ||
* names are trademarks of their respective owners. | ||
* | ||
* Copyright (c) 2019 Compuware Corporation. All rights reserved. | ||
*/ | ||
package com.compuware.ispw.restapi.action; | ||
|
||
import java.io.PrintStream; | ||
import com.compuware.ispw.model.rest.BuildResponse; | ||
import com.compuware.ispw.restapi.Constants; | ||
import com.compuware.ispw.restapi.IspwContextPathBean; | ||
import com.compuware.ispw.restapi.IspwRequestBean; | ||
import com.compuware.ispw.restapi.JsonProcessor; | ||
import com.compuware.ispw.restapi.WebhookToken; | ||
import com.compuware.ispw.restapi.util.RestApiUtils; | ||
|
||
/** | ||
* Action to build an assignment | ||
*/ | ||
public class BuildAssignmentAction extends SetInfoPostAction | ||
{ | ||
private static final String[] defaultProps = new String[]{assignmentId, level, runtimeConfiguration}; | ||
|
||
private static final String contextPath = "/ispw/{srid}/assignments/{assignmentId}/tasks/build?level={level}"; //$NON-NLS-1$ | ||
|
||
public static String getDefaultProps() | ||
{ | ||
return RestApiUtils.join(Constants.LINE_SEPARATOR, defaultProps, true); | ||
} | ||
|
||
public BuildAssignmentAction(PrintStream logger) | ||
{ | ||
super(logger); | ||
} | ||
|
||
@Override | ||
public IspwRequestBean getIspwRequestBean(String srid, String ispwRequestBody, WebhookToken webhookToken) | ||
{ | ||
return getIspwRequestBean(srid, ispwRequestBody, webhookToken, contextPath); | ||
} | ||
|
||
@SuppressWarnings("nls") | ||
@Override | ||
public void startLog(PrintStream logger, IspwContextPathBean ispwContextPathBean, Object jsonObject) | ||
{ | ||
logger.println("Building tasks in assignment " + ispwContextPathBean.getAssignmentId() + " at level " | ||
+ ispwContextPathBean.getLevel()); | ||
} | ||
|
||
@SuppressWarnings("nls") | ||
@Override | ||
public Object endLog(PrintStream logger, IspwRequestBean ispwRequestBean, String responseJson) | ||
{ | ||
BuildResponse buildResp = new JsonProcessor().parse(responseJson, BuildResponse.class); | ||
logger.println("Set " + buildResp.getSetId() + " created to build tasks in assignment " | ||
+ ispwRequestBean.getIspwContextPathBean().getAssignmentId()); | ||
|
||
return buildResp; | ||
} | ||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/com/compuware/ispw/restapi/action/BuildReleaseAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* These materials contain confidential information and trade secrets of Compuware Corporation. You shall maintain the materials | ||
* as confidential and shall not disclose its contents to any third party except as may be required by law or regulation. Use, | ||
* disclosure, or reproduction is prohibited without the prior express written permission of Compuware Corporation. | ||
* | ||
* All Compuware products listed within the materials are trademarks of Compuware Corporation. All other company or product | ||
* names are trademarks of their respective owners. | ||
* | ||
* Copyright (c) 2019 Compuware Corporation. All rights reserved. | ||
*/ | ||
package com.compuware.ispw.restapi.action; | ||
|
||
import java.io.PrintStream; | ||
import com.compuware.ispw.model.rest.BuildResponse; | ||
import com.compuware.ispw.restapi.Constants; | ||
import com.compuware.ispw.restapi.IspwContextPathBean; | ||
import com.compuware.ispw.restapi.IspwRequestBean; | ||
import com.compuware.ispw.restapi.JsonProcessor; | ||
import com.compuware.ispw.restapi.WebhookToken; | ||
import com.compuware.ispw.restapi.util.RestApiUtils; | ||
|
||
/** | ||
* | ||
*/ | ||
public class BuildReleaseAction extends SetInfoPostAction | ||
{ | ||
private static final String[] defaultProps = new String[]{releaseId, level, runtimeConfiguration}; | ||
|
||
private static final String contextPath = "/ispw/{srid}/releases/{releaseId}/tasks/build?level={level}&assignmentId={assignmentId}"; //$NON-NLS-1$ | ||
|
||
public static String getDefaultProps() | ||
{ | ||
return RestApiUtils.join(Constants.LINE_SEPARATOR, defaultProps, true); | ||
} | ||
|
||
public BuildReleaseAction(PrintStream logger) | ||
{ | ||
super(logger); | ||
} | ||
|
||
@Override | ||
public IspwRequestBean getIspwRequestBean(String srid, String ispwRequestBody, WebhookToken webhookToken) | ||
{ | ||
return getIspwRequestBean(srid, ispwRequestBody, webhookToken, contextPath); | ||
} | ||
|
||
@SuppressWarnings("nls") | ||
@Override | ||
public void startLog(PrintStream logger, IspwContextPathBean ispwContextPathBean, Object jsonObject) | ||
{ | ||
logger.println("Building tasks in release " + ispwContextPathBean.getReleaseId() + " at level " | ||
+ ispwContextPathBean.getLevel()); | ||
} | ||
|
||
@SuppressWarnings("nls") | ||
@Override | ||
public Object endLog(PrintStream logger, IspwRequestBean ispwRequestBean, String responseJson) | ||
{ | ||
BuildResponse buildResp = new JsonProcessor().parse(responseJson, BuildResponse.class); | ||
logger.println("Set " + buildResp.getSetId() + " created to build tasks in release " | ||
+ ispwRequestBean.getIspwContextPathBean().getReleaseId()); | ||
|
||
return buildResp; | ||
} | ||
} |
Oops, something went wrong.