Update staging to work with Nexus 2.4+

Nexus 2.4 introduced aynchronous notifications for staging in a
non backwards compatable way.

This adds support for the new way but uses does not enable it if the
server version is < 2.4.

Change-Id: I168214d824be094c7bcfac50b29d4dc6e014fd67
This commit is contained in:
James Nord 2013-06-19 14:08:28 +01:00
parent 185b3d376c
commit f5b043a105
17 changed files with 2821 additions and 254 deletions

2
.gitignore vendored
View File

@ -11,3 +11,5 @@ bin
# Build output
target
/work
.clover

33
pom.xml
View File

@ -55,7 +55,6 @@
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.release</groupId>
@ -68,20 +67,30 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>dashboard-view</artifactId>
<version>2.0</version>
<optional>true</optional>
</dependency>
<!--
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>${jenkins.version}</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>dashboard-view</artifactId>
<version>2.0</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>

View File

@ -195,38 +195,6 @@ public boolean tearDown(@SuppressWarnings("rawtypes") AbstractBuild bld, BuildLi
lstnr.getLogger().println("[M2Release] its only a dryRun, no need to mark it for keep");
}
int buildsKept = 0;
if (bld.getResult() != null && bld.getResult().isBetterOrEqualTo(Result.SUCCESS) && !args.isDryRun()) {
if (numberOfReleaseBuildsToKeep > 0 || numberOfReleaseBuildsToKeep == -1) {
// keep this build.
lstnr.getLogger().println("[M2Release] assigning keep build to current build.");
bld.keepLog();
buildsKept++;
}
// the value may have changed since a previous release so go searching...
for (Run run : (RunList<? extends Run>) (bld.getProject().getBuilds())) {
if (isSuccessfulReleaseBuild(run)) {
if (bld.getNumber() != run.getNumber()) { // not sure we still need this check..
if (shouldKeepBuildNumber(numberOfReleaseBuildsToKeep, buildsKept)) {
if (!run.isKeepLog()) {
lstnr.getLogger().println(
"[M2Release] assigning keep build to build " + run.getNumber());
run.keepLog(true);
}
}
else {
if (run.isKeepLog()) {
lstnr.getLogger().println(
"[M2Release] removing keep build from build " + run.getNumber());
run.keepLog(false);
}
}
}
}
}
}
if (args.isCloseNexusStage() && !args.isDryRun()) {
StageClient client = new StageClient(new URL(getDescriptor().getNexusURL()), getDescriptor()
.getNexusUser(), getDescriptor().getNexusPassword());
@ -243,7 +211,7 @@ public boolean tearDown(@SuppressWarnings("rawtypes") AbstractBuild bld, BuildLi
}
else {
lstnr.getLogger().println("[M2Release] Dropping repository " + stage);
client.closeStage(stage, args.getRepoDescription());
client.dropStage(stage);
lstnr.getLogger().println("[M2Release] Dropped staging repository.");
}
}
@ -253,11 +221,51 @@ public boolean tearDown(@SuppressWarnings("rawtypes") AbstractBuild bld, BuildLi
}
}
catch (StageException ex) {
lstnr.fatalError("[M2Release] Could not close repository , %s\n", ex.toString());
lstnr.fatalError("[M2Release] Could not close repository , %1$s\n", ex.getMessage());
ex.printStackTrace(lstnr.getLogger());
log.error("[M2Release] Could not close repository", ex);
retVal = false;
}
}
int buildsKept = 0;
if (bld.getResult() != null && bld.getResult().isBetterOrEqualTo(Result.SUCCESS) && !args.isDryRun()) {
if (numberOfReleaseBuildsToKeep > 0 || numberOfReleaseBuildsToKeep == -1) {
// keep this build.
lstnr.getLogger().println("[M2Release] assigning keep build to current build.");
bld.keepLog();
buildsKept++;
}
// the value may have changed since a previous release so go searching...
log.debug("looking for extra release builds to lock/unlock.");
for (Run run : (RunList<? extends Run>) (bld.getProject().getBuilds())) {
log.debug("checking build #{}", run.getNumber());
if (isSuccessfulReleaseBuild(run)) {
log.debug("build #{} was successful.", run.getNumber());
if (bld.getNumber() != run.getNumber()) { // not sure we still need this check..
if (shouldKeepBuildNumber(numberOfReleaseBuildsToKeep, buildsKept)) {
buildsKept++;
if (!run.isKeepLog()) {
lstnr.getLogger().println(
"[M2Release] assigning keep build to build " + run.getNumber());
run.keepLog(true);
}
}
else {
if (run.isKeepLog()) {
lstnr.getLogger().println(
"[M2Release] removing keep build from build " + run.getNumber());
run.keepLog(false);
}
}
}
}
else {
log.debug("build #{} was NOT successful release build.", run.getNumber());
}
}
}
return retVal;
}
@ -478,6 +486,9 @@ public static class DescriptorImpl extends BuildWrapperDescriptor {
public DescriptorImpl() {
super(M2ReleaseBuildWrapper.class);
load();
if (nexusURL != null && !nexusURL.endsWith("/")) {
nexusURL = nexusURL + "/";
}
}
@ -492,8 +503,8 @@ public boolean configure(StaplerRequest staplerRequest, JSONObject json) throws
if (nexusSupport) {
JSONObject nexusParams = json.getJSONObject("nexusSupport"); //$NON-NLS-1$
nexusURL = Util.fixEmpty(nexusParams.getString("nexusURL")); //$NON-NLS-1$
if (nexusURL != null && nexusURL.endsWith("/")) { //$NON-NLS-1$
nexusURL = nexusURL.substring(0, nexusURL.length() - 1);
if (nexusURL != null && !nexusURL.endsWith("/")) { //$NON-NLS-1$
nexusURL = nexusURL + "/";
}
nexusUser = Util.fixEmpty(nexusParams.getString("nexusUser")); //$NON-NLS-1$
nexusPassword = nexusParams.getString("nexusPassword"); //$NON-NLS-1$
@ -545,8 +556,8 @@ public FormValidation doUrlCheck(@QueryParameter String urlValue,
return FormValidation.ok();
}
final String testURL;
if (urlValue.endsWith("/")) {
testURL = urlValue.substring(0, urlValue.length() - 1);
if (!urlValue.endsWith("/")) {
testURL = urlValue + "/";
}
else {
testURL = urlValue;

View File

@ -1,40 +1,107 @@
/*
* The MIT License
*
* Copyright (c) 2010, NDS Group Ltd., James Nord
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jvnet.hudson.plugins.m2release.nexus;
/**
* A holder class to contain information about a Nexus Professional Staging repository.
*/
public class Stage {
private String profileID;
private String stageID;
/**
* Construct a new Stage to represent a Nexus Professional Staging repository.
*
* @param profileID the id of the staging profile that this stage is associated with.
* @param stageID the id for this stage repository.
*/
public Stage(String profileID, String stageID) {
super();
this.profileID = profileID;
this.stageID = stageID;
}
super();
this.profileID = profileID;
this.stageID = stageID;
}
/**
* @return the profileID that this stage is associated with.
*/
public String getProfileID() {
return profileID;
}
* @return the profileID that this stage is associated with.
*/
public String getProfileID() {
return profileID;
}
/**
* @return the unique stageID for this stage
*/
public String getStageID() {
return stageID;
}
* Return the StageID that this stage represents. StageIDs are recycled by Nexus, so this is only valid for
* the lifetime of this stage repository.
*
* @return the unique stageID for this stage.
*/
public String getStageID() {
return stageID;
}
@Override
public String toString() {
return String.format("Stage[profileId=%s, stageId=%s", profileID, stageID);
return String.format("Stage[profileId=%s, stageId=%s]", profileID, stageID);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((profileID == null) ? 0 : profileID.hashCode());
result = prime * result + ((stageID == null) ? 0 : stageID.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Stage other = (Stage) obj;
if (profileID == null) {
if (other.profileID != null)
return false;
}
else if (!profileID.equals(other.profileID))
return false;
if (stageID == null) {
if (other.stageID != null)
return false;
}
else if (!stageID.equals(other.stageID))
return false;
return true;
}
}

View File

@ -27,9 +27,13 @@
import java.net.URL;
public enum StageAction {
CLOSE("%1$s/service/local/staging/profiles/%2$s/finish"),
//PROMOTE("%1$s/service/local/staging/profiles/%2$s/promote"),
DROP("%1$s/service/local/staging/profiles/%2$s/drop");
CLOSE("service/local/staging/profiles/%1$s/finish"),
/** not yet supported. */
PROMOTE("service/local/staging/profiles/%1$s/promote"),
// release is just a promote without a target profile
RELEASE("service/local/staging/profiles/%1$s/promote"),
//START("service/local/staging/profiles/%1$s/start"),
DROP("service/local/staging/profiles/%1$s/drop");
/**
* Template for the URL for this action.
@ -55,7 +59,7 @@ private StageAction(String urlTemplate) {
* @throws MalformedURLException if the URL is invalid
*/
public URL getURL(URL baseURL, Stage stage) throws MalformedURLException {
return new URL(String.format(urlTemplate, baseURL, stage.getProfileID(), stage.getStageID()));
return new URL(baseURL, String.format(urlTemplate, stage.getProfileID(), stage.getStageID()));
}
}

View File

@ -29,16 +29,20 @@
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathException;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.apache.commons.codec.binary.Base64;
@ -50,7 +54,8 @@
import org.xml.sax.SAXException;
/**
* The Stage client acts as the interface to Nexus Pro staging via the Nexus REST APIs.
* The Stage client acts as the interface to Nexus Pro staging via the Nexus REST APIs. A single StageClient
* is not thread safe.
*
* @author James Nord
* @version 0.5
@ -59,12 +64,23 @@ public class StageClient {
private Logger log = LoggerFactory.getLogger(StageClient.class);
/** XPath instance for running xpath queries */
private XPath xpath;
/** The base URL of the Nexus service. */
private URL nexusURL;
/** The username passed to Nexus for authentication. */
private String username;
/** The password passed to Nexus for authentication. */
private String password;
private transient String nexusVersion;
/**
* Create a new StageClient to handle communicating to a Nexus Pro server Staging suite.
*
* @param nexusURL the base URL for the Nexus server.
* @param username user name to use with staging privileges.
* @param password password for the user.
@ -73,17 +89,23 @@ public StageClient(URL nexusURL, String username, String password) {
this.nexusURL = nexusURL;
this.username = username;
this.password = password;
// XPathFactory is not thread safe.
XPathFactory factory;
synchronized (XPathFactory.class) {
factory = XPathFactory.newInstance();
}
synchronized (factory) {
xpath = factory.newXPath();
}
}
/**
* Get the ID for the Staging repository that holds the specified GAV.
*
* @param groupId
* groupID to search for.
* @param artifactId
* artifactID to search for.
* @param version
* version of the group/artifact to search for - may be <code>null</code>.
* @param groupId groupID to search for.
* @param artifactId artifactID to search for.
* @param version version of the group/artifact to search for - may be <code>null</code>.
* @return the stageID or null if no machine stage was found.
* @throws StageException if any issue occurred whilst locating the open stage.
*/
@ -99,44 +121,98 @@ public Stage getOpenStageID(String group, String artifact, String version) throw
}
else {
// multiple stages match!!!
log.warn("Found a matching stage ({}) for {}:{} but already found a matchine one ({})", new Object[] {testStage, group, artifact, stage});
log.warn("Found a matching stage ({}) for {}:{} but already found a matchine one ({})",
new Object[] {testStage, group, artifact, stage});
}
}
}
return stage;
}
/**
* Close the specified stage.
*
* @param stage
* the stage to close.
* @throws StageException
* if any issue occurred whilst closing the stage.
* @param stage the stage to close.
* @throws StageException if any issue occurred whilst closing the stage.
*/
public void closeStage(Stage stage, String description) throws StageException {
performStageAction(StageAction.CLOSE, stage, description);
if (isAsyncClose()) {
waitForActionToComplete(stage);
// check the action completed successfully and no rules failed.
URL url = getActivityURL(stage);
Document doc = getDocument(url);
// last stagingActivity that was a close
String xpathExpr = "(/list/stagingActivity[name='close'])[last()]";
Node lastCloseNode = (Node) evaluateXPath(xpathExpr, doc, XPathConstants.NODE);
if (lastCloseNode == null) {
throw new StageException("Stage activity completed but no close action was recorded!");
}
Node closed =
(Node) evaluateXPath("events/stagingActivityEvent[name='repositoryClosed']", lastCloseNode,
XPathConstants.NODE);
if (closed != null) {
// we have successfully closed the repository
return;
}
Node failed =
(Node) evaluateXPath("events/stagingActivityEvent[name='repositoryCloseFailed']",
lastCloseNode, XPathConstants.NODE);
if (failed == null) {
throw new StageException(
"Close stage action was signalled as completed, but was not recorded as either failed or succeeded!");
}
StringBuilder failureMessage =
new StringBuilder("Closing stage ").append(stage.getStageID()).append(" failed.\n");
String cause =
(String) evaluateXPath("properties/stagingProperty[name='cause']/value", failed,
XPathConstants.STRING);
failureMessage.append('\t').append(cause);
NodeList failedRules =
(NodeList) evaluateXPath("events/stagingActivityEvent[name='ruleFailed']/properties/stagingProperty[name='failureMessage']/value",
lastCloseNode, XPathConstants.NODESET);
for (int i = 0; i < failedRules.getLength(); i++) {
failureMessage.append("\n\t");
failureMessage.append(failedRules.item(i).getTextContent());
}
throw new StageException(failureMessage.toString());
}
}
/**
* Drop the stage from Nexus staging.
*
* @param stage
* the Stage to drop.
* @throws StageException
* if any issue occurred whilst dropping the stage.
* @param stage the Stage to drop.
* @throws StageException if any issue occurred whilst dropping the stage.
*/
public void dropStage(Stage stage) throws StageException {
performStageAction(StageAction.DROP, stage, null);
// no need to wait for this to complete as there is no way to tell!
}
/**
* Promote the stage from Nexus staging into the default repository for the stage.
* Release the stage from Nexus staging into the default repository for the stage. This does not drop stage
* repository after a successful release.
*
* @param stage
* the Stage to promote.
* @throws StageException
* if any issue occurred whilst promoting the stage.
* @param stage the Stage to promote.
* @throws StageException if any issue occurred whilst promoting the stage.
*/
public void releaseStage(Stage stage) throws StageException {
performStageAction(StageAction.RELEASE, stage, null);
if (isAsyncClose()) {
waitForActionToComplete(stage);
}
}
/**
* Promote the stage from Nexus staging into the specified profile.
*
* @param stage the Stage to promote.
* @throws StageException if any issue occurred whilst promoting the stage.
*/
public void promoteStage(Stage stage) throws StageException {
throw new UnsupportedOperationException("not implemented");
@ -144,6 +220,42 @@ public void promoteStage(Stage stage) throws StageException {
// performStageAction(StageAction.PROMOTE, stage, null);
}
/**
* Completion of the stage action is asynchronous - so poll until the action completed.
*
* @param stage the stage to wait until the previous action is completed.
* @throws StageException
*/
protected void waitForActionToComplete(Stage stage) throws StageException {
log.debug("Waiting for {} to finish transitioning.", stage);
int i = 0;
boolean transitioning = false;
try {
final URL activityUrl = getRepositoryURL(stage);
do {
Document doc = getDocument(activityUrl);
String status =
(String) evaluateXPath("/stagingProfileRepository/transitioning", doc,
XPathConstants.STRING);
transitioning = Boolean.valueOf(status).booleanValue();
if (transitioning) {
i++;
Thread.sleep(500L);
if (i % 100 == 0) {
log.debug("Still waiting for {} to finish transitioning.", stage);
}
// TODO should we ever time out?
}
} while (transitioning);
}
catch (InterruptedException ex) {
throw new StageException(ex);
}
}
/**
* Check if we have the required permissions for nexus staging.
*
@ -152,99 +264,159 @@ public void promoteStage(Stage stage) throws StageException {
*/
public void checkAuthentication() throws StageException {
try {
URL url = new URL(nexusURL.toString() + "/service/local/status");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
addAuthHeader(conn);
int status = conn.getResponseCode();
if (status == 200) {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(conn.getInputStream());
/*
* check for the following permissions:
*/
String[] requiredPerms = new String[] {"nexus:stagingprofiles", "nexus:stagingfinish",
// "nexus:stagingpromote",
"nexus:stagingdrop"};
URL url = new URL(nexusURL, "service/local/status");
Document doc = getDocument(url);
XPath xpath = XPathFactory.newInstance().newXPath();
for (String perm : requiredPerms) {
String expression = "//clientPermissions/permissions/permission[id=\"" + perm + "\"]/value";
Node node = (Node) xpath.evaluate(expression, doc, XPathConstants.NODE);
if (node == null) {
throw new StageException("Invalid reponse from server - is the URL a Nexus Professional server?");
}
int val = Integer.parseInt(node.getTextContent());
if (val == 0) {
throw new StageException("User has insufficient privaledges to perform staging actions (" + perm
+ ")");
}
/*
* check for the following permissions:
*/
String[] requiredPerms =
new String[] {"nexus:stagingprofiles", "nexus:stagingfinish", "nexus:stagingprofilerepos",
"nexus:stagingpromote", "nexus:stagingdrop"};
for (String perm : requiredPerms) {
String expression = "//clientPermissions/permissions/permission[id=\"" + perm + "\"]/value";
Node node = (Node) evaluateXPath(expression, doc, XPathConstants.NODE);
if (node == null) {
throw new StageException(
"Invalid reponse from server - is the URL a Nexus Professional server?");
}
}
else {
drainOutput(conn);
if (status == HttpURLConnection.HTTP_UNAUTHORIZED) {
throw new IOException("Incorrect username / password supplied.");
}
else if (status == HttpURLConnection.HTTP_NOT_FOUND) {
throw new IOException("Service not found - is this a Nexus server?");
}
else {
throw new IOException("Server returned error code " + status + ".");
int val = Integer.parseInt(node.getTextContent());
if (val == 0) {
throw new StageException("User has insufficient privileges to perform staging actions ("
+ perm + ")");
}
}
}
catch (IOException ex) {
catch (MalformedURLException ex) {
throw createStageExceptionForIOException(nexusURL, ex);
}
catch (XPathException ex) {
throw new StageException(ex);
}
/**
* Retrieve the Nexus servers version.
*
* @return the String representation of the server version.
* @throws StageException if we could not obtain the nexus server version.
*/
protected String getServerVersion() throws StageException {
if (nexusVersion == null) {
try {
URL url = new URL(nexusURL, "service/local/status");
Document doc = getDocument(url);
Node node = (Node) evaluateXPath("//version", doc, XPathConstants.NODE);
if (node == null) {
throw new StageException(
"Invalid reponse from server - is the URL a Nexus Professional server?");
}
nexusVersion = node.getTextContent();
log.debug("This nexus server has version: {}", nexusVersion);
return nexusVersion;
}
catch (MalformedURLException ex) {
throw createStageExceptionForIOException(nexusURL, ex);
}
}
catch (ParserConfigurationException ex) {
throw new StageException(ex);
return nexusVersion;
}
/**
* Checks if this Nexus server uses asynchronous stage actions.
*
* @param version the version of this server
* @return true if this server uses asynchronous stage actions (i.e. the server is 2.4 or newer).
* @throws StageException if we could not retreive the server version.
*/
protected boolean isAsyncClose() throws StageException {
String version = getServerVersion();
return isAsyncClose(version);
}
/**
* Checks if this Nexus server uses asynchronous stage actions.
*
* @param version the version of this server
* @return true if this server uses asynchronous stage actions (i.e. the server is 2.4 or newer).
*/
protected boolean isAsyncClose(String version) {
String[] versionArr = version.split("\\.");
if (Integer.parseInt(versionArr[0]) > 2) {
return true;
}
catch (SAXException ex) {
throw new StageException(ex);
if (Integer.parseInt(versionArr[0]) == 2) {
if (Integer.parseInt(versionArr[1]) >= 4) {
return true;
}
}
return false;
}
public List<Stage> getOpenStageIDs() throws StageException {
log.debug("retreiving list of stages");
try {
List<Stage> openStages = new ArrayList<Stage>();
URL url = new URL(nexusURL.toString() + "/service/local/staging/profiles");
URL url = new URL(nexusURL, "service/local/staging/profile_repositories");
Document doc = getDocument(url);
String profileExpression = "//stagingProfile/id";
XPath xpathProfile = XPathFactory.newInstance().newXPath();
NodeList profileNodes = (NodeList) xpathProfile.evaluate(profileExpression, doc, XPathConstants.NODESET);
for (int i = 0; i < profileNodes.getLength(); i++) {
Node profileNode = profileNodes.item(i);
String profileID = profileNode.getTextContent();
String statgeExpression = "../stagingRepositoryIds/string";
XPath xpathStage = XPathFactory.newInstance().newXPath();
NodeList stageNodes = (NodeList) xpathStage.evaluate(statgeExpression, profileNode,
XPathConstants.NODESET);
for (int j = 0; j < stageNodes.getLength(); j++) {
Node stageNode = stageNodes.item(j);
// XXX need to also get the stage profile
openStages.add(new Stage(profileID, stageNode.getTextContent()));
}
}
return openStages;
return getOpenStageIDs(doc);
}
catch (IOException ex) {
catch (MalformedURLException ex) {
throw createStageExceptionForIOException(nexusURL, ex);
}
catch (XPathException ex) {
throw new StageException(ex);
}
}
public boolean checkStageForGAV(Stage stage, String group, String artifact, String version)
throws StageException {
/**
* Parses a stagingRepositories element to obtain the list of open stages.
*
* @param doc the stagingRepositories to parse.
* @return a List of open stages.
* @throws XPathException if the XPath expression is invalid.
*/
protected List<Stage> getOpenStageIDs(Document doc) throws StageException {
List<Stage> stages = new ArrayList<Stage>();
NodeList stageRepositories =
(NodeList) evaluateXPath("//stagingProfileRepository", doc, XPathConstants.NODESET);
for (int i = 0; i < stageRepositories.getLength(); i++) {
Node stageRepo = stageRepositories.item(i);
Node type = (Node) evaluateXPath("./type", stageRepo, XPathConstants.NODE);
// type will be "open" or "closed"
if ("open".equals(type.getTextContent())) {
Node profileId = (Node) evaluateXPath("./profileId", stageRepo, XPathConstants.NODE);
Node repoId = (Node) evaluateXPath("./repositoryId", stageRepo, XPathConstants.NODE);
stages.add(new Stage(profileId.getTextContent(), repoId.getTextContent()));
}
}
return stages;
}
/**
* Evaluate the xPath expression on the given node.
*
* @param expression the expression to evaluate.
* @param node the node on which the xpath should be performed.
* @param type the return type of the expression.
* @return the resulting object from the xpath query
* @throws StageException If <code>expression</code> cannot be evaluated.
*/
private Object evaluateXPath(String expression, Node node, QName type) throws StageException {
try {
xpath.reset();
return xpath.evaluate(expression, node, type);
}
catch (XPathExpressionException ex) {
throw new StageException("Could not evaluate xPath expression (" + expression + ')', ex);
}
}
public boolean
checkStageForGAV(Stage stage, String group, String artifact, String version) throws StageException {
// do we always know the version???
// to browse an open repo
// /service/local/repositories/${stageID}/content/...
@ -254,12 +426,14 @@ public boolean checkStageForGAV(Stage stage, String group, String artifact, Stri
try {
URL url;
if (version == null) {
url = new URL(nexusURL.toString() + "/service/local/repositories/" + stage.getStageID() + "/content/"
+ group.replace('.', '/') + '/' + artifact + "/?isLocal");
url =
new URL(nexusURL, "service/local/repositories/" + stage.getStageID() + "/content/"
+ group.replace('.', '/') + '/' + artifact + "/?isLocal");
}
else {
url = new URL(nexusURL.toString() + "/service/local/repositories/" + stage.getStageID() + "/content/"
+ group.replace('.', '/') + '/' + artifact + '/' + version + "/?isLocal");
url =
new URL(nexusURL, "service/local/repositories/" + stage.getStageID() + "/content/"
+ group.replace('.', '/') + '/' + artifact + '/' + version + "/?isLocal");
}
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
addAuthHeader(conn);
@ -274,7 +448,8 @@ else if (response == HttpURLConnection.HTTP_NOT_FOUND) {
// not this repo
}
else {
log.warn("Server returned HTTP status {} when we only expected a 200 or 404.", Integer.toString(response));
log.warn("Server returned HTTP status {} when we only expected a 200 or 404.",
Integer.toString(response));
}
conn.disconnect();
}
@ -285,12 +460,20 @@ else if (response == HttpURLConnection.HTTP_NOT_FOUND) {
}
private Document getDocument(URL url) throws StageException {
/**
* Retrieve and parse an XML file from the given URL.
*
* @param url the URL where the XML document can be obtained.
* @return the parsed Document.
* @throws StageException if there was an issue obtaining or parsing the document.
*/
protected Document getDocument(URL url) throws StageException {
try {
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
addAuthHeader(conn);
conn.setRequestProperty("Accept", "application/xml");
int status = conn.getResponseCode();
if (status == 200) {
if (status == HttpURLConnection.HTTP_OK) {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(conn.getInputStream());
conn.disconnect();
@ -298,8 +481,11 @@ private Document getDocument(URL url) throws StageException {
}
else {
drainOutput(conn);
if (status == 401) {
throw new IOException("Incorrect Crediantials for " + url.toString());
if (status == HttpURLConnection.HTTP_UNAUTHORIZED) {
throw new IOException("Incorrect username / password supplied.");
}
else if (status == HttpURLConnection.HTTP_NOT_FOUND) {
throw new IOException("Document not found - is this a Nexus server?");
}
else {
throw new IOException("Server returned error code " + status + " for " + url.toString());
@ -318,36 +504,54 @@ private Document getDocument(URL url) throws StageException {
}
/**
* Construct the XML message for a promoteRequest.
*
* @param stage
* The stage to target
* @param description
* the description (used for promote - ignored otherwise)
* @param stage The stage to target
* @param description the description (used for promote - ignored otherwise)
* @param autodrop <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code> sets the autoDropAfterRelease to
* the appropriate value. <code>null</code> omits the value.
* @return The XML for the promoteRequest.
* @throws StageException if we could not determine if this server support async close or not.
*/
private String createPromoteRequestPayload(Stage stage, String description) {
protected String createPromoteRequestPayload(Stage stage, String description, Boolean autodrop) throws StageException {
// TODO? this is missing the targetRepoID which is needed for promote...
// XXX lets hope that the description never contains "]]>"
// if the description contains a CDATA END tag then split it across multiple CDATA sections.
String escapedDescr = (description == null) ? "" : description;
if (escapedDescr.contains("]]>")) {
escapedDescr = escapedDescr.replace("]]>", "]]]]><![CDATA[>");
}
if (autodrop != null) {
return String.format("<?xml version=\"1.0\" encoding=\"UTF-8\"?><promoteRequest><data><autoDropAfterRelease>%s</autoDropAfterRelease><stagedRepositoryId>%s</stagedRepositoryId><description><![CDATA[%s]]></description></data></promoteRequest>",
autodrop.toString(), stage.getStageID(), escapedDescr);
}
return String.format("<?xml version=\"1.0\" encoding=\"UTF-8\"?><promoteRequest><data><stagedRepositoryId>%s</stagedRepositoryId><description><![CDATA[%s]]></description></data></promoteRequest>",
stage.getStageID(), description);
stage.getStageID(), escapedDescr);
}
/**
* Perform a staging action.
*
* @param action the action to perform.
* @param stage the stage on which to perform the action.
* @param description description to pass to the server for the action (e.g. the description of the stage repo).
* @param description description to pass to the server for the action (e.g. the description of the stage
* repo).
* @throws StageException if an exception occurs whilst performing the action.
*/
private void performStageAction(StageAction action, Stage stage, String description) throws StageException {
protected void
performStageAction(StageAction action, Stage stage, String description) throws StageException {
log.debug("Performing action {} on stage {}", new Object[] {action, stage});
try {
URL url = action.getURL(nexusURL, stage);
String payload = createPromoteRequestPayload(stage, description);
String payload;
if (action == StageAction.PROMOTE && isAsyncClose()) {
payload = createPromoteRequestPayload(stage, description, Boolean.FALSE);
}
else {
payload = createPromoteRequestPayload(stage, description, null);
}
byte[] payloadBytes = payload.getBytes("UTF-8");
int contentLen = payloadBytes.length;
@ -365,32 +569,36 @@ private void performStageAction(StageAction action, Stage stage, String descript
out.flush();
int status = conn.getResponseCode();
log.debug("Server returned HTTP Status {} for {} stage request to {}.", new Object[] { Integer.toString(status),
action.name(), stage });
log.debug("Server returned HTTP Status {} for {} stage request to {}.",
new Object[] {Integer.toString(status), action.name(), stage});
if (status == HttpURLConnection.HTTP_CREATED) {
drainOutput(conn);
conn.disconnect();
}
else {
log.warn("Server returned HTTP Status {} for {} stage request to {}.",
new Object[] { Integer.toString(status), action.name(), stage });
log.warn("Server returned HTTP Status {} for {} stage request to {}.",
new Object[] {Integer.toString(status), action.name(), stage});
drainOutput(conn);
conn.disconnect();
throw new IOException(String.format("server responded with status:%s", Integer.toString(status)));
}
}
catch (IOException ex) {
String message = String.format("Failed to perform %s action to nexus stage(%s)", action.name(), stage.toString());
String message =
String.format("Failed to perform %s action to nexus stage(%s)", action.name(),
stage.toString());
throw new StageException(message, ex);
}
}
/**
* Add the BASIC Authentication header to the HTTP connection.
*
* @param conn the HTTP URL Connection
*/
private void addAuthHeader(HttpURLConnection conn) {
private void addAuthHeader(URLConnection conn) {
// java.net.Authenticator is brain damaged as it is global and no way to delegate for just one server...
try {
String auth = username + ":" + password;
@ -399,10 +607,11 @@ private void addAuthHeader(HttpURLConnection conn) {
// Base64 adds a trailing newline - just strip it as whitespace is illegal in Base64
String encodedAuth = new Base64().encodeToString(auth.getBytes("ISO-8859-1")).trim();
conn.setRequestProperty("Authorization", "Basic " + encodedAuth);
log.debug("Encoded Authentication is: "+encodedAuth);
log.debug("Encoded Authentication is: " + encodedAuth);
}
catch (UnsupportedEncodingException ex) {
String msg = "JVM does not conform to java specification. Mandatory CharSet ISO-8859-1 is not available.";
String msg =
"JVM does not conform to java specification. Mandatory CharSet ISO-8859-1 is not available.";
log.error(msg);
throw new RuntimeException(msg, ex);
}
@ -411,7 +620,7 @@ private void addAuthHeader(HttpURLConnection conn) {
private StageException createStageExceptionForIOException(URL url, IOException ex) {
if (ex instanceof StageException) {
return (StageException)ex;
return (StageException) ex;
}
if (ex.getMessage().equals(url.toString())) {
// Sun JRE (and probably others too) often return just the URL in the error.
@ -421,12 +630,16 @@ private StageException createStageExceptionForIOException(URL url, IOException e
return new StageException(ex.getMessage(), ex);
}
}
private void drainOutput(HttpURLConnection conn) throws IOException {
// for things like unauthorised (401) we won't have any content and getting the inputStream will
// cause an IOException as we are in error - but there is no really way to tell this so check the
// for things like unauthorised (401) we won't have any content and getting the inputStream will
// cause an IOException as we are in error - but there is no really way to tell this so check the
// length instead.
if (conn.getContentLength() > 0) {
if (conn.getContentLength() < 1024) {
byte[] data = new byte[conn.getConnectTimeout()];
}
if (conn.getErrorStream() != null) {
IOUtils.skip(conn.getErrorStream(), conn.getContentLength());
}
@ -435,4 +648,46 @@ private void drainOutput(HttpURLConnection conn) throws IOException {
}
}
}
/**
* Get the URL used to query the activity on the specified Stage.
*
* @param stage the stage to query activity for.
* @return a new URL for querying the activity.
* @throws StageException if the URL is invalid.
*/
private URL getActivityURL(Stage stage) throws StageException {
return constructURL("service/local/staging/repository/%1$s/activity", stage);
}
/**
* Get the URL used to query the specified Stage.
*
* @param stage the stage to query activity for.
* @return a new URL for querying the activity.
* @throws StageException if the URL is invalid.
*/
private URL getRepositoryURL(Stage stage) throws StageException {
return constructURL("service/local/staging/repository/%1$s", stage);
}
/**
* Format a URL based on the specified stage and format.
*
* @param stage the stage to query activity for.
* @param format a format string. "%1" is the stageID %2 is the profileID.
* @return a new URL constructed from the Stage and the format..
* @throws StageException if the URL is invalid.
*/
private URL constructURL(String format, Stage stage) throws StageException {
try {
return new URL(nexusURL, String.format(format, stage.getStageID()));
}
catch (MalformedURLException ex) {
throw createStageExceptionForIOException(nexusURL, ex);
}
}
}

View File

@ -68,8 +68,4 @@ public StageException(Throwable cause) {
super(cause);
}
@Override
public String toString() {
return "StageException " + super.toString();
}
}

View File

@ -0,0 +1,451 @@
/*
* Copyright (c) NDS Limited 2013.
* All rights reserved.
* No part of this program may be reproduced, translated or transmitted,
* in any form or by any means, electronic, mechanical, photocopying,
* recording or otherwise, or stored in any retrieval system of any nature,
* without written permission of the copyright holder.
*/
/*
* Created on 13 Jun 2013 by nordj
*/
package org.jvnet.hudson.plugins.m2release.nexus;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.sun.net.httpserver.BasicAuthenticator;
import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpContext;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.hasXPath;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.same;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@SuppressWarnings("restriction")
public class StageClientTest {
private Stage testStage = new Stage("profile-1", "stage-1");
private URL testURL;
public StageClientTest() throws MalformedURLException {
testURL = new URL("http://127.0.1.2:3456/nexus/");
}
/**
* Tests that the wait successfully blocks until the repository is no longer transitioning
*/
@Test
public void waitForActionToCompleteTest() throws Exception {
final Document transitioning = getDocument("stageClientTest/repository__transitioning.xml");
final Document transitioned = getDocument("stageClientTest/repository__transitioned.xml");
StageClient spy = spy(new StageClient(testURL, "username", "password"));
doAnswer(new Answer<Document>() {
private int calls = 1;
public Document answer(InvocationOnMock invocation) {
return (calls++ % 3 == 0) ? transitioned : transitioning;
}
}).when(spy).getDocument(any(URL.class));
spy.waitForActionToComplete(testStage);
verify(spy, times(3)).getDocument(any(URL.class));
}
/**
* Test when a close fails that the appropriate StageException is thrown. Does not test the performing of
* the action - but the parsing of the results.
*/
@Test
public void closeFailureThrowsExceptionTest() throws Exception {
Document doc = getDocument("stageClientTest/activity__closed_failed.xml");
StageClient spy = spy(new StageClient(new URL("http://localhost:1234/nexus/"), "username", "password"));
doNothing().when(spy).performStageAction(any(StageAction.class), same(testStage), any(String.class));
doNothing().when(spy).waitForActionToComplete(testStage);
doReturn(doc).when(spy).getDocument(any(URL.class));
doReturn(Boolean.TRUE).when(spy).isAsyncClose();
try {
spy.closeStage(testStage, "myDescription");
}
catch (StageException ex) {
assertThat("Cause should not be present as this should be a rule failure.", ex.getCause(),
is(nullValue()));
assertThat(ex.getMessage(), startsWith("Closing stage stage-1 failed."));
assertThat(ex.getMessage(), containsString("One or more rules have failed"));
assertThat(ex.getMessage(),
containsString("Artifact is not unique: 'asd:asd:123' exists in repository 'releases'"));
}
}
/**
* Test when a close fails that the appropriate StageException is thrown. Does not test the performing of
* the action - but the parsing of the results.
*/
@Test
public void closeSucessTest() throws Exception {
Document doc = getDocument("stageClientTest/activity__closed_ok.xml");
StageClient spy = spy(new StageClient(new URL("http://localhost:1234/nexus"), "username", "password"));
doNothing().when(spy).performStageAction(any(StageAction.class), same(testStage), any(String.class));
doNothing().when(spy).waitForActionToComplete(testStage);
doReturn(doc).when(spy).getDocument(any(URL.class));
doReturn(Boolean.TRUE).when(spy).isAsyncClose();
// no exception should be thrown here!
spy.closeStage(testStage, "myDescription");
}
@Test
public void getServerVersionTest() throws Exception {
final Document okPerms = getDocument("stageClientTest/status__ok_perms.xml");
StageClient spy = spy(new StageClient(testURL, "username", "password"));
doReturn(okPerms).when(spy).getDocument(any(URL.class));
String version = spy.getServerVersion();
assertThat("Icorrect version", version, is("2.5.0-04"));
}
@Test
public void isAsyncCloseTest() throws Exception {
StageClient sc = new StageClient(testURL, "username", "password");
assertThat("2.4.0-02 should be async", sc.isAsyncClose("2.4.0-03"), is(true));
assertThat("2.5.0-04 should be async", sc.isAsyncClose("2.5.0-04"), is(true));
assertThat("3.1.0-07 should be async", sc.isAsyncClose("3.1.0-07"), is(true));
assertThat("2.3.23-02 should not be async", sc.isAsyncClose("2.3.23-02"), is(false));
}
/**
* Tests that the getDocument function works correctly when authorised.
*/
@Test
public void getDocumentTest() throws Exception {
String response = "<hello>James was here</hello>";
HttpServer httpServer = createAuthenticatingHttpServer(response, "testuser", "testpassword", "/nexus/");
try {
httpServer.start();
URL url =
new URL("http", httpServer.getAddress().getHostName(), httpServer.getAddress().getPort(),
"/nexus/");
StageClient client = new StageClient(url, "testuser", "testpassword");
Document doc = client.getDocument(url);
// check we have the correct document returned.
assertThat(doc.getFirstChild(), is(notNullValue()));
assertThat(doc.getFirstChild().getNodeName(), is("hello"));
assertThat(doc.getFirstChild().getTextContent(), is("James was here"));
}
finally {
httpServer.stop(0);
}
}
/**
* Tests that the getDocument function works correctly when not authorised.
*/
@Test
public void getDocumentUnAuthorised() throws Exception {
String response = "<hello>James was here</hello>";
HttpServer httpServer = createAuthenticatingHttpServer(response, "testuser", "testpassword", "/nexus/");
try {
httpServer.start();
URL url =
new URL("http", httpServer.getAddress().getHostName(), httpServer.getAddress().getPort(),
"/nexus/");
StageClient client = new StageClient(url, "testuser", "testpassword");
Document doc = client.getDocument(url);
}
catch (StageException ex) {
assertThat(ex.getMessage(), containsString("Incorrect username / password"));
}
finally {
httpServer.stop(0);
}
}
@Test
public void testPromotionEscaping() throws Exception {
String text = "<A Test ]]> String &wibble";
StageClient spy = spy(new StageClient(testURL, "ignored", "ignored"));
String xmlStr = spy.createPromoteRequestPayload(new Stage("profile-1234", "stage-1234"), text, Boolean.FALSE);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(new ByteArrayInputStream(xmlStr.getBytes("UTF-8")));
NodeList list = doc.getElementsByTagName("description");
assertThat(list.getLength(), is(1));
assertThat(list.item(0).getTextContent(), is(text));
}
@Test
public void testPromotionAsync() throws Exception {
StageClient spy = spy(new StageClient(testURL, "ignored", "ignored"));
String xmlStr = spy.createPromoteRequestPayload(new Stage("profile-1234", "stage-1234"), "description", Boolean.FALSE);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(new ByteArrayInputStream(xmlStr.getBytes("UTF-8")));
assertThat(doc, hasXPath("/promoteRequest/data/autoDropAfterRelease", is("false")));
}
@Test
public void testPromotionNonAsync() throws Exception {
StageClient spy = spy(new StageClient(testURL, "ignored", "ignored"));
String xmlStr = spy.createPromoteRequestPayload(new Stage("profile-1234", "stage-1234"), "description", null);
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(new ByteArrayInputStream(xmlStr.getBytes("UTF-8")));
assertThat(doc, not(hasXPath("/promoteRequest/data/autoDropAfterRelease")));
}
/**
* Tests that the successful authentication works correctly.
*/
@Test
public void authenticationPassWithCorrectPermissionsTest() throws Exception {
final Document okPerms = getDocument("stageClientTest/status__ok_perms.xml");
StageClient spy = spy(new StageClient(testURL, "username", "password"));
doReturn(okPerms).when(spy).getDocument(any(URL.class));
spy.checkAuthentication();
}
/**
* Tests that the successful authentication with not enough privileges works correctly.
*/
@Test
public void authenticationPassWithIncorrectPermissionsTest() throws Exception {
final Document okPerms = getDocument("stageClientTest/status__bad_perms.xml");
StageClient spy = spy(new StageClient(testURL, "username", "password"));
doReturn(okPerms).when(spy).getDocument(any(URL.class));
try {
spy.checkAuthentication();
fail("Exception should have been thrown");
}
catch (StageException ex) {
assertThat(ex.getMessage(), containsString("insufficient privileges to perform staging actions"));
}
}
/**
* Tests that the successful authentication with not enough privileges works correctly.
*/
@Test
public void authenticationFailTest() throws Exception {
HttpServer httpServer =
createAuthenticatingHttpServer("bogus", "testuser", "testpassword", "/nexus/service/local/status");
try {
httpServer.start();
URL url =
new URL("http", httpServer.getAddress().getHostName(), httpServer.getAddress().getPort(),
"/nexus/");
StageClient client = new StageClient(url, "testuser", "wrongpassword");
client.checkAuthentication();
fail("Exception should have been thrown.");
}
catch (StageException ex) {
assertThat(ex.getMessage(), containsString("Incorrect username / password"));
}
finally {
httpServer.stop(0);
}
}
@Test
public void openStagesMethodShouldReturnCorrectStages() throws Exception {
Stage expectedStage1 = new Stage("3e1e1bad64f", "test-001");
Stage expectedStage2 = new Stage("3e1e1bad64f", "test-005");
Document doc = getDocument("stageClientTest/profile_repositories.xml");
StageClient spy = spy(new StageClient(testURL, "username", "password"));
doReturn(doc).when(spy).getDocument(any(URL.class));
List<Stage> stages = spy.getOpenStageIDs();
assertThat(stages, hasSize(2));
assertThat(stages, hasItems(expectedStage1, expectedStage2));
}
@Test
public void checkStageForGAVReturnsCorrectStage() throws Exception {
List<Stage> stages = new ArrayList<Stage>();
stages.add(new Stage("profile1", "profile1-1001"));
stages.add(new Stage("profile1", "profile1-1002"));
stages.add(new Stage("profile2", "profile2-1001"));
stages.add(new Stage("profile2", "profile2-1002"));
Stage targetStage = stages.get(2);
HttpServer httpServer =
createAuthenticatingHttpServer("", "username", "password",
"/nexus/service/local/repositories/profile2-1001/content/org/example/test/test/1.2.3-4/");
try {
httpServer.start();
URL url =
new URL("http", httpServer.getAddress().getHostName(), httpServer.getAddress().getPort(),
"/nexus/");
StageClient sc = new StageClient(url, "username", "password");
for (Stage stage : stages) {
boolean found = sc.checkStageForGAV(stage, "org.example.test", "test", "1.2.3-4");
assertEquals("Incorrect stage match (" + stage + ").", (stage == targetStage), found);
}
}
finally {
httpServer.stop(0);
}
}
/**
* Creates an HTTP Server bound to a random port on 127.0.0.1. The Caller must start and stop this server
* when it is no longer required.
*
* @param text the text to return with the request.
* @param user the username that must be sent to match authentication.
* @param pass the password that must be sent to match authentication.
* @param requestPath the path for which the text should be returned - other paths will result in a 404
* response.
* @return The newly created (and started) HTTP Server.
*/
private HttpServer createAuthenticatingHttpServer(final String text,
final String username,
final String password,
final String requestPath) throws IOException {
HttpServer httpServer = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 1);
HttpContext ctx = httpServer.createContext("/");
BasicAuthenticator authenticator = new BasicAuthenticator("my realm") {
@Override
public boolean checkCredentials(String user, String pass) {
return (username.equals(user) && password.equals(pass));
}
};
ctx.setAuthenticator(authenticator);
HttpHandler handler = new HttpHandler() {
public void handle(HttpExchange exchange) throws IOException {
String path = exchange.getRequestURI().getPath();
if (path.equals(requestPath)) {
byte[] data = text.getBytes("UTF-8");
Headers headers = exchange.getResponseHeaders();
if (exchange.getRequestMethod().equals("POST")) {
exchange.sendResponseHeaders(HttpURLConnection.HTTP_CREATED, -1);
OutputStream os = exchange.getResponseBody();
os.close();
}
else {
headers.add("Content-Type", "application/xml; charset=UTF-8");
exchange.sendResponseHeaders(HttpURLConnection.HTTP_OK, data.length);
if (exchange.getRequestMethod().equals("HEAD")) {
// bug in sun HTTP Server - warning produces here should not exist.
OutputStream os = exchange.getResponseBody();
os.close();
}
else {
OutputStream os = exchange.getResponseBody();
os.write(data);
os.close();
}
}
}
else {
Headers headers = exchange.getResponseHeaders();
headers.add("Content-Type", "application/xml; charset=UTF-8");
exchange.sendResponseHeaders(HttpURLConnection.HTTP_NOT_FOUND, -1);
OutputStream os = exchange.getResponseBody();
os.close();
}
}
};
ctx.setHandler(handler);
return httpServer;
}
private static Document getDocument(String testResource) throws ParserConfigurationException,
SAXException, IOException {
URL url = StageClientTest.class.getResource(testResource);
assertThat("resource not found for: " + testResource, url, is(notNullValue()));
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
return builder.parse(url.openStream());
}
}

View File

@ -1,88 +1,77 @@
package org.jvnet.hudson.plugins.m2release.nexus;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
@Ignore("requires infrastructure.")
import static org.hamcrest.core.Is.is;
public class StageTest {
// TODO start an embedded server instead to server these files so we also test http auth access?
// TODO start an embedded server instead to server these files so we also
// test http auth access?
private static final URL NEXUS_URL;
static {
try {
//NEXUS_URL = new URL("http://localhost:8081/nexus");
NEXUS_URL = StageTest.class.getResource("stageTest/");
/*
try {
// NEXUS_URL = new URL("http://localhost:8081/nexus"); //
NEXUS_URL = new URL("http://192.168.1.65:8081/nexus");
//NEXUS_URL = StageTest.class.getResource("stageTest");
}
catch (MalformedURLException e) {
throw new RuntimeException("Impossible Condition", e);
}
}
@Test
public void testValidAuth() throws Exception {
StageClient client = new StageClient(NEXUS_URL, "admin", "admin123");
client.checkAuthentication();
} catch (java.net.MalformedURLException e) {
throw new RuntimeException("Impossible Condition", e);
}
*/
}
@Test(expected=Exception.class)
public void testInvalidAuth() throws Exception {
StageClient client = new StageClient(NEXUS_URL, "bob", "jones");
client.checkAuthentication();
}
@Test
public void testStage() throws Exception {
StageClient client = new StageClient(NEXUS_URL, "admin", "admin123");
List<Stage> stages = client.getOpenStageIDs();
Assert.assertEquals("incorrect number of stages returned", 2, stages.size());
Assert.assertEquals("Incorrect stage returned", "3e1e1bad64f", stages.get(0).getProfileID());
Assert.assertEquals("Incorrect stage returned", "test-001", stages.get(0).getStageID());
Assert.assertEquals("Incorrect stage returned", "3e1e1bad64f", stages.get(1).getProfileID());
Assert.assertEquals("Incorrect stage returned", "test-005", stages.get(1).getStageID());
}
@Test
@Ignore("requres test setup")
public void testSpecificStage() throws Exception {
Assume.assumeThat(NEXUS_URL.getProtocol(), is("file"));
StageClient client = new StageClient(NEXUS_URL, "admin", "admin123");
// group and artifact don't exist
Stage stage = client.getOpenStageID("invalid", "bogus", "1.2.3-4");
Assert.assertNull("Stage returned but we should not have one", stage);
// group and artifact exist but at different version
stage = client.getOpenStageID("com.test.testone", "test", "1.0.2");
Assert.assertNull("Stage returned but we should not have one", stage);
// full gav match
stage = client.getOpenStageID("com.test.testone", "test", "1.0.0");
Assert.assertEquals("Incorrect stage returned", "test-005", stage.getStageID());
Assert.assertEquals("Incorrect stage returned", "test-005",
stage.getStageID());
// match group and artifact for any version
stage = client.getOpenStageID("com.test.testone", "test", null);
Assert.assertEquals("Incorrect stage returned", "test-005", stage.getStageID());
}
@Test
public void testCloseStage() throws Exception {
StageClient client = new StageClient(NEXUS_URL, "admin", "admin123");
Stage stage = client.getOpenStageID("com.test.testone", "test", "1.0.0");
Assert.assertNotNull("Stage is null", stage);
client.closeStage(stage, "Test stage closing from StageClient");
Assert.assertEquals("Incorrect stage returned", "test-005",
stage.getStageID());
}
@Test
public void testDropStage() throws Exception {
@Ignore("requres test setup")
public void testCloseStage() throws Exception {
Assume.assumeThat(NEXUS_URL.getProtocol(), is("http"));
StageClient client = new StageClient(NEXUS_URL, "admin", "admin123");
Stage stage = client.getOpenStageID("com.test.testone", "test", "1.0.0");
Stage stage = client
.getOpenStageID("com.test.testone", "test", "1.0.0");
Assert.assertNotNull("Stage is null", stage);
client.closeStage(stage, "Test stage closing from StageClient");
}
@Test
@Ignore("requres test setup")
public void testDropStage() throws Exception {
Assume.assumeThat(NEXUS_URL.getProtocol(), is("http"));
StageClient client = new StageClient(NEXUS_URL, "admin", "admin123");
Stage stage = client
.getOpenStageID("com.test.testone", "test", "1.0.0");
Assert.assertNotNull("Stage is null", stage);
client.dropStage(stage);
}

View File

@ -0,0 +1,396 @@
<list>
<stagingActivity>
<name>open</name>
<started>2013-06-12T08:31:08.703-07:00</started>
<stopped>2013-06-12T08:31:08.911-07:00</stopped>
<events>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:08.908-07:00</timestamp>
<name>repositoryCreated</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>testprofile-1002</value>
</stagingProperty>
<stagingProperty>
<name>user</name>
<value>admin</value>
</stagingProperty>
<stagingProperty>
<name>ip</name>
<value>127.0.0.1</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
</events>
</stagingActivity>
<stagingActivity>
<name>close</name>
<started>2013-06-12T08:31:09.677-07:00</started>
<startedByUserId>admin</startedByUserId>
<startedByIpAddress>127.0.0.1</startedByIpAddress>
<stopped>2013-06-12T08:31:09.749-07:00</stopped>
<events>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.678-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>checksum-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>sources-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.679-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.694-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.695-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.708-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.709-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.729-07:00</timestamp>
<name>ruleFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>failureMessage</name>
<value>Artifact is not unique: &apos;asd:asd:123&apos; exists in repository &apos;releases&apos;</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.730-07:00</timestamp>
<name>rulesFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>failureCount</name>
<value>1</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.736-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.737-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.745-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.747-07:00</timestamp>
<name>rulesPassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.748-07:00</timestamp>
<name>repositoryCloseFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>testprofile-1002</value>
</stagingProperty>
<stagingProperty>
<name>cause</name>
<value>com.sonatype.nexus.staging.StagingRulesFailedException: One or more rules have failed</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
</events>
</stagingActivity>
<stagingActivity>
<name>close</name>
<started>2013-06-12T09:12:22.037-07:00</started>
<startedByUserId>admin</startedByUserId>
<startedByIpAddress>127.0.0.1</startedByIpAddress>
<stopped>2013-06-12T09:12:22.124-07:00</stopped>
<events>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.039-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>checksum-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>sources-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.041-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.062-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.065-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.095-07:00</timestamp>
<name>ruleFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>failureMessage</name>
<value>Artifact is not unique: &apos;asd:asd:123&apos; exists in repository &apos;releases&apos;</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.097-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.108-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.111-07:00</timestamp>
<name>rulesFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>failureCount</name>
<value>1</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.113-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.115-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.118-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.120-07:00</timestamp>
<name>rulesPassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.122-07:00</timestamp>
<name>repositoryCloseFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>testprofile-1002</value>
</stagingProperty>
<stagingProperty>
<name>cause</name>
<value>com.sonatype.nexus.staging.StagingRulesFailedException: One or more rules have failed</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
</events>
</stagingActivity>
</list>

View File

@ -0,0 +1,491 @@
<list>
<stagingActivity>
<name>open</name>
<started>2013-06-12T08:31:08.703-07:00</started>
<stopped>2013-06-12T08:31:08.911-07:00</stopped>
<events>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:08.908-07:00</timestamp>
<name>repositoryCreated</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>testprofile-1002</value>
</stagingProperty>
<stagingProperty>
<name>user</name>
<value>admin</value>
</stagingProperty>
<stagingProperty>
<name>ip</name>
<value>127.0.0.1</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
</events>
</stagingActivity>
<stagingActivity>
<name>close</name>
<started>2013-06-12T08:31:09.677-07:00</started>
<startedByUserId>admin</startedByUserId>
<startedByIpAddress>127.0.0.1</startedByIpAddress>
<stopped>2013-06-12T08:31:09.749-07:00</stopped>
<events>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.678-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>checksum-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>sources-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.679-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.694-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.695-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.708-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.709-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.729-07:00</timestamp>
<name>ruleFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>failureMessage</name>
<value>Artifact is not unique: &apos;asd:asd:123&apos; exists in repository &apos;releases&apos;</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.730-07:00</timestamp>
<name>rulesFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>failureCount</name>
<value>1</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.736-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.737-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.745-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.747-07:00</timestamp>
<name>rulesPassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T08:31:09.748-07:00</timestamp>
<name>repositoryCloseFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>testprofile-1002</value>
</stagingProperty>
<stagingProperty>
<name>cause</name>
<value>com.sonatype.nexus.staging.StagingRulesFailedException: One or more rules have failed</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
</events>
</stagingActivity>
<stagingActivity>
<name>close</name>
<started>2013-06-12T09:12:22.037-07:00</started>
<startedByUserId>admin</startedByUserId>
<startedByIpAddress>127.0.0.1</startedByIpAddress>
<stopped>2013-06-12T09:12:22.124-07:00</stopped>
<events>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.039-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>checksum-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>sources-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.041-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.062-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>checksum-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.065-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.095-07:00</timestamp>
<name>ruleFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>failureMessage</name>
<value>Artifact is not unique: &apos;asd:asd:123&apos; exists in repository &apos;releases&apos;</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.097-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.108-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.111-07:00</timestamp>
<name>rulesFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>failureCount</name>
<value>1</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.113-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.115-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.118-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.120-07:00</timestamp>
<name>rulesPassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:22.122-07:00</timestamp>
<name>repositoryCloseFailed</name>
<severity>1</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>testprofile-1002</value>
</stagingProperty>
<stagingProperty>
<name>cause</name>
<value>com.sonatype.nexus.staging.StagingRulesFailedException: One or more rules have failed</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
</events>
</stagingActivity>
<stagingActivity>
<name>close</name>
<started>2013-06-12T09:12:42.955-07:00</started>
<startedByUserId>admin</startedByUserId>
<startedByIpAddress>127.0.0.1</startedByIpAddress>
<stopped>2013-06-12T09:12:43.125-07:00</stopped>
<events>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:42.959-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>24d6c427e4f</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>uniq-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>checksum-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>no-system-scope-in-pom-staging</value>
</stagingProperty>
<stagingProperty>
<name>rule.disabled</name>
<value>sources-staging</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:42.963-07:00</timestamp>
<name>rulesEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
<stagingProperty>
<name>rule</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:42.966-07:00</timestamp>
<name>ruleEvaluate</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:42.970-07:00</timestamp>
<name>rulePassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>typeId</name>
<value>RepositoryWritePolicy</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:42.974-07:00</timestamp>
<name>rulesPassed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>nx-internal-ruleset</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
<stagingActivityEvent>
<timestamp>2013-06-12T09:12:43.123-07:00</timestamp>
<name>repositoryClosed</name>
<severity>0</severity>
<properties>
<stagingProperty>
<name>id</name>
<value>testprofile-1002</value>
</stagingProperty>
</properties>
</stagingActivityEvent>
</events>
</stagingActivity>
</list>

View File

@ -0,0 +1,97 @@
<stagingRepositories>
<data>
<stagingProfileRepository>
<profileId>3e1e1bad64f</profileId>
<profileName>test</profileName>
<profileType>repository</profileType>
<repositoryId>test-001</repositoryId>
<repositoryName>test-001 (u:deployuser, a:127.0.1.2)</repositoryName>
<type>open</type>
<policy>release</policy>
<userId>deploy_release</userId>
<userAgent>Maven 3.0.4</userAgent>
<ipAddress>127.0.3.1</ipAddress>
<repositoryURI>http://127.0.0.1/content/repositories/test-001</repositoryURI>
<createdDate>Tue Apr 30 16:17:52 BST 2013</createdDate>
<closedDate>n/a</closedDate>
<provider>maven2</provider>
<releaseRepositoryId>releases</releaseRepositoryId>
<releaseRepositoryName>My Releases</releaseRepositoryName>
</stagingProfileRepository>
<stagingProfileRepository>
<profileId>3e1e1bad64f</profileId>
<profileName>test</profileName>
<profileType>repository</profileType>
<repositoryId>test-005</repositoryId>
<repositoryName>test-005 (u:deployuser, a:127.0.1.2)</repositoryName>
<type>open</type>
<policy>release</policy>
<userId>deploy_release</userId>
<userAgent>Maven 3.0.4</userAgent>
<ipAddress>127.0.3.1</ipAddress>
<repositoryURI>http://127.0.0.1/content/repositories/test-005</repositoryURI>
<createdDate>Thu May 02 11:39:43 BST 2013</createdDate>
<closedDate>n/a</closedDate>
<provider>maven2</provider>
<releaseRepositoryId>releases</releaseRepositoryId>
<releaseRepositoryName>My Releases</releaseRepositoryName>
</stagingProfileRepository>
<stagingProfileRepository>
<profileId>3e1e1bad64f</profileId>
<profileName>test</profileName>
<profileType>repository</profileType>
<repositoryId>test-002</repositoryId>
<repositoryName>test-002 (u:deployuser, a:127.0.1.2)</repositoryName>
<type>closed</type>
<policy>release</policy>
<userId>deploy_release</userId>
<userAgent>Maven 3.0.4</userAgent>
<ipAddress>127.0.3.1</ipAddress>
<repositoryURI>http://127.0.0.1/content/repositories/test-002</repositoryURI>
<createdDate>Mon Apr 08 08:30:53 BST 2013</createdDate>
<closedDate>Mon Apr 08 08:36:54 BST 2013</closedDate>
<description>A description of stage 002</description>
<provider>maven2</provider>
<releaseRepositoryId>releases</releaseRepositoryId>
<releaseRepositoryName>My Releases</releaseRepositoryName>
</stagingProfileRepository>
<stagingProfileRepository>
<profileId>3e1e1bad64f</profileId>
<profileName>test</profileName>
<profileType>repository</profileType>
<repositoryId>test-003</repositoryId>
<repositoryName>test-003 (u:deployuser, a:127.0.1.2)</repositoryName>
<type>closed</type>
<policy>release</policy>
<userId>deploy_release</userId>
<userAgent>Maven 3.0.4</userAgent>
<ipAddress>127.0.3.1</ipAddress>
<repositoryURI>http://127.0.0.1/content/repositories/test-003</repositoryURI>
<createdDate>Tue Apr 09 15:00:21 BST 2013</createdDate>
<closedDate>Tue Apr 09 15:24:41 BST 2013</closedDate>
<description>A description of stage 003</description>
<provider>maven2</provider>
<releaseRepositoryId>releases</releaseRepositoryId>
<releaseRepositoryName>My Releases</releaseRepositoryName>
</stagingProfileRepository>
<stagingProfileRepository>
<profileId>3e1e1bad64f</profileId>
<profileName>test</profileName>
<profileType>repository</profileType>
<repositoryId>test-004</repositoryId>
<repositoryName>test-004 (u:deployuser, a:127.0.1.2)</repositoryName>
<type>closed</type>
<policy>release</policy>
<userId>deploy_release</userId>
<userAgent>Maven 3.0.4</userAgent>
<ipAddress>127.0.3.1</ipAddress>
<repositoryURI>http://127.0.0.1/content/repositories/test-004</repositoryURI>
<createdDate>Fri Apr 12 13:50:05 BST 2013</createdDate>
<closedDate>Fri Apr 12 14:05:57 BST 2013</closedDate>
<description>A description of stage 004</description>
<provider>maven2</provider>
<releaseRepositoryId>releases</releaseRepositoryId>
<releaseRepositoryName>My Releases</releaseRepositoryName>
</stagingProfileRepository>
</data>
</stagingRepositories>

View File

@ -0,0 +1,24 @@
<stagingProfileRepository>
<profileId>256fd5bb949</profileId>
<profileName>testprofile</profileName>
<profileType>repository</profileType>
<repositoryId>testprofile-1002</repositoryId>
<type>closed</type>
<policy>release</policy>
<userId>admin</userId>
<userAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36</userAgent>
<ipAddress>127.0.0.1</ipAddress>
<repositoryURI>http://127.0.0.1:8081/nexus/content/repositories/testprofile-1002</repositoryURI>
<created>2013-06-12T08:31:08.703-07:00</created>
<createdDate>Wed Jun 12 08:31:08 PDT 2013</createdDate>
<createdTimestamp>1371051068703</createdTimestamp>
<updated>2013-06-13T08:41:49.110-07:00</updated>
<updatedDate>Thu Jun 13 08:41:49 PDT 2013</updatedDate>
<updatedTimestamp>1371138109110</updatedTimestamp>
<description>mydescription</description>
<provider>maven2</provider>
<releaseRepositoryId>releases</releaseRepositoryId>
<releaseRepositoryName>Releases</releaseRepositoryName>
<notifications>4</notifications>
<transitioning>false</transitioning>
</stagingProfileRepository>

View File

@ -0,0 +1,24 @@
<stagingProfileRepository>
<profileId>256fd5bb949</profileId>
<profileName>testprofile</profileName>
<profileType>repository</profileType>
<repositoryId>testprofile-1002</repositoryId>
<type>open</type>
<policy>release</policy>
<userId>admin</userId>
<userAgent>Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36</userAgent>
<ipAddress>127.0.0.1</ipAddress>
<repositoryURI>http://127.0.0.1:8081/nexus/content/repositories/testprofile-1002</repositoryURI>
<created>2013-06-12T08:31:08.703-07:00</created>
<createdDate>Wed Jun 12 08:31:08 PDT 2013</createdDate>
<createdTimestamp>1371051068703</createdTimestamp>
<updated>2013-06-13T08:41:49.110-07:00</updated>
<updatedDate>Thu Jun 13 08:41:49 PDT 2013</updatedDate>
<updatedTimestamp>1371138109110</updatedTimestamp>
<description>mydescription</description>
<provider>maven2</provider>
<releaseRepositoryId>releases</releaseRepositoryId>
<releaseRepositoryName>Releases</releaseRepositoryName>
<notifications>4</notifications>
<transitioning>true</transitioning>
</stagingProfileRepository>

View File

@ -0,0 +1,374 @@
<status>
<data>
<appName>Sonatype Nexus Professional</appName>
<formattedAppName>Sonatype Nexus&amp;trade; Professional Edition, Version: 2.5.0-04</formattedAppName>
<version>2.5.0-04</version>
<apiVersion>2.5.0-04</apiVersion>
<editionLong>Professional</editionLong>
<editionShort>PRO</editionShort>
<attributionsURL>http://links.sonatype.com/products/nexus/pro/attributions</attributionsURL>
<purchaseURL>http://links.sonatype.com/products/nexus/pro/store</purchaseURL>
<userLicenseURL>http://links.sonatype.com/products/nexus/pro/eula</userLicenseURL>
<state>STARTED</state>
<operationMode>STANDALONE</operationMode>
<initializedAt>2013-06-13 14:38:12.315 UTC</initializedAt>
<startedAt>2013-06-13 14:38:20.528 UTC</startedAt>
<lastConfigChange>2013-06-13 14:38:20.527 UTC</lastConfigChange>
<firstStart>false</firstStart>
<instanceUpgraded>false</instanceUpgraded>
<configurationUpgraded>false</configurationUpgraded>
<clientPermissions>
<loggedIn>false</loggedIn>
<permissions>
<permission>
<id>nexus:healthcheck</id>
<value>1</value>
</permission>
<permission>
<id>nexus:stagingdrop</id>
<value>0</value>
</permission>
<permission>
<id>nexus:authentication</id>
<value>0</value>
</permission>
<permission>
<id>security:userssetpw</id>
<value>0</value>
</permission>
<permission>
<id>security:users</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingstart</id>
<value>0</value>
</permission>
<permission>
<id>security:privilegetypes</id>
<value>0</value>
</permission>
<permission>
<id>security:userschangepw</id>
<value>0</value>
</permission>
<permission>
<id>nexus:capabilities</id>
<value>0</value>
</permission>
<permission>
<id>nexus:pgpcache</id>
<value>0</value>
</permission>
<permission>
<id>security:usersforgotid</id>
<value>9</value>
</permission>
<permission>
<id>nexus:index</id>
<value>1</value>
</permission>
<permission>
<id>nexus:targets</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingruletypes</id>
<value>0</value>
</permission>
<permission>
<id>nexus:settingstemplates</id>
<value>0</value>
</permission>
<permission>
<id>nexus:ssl:truststore</id>
<value>0</value>
</permission>
<permission>
<id>nexus:metadata</id>
<value>0</value>
</permission>
<permission>
<id>nexus:smartproxy:pub-sub</id>
<value>0</value>
</permission>
<permission>
<id>nexus:smartproxy:trusted-keys</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingfinish</id>
<value>0</value>
</permission>
<permission>
<id>nexus:yumAlias</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingrulesets</id>
<value>0</value>
</permission>
<permission>
<id>nexus:componentrealmtypes</id>
<value>0</value>
</permission>
<permission>
<id>nexus:logconfig</id>
<value>0</value>
</permission>
<permission>
<id>nexus:usertoken:users</id>
<value>0</value>
</permission>
<permission>
<id>nexus:browseremote</id>
<value>1</value>
</permission>
<permission>
<id>nexus:configuration</id>
<value>0</value>
</permission>
<permission>
<id>nexus:repositories</id>
<value>1</value>
</permission>
<permission>
<id>nexus:pgpconfig</id>
<value>0</value>
</permission>
<permission>
<id>nexus:repositorymirrorsstatus</id>
<value>0</value>
</permission>
<permission>
<id>security:*</id>
<value>0</value>
</permission>
<permission>
<id>nexus:archivefiles</id>
<value>1</value>
</permission>
<permission>
<id>nexus:logs</id>
<value>0</value>
</permission>
<permission>
<id>nexus:usertoken:user</id>
<value>0</value>
</permission>
<permission>
<id>nexus:componentsrepotypes</id>
<value>1</value>
</permission>
<permission>
<id>nexus:stagingupload</id>
<value>0</value>
</permission>
<permission>
<id>nexus:command</id>
<value>0</value>
</permission>
<permission>
<id>security:usersreset</id>
<value>0</value>
</permission>
<permission>
<id>nexus:repositorymirrors</id>
<value>0</value>
</permission>
<permission>
<id>nexus:usertoken:settings</id>
<value>0</value>
</permission>
<permission>
<id>nexus:feeds</id>
<value>0</value>
</permission>
<permission>
<id>nexus:metrics-endpoints</id>
<value>0</value>
</permission>
<permission>
<id>nexus:attributes</id>
<value>0</value>
</permission>
<permission>
<id>security:ldapconfig</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingprofilerepos</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingdeploy</id>
<value>0</value>
</permission>
<permission>
<id>nexus:artifact</id>
<value>1</value>
</permission>
<permission>
<id>nexus:healthchecksummary</id>
<value>1</value>
</permission>
<permission>
<id>nexus:tasksrun</id>
<value>0</value>
</permission>
<permission>
<id>nexus:settings</id>
<value>0</value>
</permission>
<permission>
<id>nexus:wastebasket</id>
<value>0</value>
</permission>
<permission>
<id>nexus:procurementtree</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingprofileorder</id>
<value>0</value>
</permission>
<permission>
<id>nexus:tasktypes</id>
<value>0</value>
</permission>
<permission>
<id>nexus:licensing</id>
<value>0</value>
</permission>
<permission>
<id>nexus:repotemplates</id>
<value>0</value>
</permission>
<permission>
<id>nexus:healthcheckalerts</id>
<value>3</value>
</permission>
<permission>
<id>nexus:procurementresolution</id>
<value>0</value>
</permission>
<permission>
<id>nexus:smartproxy:settings</id>
<value>0</value>
</permission>
<permission>
<id>security:privileges</id>
<value>0</value>
</permission>
<permission>
<id>nexus:tasks</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingbundleupload</id>
<value>0</value>
</permission>
<permission>
<id>nexus:yumVersionedRepositories</id>
<value>0</value>
</permission>
<permission>
<id>nexus:*</id>
<value>0</value>
</permission>
<permission>
<id>nexus:repositorypredefinedmirrors</id>
<value>0</value>
</permission>
<permission>
<id>security:componentsuserlocatortypes</id>
<value>0</value>
</permission>
<permission>
<id>nexus:routes</id>
<value>0</value>
</permission>
<permission>
<id>security:roles</id>
<value>0</value>
</permission>
<permission>
<id>nexus:repogroups</id>
<value>1</value>
</permission>
<permission>
<id>nexus:componentscheduletypes</id>
<value>0</value>
</permission>
<permission>
<id>security:usersforgotpw</id>
<value>9</value>
</permission>
<permission>
<id>nexus:stagingprofiles</id>
<value>0</value>
</permission>
<permission>
<id>nexus:cache</id>
<value>0</value>
</permission>
<permission>
<id>nexus:usertoken:current</id>
<value>0</value>
</permission>
<permission>
<id>apikey:access</id>
<value>0</value>
</permission>
<permission>
<id>nexus:identify</id>
<value>1</value>
</permission>
<permission>
<id>nexus:repostatus</id>
<value>1</value>
</permission>
<permission>
<id>nexus:procurementrepos</id>
<value>0</value>
</permission>
<permission>
<id>nexus:stagingpromote</id>
<value>0</value>
</permission>
<permission>
<id>nexus:dependency-report</id>
<value>1</value>
</permission>
<permission>
<id>nexus:capabilityTypes</id>
<value>0</value>
</permission>
<permission>
<id>nexus:repometa</id>
<value>0</value>
</permission>
<permission>
<id>nexus:componentscontentclasses</id>
<value>1</value>
</permission>
<permission>
<id>nexus:healthcheckdetail</id>
<value>0</value>
</permission>
<permission>
<id>nexus:status</id>
<value>1</value>
</permission>
<permission>
<id>nexus:pluginconsoleplugininfos</id>
<value>0</value>
</permission>
</permissions>
</clientPermissions>
<baseUrl>http://127.0.0.1:8081/nexus</baseUrl>
<licenseInstalled>true</licenseInstalled>
<licenseExpired>false</licenseExpired>
<trialLicense>false</trialLicense>
</data>
</status>

View File

@ -0,0 +1,377 @@
<status>
<data>
<appName>Sonatype Nexus Professional</appName>
<formattedAppName>Sonatype Nexus&amp;trade; Professional Edition, Version: 2.5.0-04</formattedAppName>
<version>2.5.0-04</version>
<apiVersion>2.5.0-04</apiVersion>
<editionLong>Professional</editionLong>
<editionShort>PRO</editionShort>
<attributionsURL>http://links.sonatype.com/products/nexus/pro/attributions</attributionsURL>
<purchaseURL>http://links.sonatype.com/products/nexus/pro/store</purchaseURL>
<userLicenseURL>http://links.sonatype.com/products/nexus/pro/eula</userLicenseURL>
<state>STARTED</state>
<operationMode>STANDALONE</operationMode>
<initializedAt>2013-06-13 14:38:12.315 UTC</initializedAt>
<startedAt>2013-06-13 14:38:20.528 UTC</startedAt>
<lastConfigChange>2013-06-13 14:38:20.527 UTC</lastConfigChange>
<firstStart>false</firstStart>
<instanceUpgraded>false</instanceUpgraded>
<configurationUpgraded>false</configurationUpgraded>
<clientPermissions>
<loggedIn>true</loggedIn>
<loggedInUsername>admin</loggedInUsername>
<loggedInUserSource>default</loggedInUserSource>
<permissions>
<permission>
<id>nexus:healthcheck</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingdrop</id>
<value>15</value>
</permission>
<permission>
<id>nexus:authentication</id>
<value>15</value>
</permission>
<permission>
<id>security:userssetpw</id>
<value>15</value>
</permission>
<permission>
<id>security:users</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingstart</id>
<value>15</value>
</permission>
<permission>
<id>security:privilegetypes</id>
<value>15</value>
</permission>
<permission>
<id>security:userschangepw</id>
<value>15</value>
</permission>
<permission>
<id>nexus:capabilities</id>
<value>15</value>
</permission>
<permission>
<id>nexus:pgpcache</id>
<value>15</value>
</permission>
<permission>
<id>nexus:targets</id>
<value>15</value>
</permission>
<permission>
<id>nexus:index</id>
<value>15</value>
</permission>
<permission>
<id>security:usersforgotid</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingruletypes</id>
<value>15</value>
</permission>
<permission>
<id>nexus:settingstemplates</id>
<value>15</value>
</permission>
<permission>
<id>nexus:ssl:truststore</id>
<value>15</value>
</permission>
<permission>
<id>nexus:metadata</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingfinish</id>
<value>15</value>
</permission>
<permission>
<id>nexus:smartproxy:pub-sub</id>
<value>15</value>
</permission>
<permission>
<id>nexus:yumAlias</id>
<value>15</value>
</permission>
<permission>
<id>nexus:smartproxy:trusted-keys</id>
<value>15</value>
</permission>
<permission>
<id>nexus:componentrealmtypes</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingrulesets</id>
<value>15</value>
</permission>
<permission>
<id>nexus:logconfig</id>
<value>15</value>
</permission>
<permission>
<id>nexus:usertoken:users</id>
<value>15</value>
</permission>
<permission>
<id>nexus:browseremote</id>
<value>15</value>
</permission>
<permission>
<id>nexus:configuration</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repositories</id>
<value>15</value>
</permission>
<permission>
<id>nexus:pgpconfig</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repositorymirrorsstatus</id>
<value>15</value>
</permission>
<permission>
<id>security:*</id>
<value>15</value>
</permission>
<permission>
<id>nexus:archivefiles</id>
<value>15</value>
</permission>
<permission>
<id>nexus:logs</id>
<value>15</value>
</permission>
<permission>
<id>nexus:usertoken:user</id>
<value>15</value>
</permission>
<permission>
<id>nexus:componentsrepotypes</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingupload</id>
<value>15</value>
</permission>
<permission>
<id>nexus:command</id>
<value>15</value>
</permission>
<permission>
<id>nexus:usertoken:settings</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repositorymirrors</id>
<value>15</value>
</permission>
<permission>
<id>security:usersreset</id>
<value>15</value>
</permission>
<permission>
<id>nexus:feeds</id>
<value>15</value>
</permission>
<permission>
<id>nexus:metrics-endpoints</id>
<value>15</value>
</permission>
<permission>
<id>nexus:attributes</id>
<value>15</value>
</permission>
<permission>
<id>security:ldapconfig</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingprofilerepos</id>
<value>15</value>
</permission>
<permission>
<id>nexus:artifact</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingdeploy</id>
<value>15</value>
</permission>
<permission>
<id>nexus:healthchecksummary</id>
<value>15</value>
</permission>
<permission>
<id>nexus:tasksrun</id>
<value>15</value>
</permission>
<permission>
<id>nexus:settings</id>
<value>15</value>
</permission>
<permission>
<id>nexus:wastebasket</id>
<value>15</value>
</permission>
<permission>
<id>nexus:procurementtree</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingprofileorder</id>
<value>15</value>
</permission>
<permission>
<id>nexus:tasktypes</id>
<value>15</value>
</permission>
<permission>
<id>nexus:licensing</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repotemplates</id>
<value>15</value>
</permission>
<permission>
<id>nexus:healthcheckalerts</id>
<value>15</value>
</permission>
<permission>
<id>nexus:procurementresolution</id>
<value>15</value>
</permission>
<permission>
<id>nexus:smartproxy:settings</id>
<value>15</value>
</permission>
<permission>
<id>security:privileges</id>
<value>15</value>
</permission>
<permission>
<id>nexus:tasks</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingbundleupload</id>
<value>15</value>
</permission>
<permission>
<id>nexus:yumVersionedRepositories</id>
<value>15</value>
</permission>
<permission>
<id>nexus:*</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repositorypredefinedmirrors</id>
<value>15</value>
</permission>
<permission>
<id>security:componentsuserlocatortypes</id>
<value>15</value>
</permission>
<permission>
<id>nexus:routes</id>
<value>15</value>
</permission>
<permission>
<id>security:roles</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repogroups</id>
<value>15</value>
</permission>
<permission>
<id>nexus:componentscheduletypes</id>
<value>15</value>
</permission>
<permission>
<id>security:usersforgotpw</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingprofiles</id>
<value>15</value>
</permission>
<permission>
<id>nexus:cache</id>
<value>15</value>
</permission>
<permission>
<id>nexus:usertoken:current</id>
<value>15</value>
</permission>
<permission>
<id>apikey:access</id>
<value>15</value>
</permission>
<permission>
<id>nexus:identify</id>
<value>15</value>
</permission>
<permission>
<id>nexus:procurementrepos</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repostatus</id>
<value>15</value>
</permission>
<permission>
<id>nexus:stagingpromote</id>
<value>15</value>
</permission>
<permission>
<id>nexus:dependency-report</id>
<value>15</value>
</permission>
<permission>
<id>nexus:capabilityTypes</id>
<value>15</value>
</permission>
<permission>
<id>nexus:componentscontentclasses</id>
<value>15</value>
</permission>
<permission>
<id>nexus:repometa</id>
<value>15</value>
</permission>
<permission>
<id>nexus:healthcheckdetail</id>
<value>15</value>
</permission>
<permission>
<id>nexus:status</id>
<value>15</value>
</permission>
<permission>
<id>nexus:pluginconsoleplugininfos</id>
<value>15</value>
</permission>
</permissions>
</clientPermissions>
<baseUrl>http://127.0.0.1:8081/nexus</baseUrl>
<licenseInstalled>true</licenseInstalled>
<licenseExpired>false</licenseExpired>
<trialLicense>false</trialLicense>
</data>
</status>