mirror of https://github.com/apache/jclouds.git
added Task api for UltraDNS
This commit is contained in:
parent
b3a2216d52
commit
f0f8eee219
|
@ -20,6 +20,7 @@ package org.jclouds.ultradns.ws;
|
|||
|
||||
import org.jclouds.rest.annotations.Delegate;
|
||||
import org.jclouds.ultradns.ws.domain.Account;
|
||||
import org.jclouds.ultradns.ws.features.TaskApi;
|
||||
import org.jclouds.ultradns.ws.features.ZoneApi;
|
||||
|
||||
/**
|
||||
|
@ -41,4 +42,10 @@ public interface UltraDNSWSApi {
|
|||
*/
|
||||
@Delegate
|
||||
ZoneApi getZoneApi();
|
||||
|
||||
/**
|
||||
* Provides synchronous access to Task features.
|
||||
*/
|
||||
@Delegate
|
||||
TaskApi getTaskApi();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.jclouds.rest.annotations.RequestFilters;
|
|||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.ultradns.ws.domain.Account;
|
||||
import org.jclouds.ultradns.ws.features.TaskAsyncApi;
|
||||
import org.jclouds.ultradns.ws.features.ZoneAsyncApi;
|
||||
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
||||
import org.jclouds.ultradns.ws.xml.AccountHandler;
|
||||
|
@ -59,4 +60,10 @@ public interface UltraDNSWSAsyncApi {
|
|||
*/
|
||||
@Delegate
|
||||
ZoneAsyncApi getZoneApi();
|
||||
|
||||
/**
|
||||
* Provides asynchronous access to Task features.
|
||||
*/
|
||||
@Delegate
|
||||
TaskAsyncApi getTaskApi();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.jclouds.rest.ConfiguresRestClient;
|
|||
import org.jclouds.rest.config.RestClientModule;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSApi;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSAsyncApi;
|
||||
import org.jclouds.ultradns.ws.features.TaskApi;
|
||||
import org.jclouds.ultradns.ws.features.TaskAsyncApi;
|
||||
import org.jclouds.ultradns.ws.features.ZoneApi;
|
||||
import org.jclouds.ultradns.ws.features.ZoneAsyncApi;
|
||||
import org.jclouds.ultradns.ws.handlers.UltraDNSWSErrorHandler;
|
||||
|
@ -44,7 +46,8 @@ import com.google.common.collect.ImmutableMap;
|
|||
public class UltraDNSWSRestClientModule extends RestClientModule<UltraDNSWSApi, UltraDNSWSAsyncApi> {
|
||||
|
||||
public static final Map<Class<?>, Class<?>> DELEGATE_MAP = ImmutableMap.<Class<?>, Class<?>> builder()
|
||||
.put(ZoneApi.class, ZoneAsyncApi.class).build();
|
||||
.put(ZoneApi.class, ZoneAsyncApi.class)
|
||||
.put(TaskApi.class, TaskAsyncApi.class).build();
|
||||
|
||||
public UltraDNSWSRestClientModule() {
|
||||
super(DELEGATE_MAP);
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.domain;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public final class Task {
|
||||
|
||||
private final String guid;
|
||||
private final StatusCode statusCode;
|
||||
private final Optional<String> message;
|
||||
private final Optional<URI> resultUrl;
|
||||
|
||||
private Task(String guid, StatusCode statusCode, Optional<String> message, Optional<URI> resultUrl) {
|
||||
this.guid = checkNotNull(guid, "guid");
|
||||
this.statusCode = checkNotNull(statusCode, "statusCode for %s", guid);
|
||||
this.message = checkNotNull(message, "message for %s", guid);
|
||||
this.resultUrl = checkNotNull(resultUrl, "resultUrl for %s", guid);
|
||||
}
|
||||
|
||||
/**
|
||||
* The guid of the task. ex. {@statusCode 0b40c7dd-748d-4c49-8506-26f0c7d2ea9c}
|
||||
*/
|
||||
public String getGuid() {
|
||||
return guid;
|
||||
}
|
||||
|
||||
/**
|
||||
* The status statusCode of the task
|
||||
*/
|
||||
public StatusCode getStatusCode() {
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* The message pertaining to status
|
||||
*/
|
||||
public Optional<String> getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* present when {@link #getClass()} is {@link StatusCode#COMPLETE}
|
||||
*/
|
||||
public Optional<URI> getResultUrl() {
|
||||
return resultUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(guid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
Task that = Task.class.cast(obj);
|
||||
return Objects.equal(this.guid, that.guid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper(this).add("guid", guid).add("statusCode", statusCode).add("message", message)
|
||||
.add("resultUrl", resultUrl).toString();
|
||||
}
|
||||
|
||||
public static enum StatusCode {
|
||||
|
||||
PENDING, IN_PROCESS,
|
||||
/**
|
||||
* For a task with status statusCode {@statusCode COMPLETE}, copy and paste the resultUrl into a browser to pull down the
|
||||
* file, which will be an attachment with the proper MIME type and extension.
|
||||
*/
|
||||
COMPLETE, ERROR;
|
||||
|
||||
public static StatusCode fromValue(String statusCode) {
|
||||
return valueOf(checkNotNull(statusCode, "statusCode"));
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return builder().from(this);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
private String guid;
|
||||
private StatusCode statusCode;
|
||||
private Optional<String> message = Optional.absent();
|
||||
private Optional<URI> resultUrl = Optional.absent();
|
||||
|
||||
/**
|
||||
* @see Task#getGuid()
|
||||
*/
|
||||
public Builder guid(String guid) {
|
||||
this.guid = guid;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Task#getStatusCode()
|
||||
*/
|
||||
public Builder statusCode(StatusCode statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Task#getMessage()
|
||||
*/
|
||||
public Builder message(String message) {
|
||||
this.message = Optional.fromNullable(message);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Task#getResultUrl()
|
||||
*/
|
||||
public Builder resultUrl(URI resultUrl) {
|
||||
this.resultUrl = Optional.fromNullable(resultUrl);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Task build() {
|
||||
return new Task(guid, statusCode, message, resultUrl);
|
||||
}
|
||||
|
||||
public Builder from(Task in) {
|
||||
return this.guid(in.guid).statusCode(in.statusCode).message(in.message.orNull()).resultUrl(in.resultUrl.orNull());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.features;
|
||||
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.ultradns.ws.domain.Task;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
||||
/**
|
||||
* @see TaskAsyncApi
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public interface TaskApi {
|
||||
/**
|
||||
* Runs a test task
|
||||
*
|
||||
* @return guid of the task created
|
||||
*/
|
||||
String runTest(String value);
|
||||
|
||||
/**
|
||||
* Retrieves information about the specified task
|
||||
*
|
||||
* @param guid
|
||||
* guid of the task to get information about.
|
||||
* @return null if not found
|
||||
*/
|
||||
@Nullable
|
||||
Task get(String guid);
|
||||
|
||||
/**
|
||||
* Lists all tasks.
|
||||
*/
|
||||
FluentIterable<Task> list();
|
||||
|
||||
/**
|
||||
* clears a background task in either a COMPLETE or ERROR state.
|
||||
*
|
||||
* @param guid
|
||||
* guid of the task to clear.
|
||||
*/
|
||||
void clear(String guid);
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.features;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.ws.rs.POST;
|
||||
|
||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||
import org.jclouds.Fallbacks.VoidOnNotFoundOr404;
|
||||
import org.jclouds.rest.annotations.Fallback;
|
||||
import org.jclouds.rest.annotations.Payload;
|
||||
import org.jclouds.rest.annotations.PayloadParam;
|
||||
import org.jclouds.rest.annotations.RequestFilters;
|
||||
import org.jclouds.rest.annotations.VirtualHost;
|
||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||
import org.jclouds.ultradns.ws.domain.Task;
|
||||
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
||||
import org.jclouds.ultradns.ws.xml.GuidHandler;
|
||||
import org.jclouds.ultradns.ws.xml.TaskHandler;
|
||||
import org.jclouds.ultradns.ws.xml.TaskListHandler;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* @see TaskApi
|
||||
* @see <a href="https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01?wsdl" />
|
||||
* @see <a href="https://www.ultradns.net/api/NUS_API_XML_SOAP.pdf" />
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@RequestFilters(SOAPWrapWithPasswordAuth.class)
|
||||
@VirtualHost
|
||||
public interface TaskAsyncApi {
|
||||
/**
|
||||
* @see TaskApi#runTest(String)
|
||||
*/
|
||||
@Named("runTest")
|
||||
@POST
|
||||
@XMLResponseParser(GuidHandler.class)
|
||||
@Payload("<v01:runTest><value>{value}</value></v01:runTest>")
|
||||
ListenableFuture<String> runTest(@PayloadParam("value") String value);
|
||||
|
||||
/**
|
||||
* @see TaskApi#get(String)
|
||||
*/
|
||||
@Named("getStatusForTask")
|
||||
@POST
|
||||
@XMLResponseParser(TaskHandler.class)
|
||||
@Payload("<v01:getStatusForTask><id><guid>{guid}</guid></id></v01:getStatusForTask>")
|
||||
@Fallback(NullOnNotFoundOr404.class)
|
||||
ListenableFuture<Task> get(@PayloadParam("guid") String name);
|
||||
|
||||
/**
|
||||
* @see TaskApi#list()
|
||||
*/
|
||||
@Named("getAllTasks")
|
||||
@POST
|
||||
@XMLResponseParser(TaskListHandler.class)
|
||||
@Payload("<v01:getAllTasks/>")
|
||||
ListenableFuture<FluentIterable<Task>> list();
|
||||
|
||||
/**
|
||||
* @see TaskApi#clear(String)
|
||||
*/
|
||||
@Named("clearTask")
|
||||
@POST
|
||||
@Payload("<v01:clearTask><id><guid>{guid}</guid></id></v01:clearTask>")
|
||||
@Fallback(VoidOnNotFoundOr404.class)
|
||||
ListenableFuture<Void> clear(@PayloadParam("guid") String name);
|
||||
}
|
|
@ -75,6 +75,7 @@ public class UltraDNSWSErrorHandler implements HttpErrorHandler {
|
|||
|
||||
private Exception refineException(UltraDNSWSResponseException exception) {
|
||||
switch (exception.getError().getCode()) {
|
||||
case 0:
|
||||
case 1801:
|
||||
case 2401:
|
||||
return new ResourceNotFoundException(exception.getError().getDescription(), exception);
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.xml;
|
||||
|
||||
import static org.jclouds.util.SaxUtils.currentOrNull;
|
||||
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
|
||||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class GuidHandler extends ParseSax.HandlerForGeneratedRequestWithResult<String> {
|
||||
private StringBuilder currentText = new StringBuilder();
|
||||
private String guid = null;
|
||||
|
||||
@Override
|
||||
public String getResult() {
|
||||
try {
|
||||
return guid;
|
||||
} finally {
|
||||
guid = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String url, String name, String qName, Attributes attributes) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (equalsOrSuffix(qName, "guid")) {
|
||||
guid = currentOrNull(currentText);
|
||||
}
|
||||
currentText = new StringBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char ch[], int start, int length) {
|
||||
currentText.append(ch, start, length);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.xml;
|
||||
|
||||
import static org.jclouds.util.SaxUtils.currentOrNull;
|
||||
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.ultradns.ws.domain.Task;
|
||||
import org.jclouds.ultradns.ws.domain.Task.StatusCode;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class TaskHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Task> {
|
||||
private StringBuilder currentText = new StringBuilder();
|
||||
private Task.Builder builder = Task.builder();
|
||||
|
||||
@Override
|
||||
public Task getResult() {
|
||||
try {
|
||||
return builder.build();
|
||||
} finally {
|
||||
builder = Task.builder();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String url, String name, String qName, Attributes attributes) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (equalsOrSuffix(qName, "guid")) {
|
||||
builder.guid(currentOrNull(currentText));
|
||||
} else if (equalsOrSuffix(qName, "code")) {
|
||||
builder.statusCode(StatusCode.valueOf(currentOrNull(currentText)));
|
||||
} else if (equalsOrSuffix(qName, "message")) {
|
||||
builder.message(currentOrNull(currentText));
|
||||
} else if (equalsOrSuffix(qName, "resultUrl")) {
|
||||
builder.resultUrl(URI.create(currentOrNull(currentText)));
|
||||
}
|
||||
currentText = new StringBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char ch[], int start, int length) {
|
||||
currentText.append(ch, start, length);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.xml;
|
||||
|
||||
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
|
||||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.ultradns.ws.domain.Task;
|
||||
import org.xml.sax.Attributes;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
public class TaskListHandler extends ParseSax.HandlerForGeneratedRequestWithResult<FluentIterable<Task>> {
|
||||
|
||||
private final TaskHandler taskHandler;
|
||||
|
||||
private Builder<Task> tasks = ImmutableSet.<Task> builder();
|
||||
|
||||
private boolean inTask;
|
||||
|
||||
@Inject
|
||||
public TaskListHandler(TaskHandler taskHandler) {
|
||||
this.taskHandler = taskHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluentIterable<Task> getResult() {
|
||||
return FluentIterable.from(tasks.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String url, String name, String qName, Attributes attributes) {
|
||||
if (equalsOrSuffix(qName, "taskStatus")) {
|
||||
inTask = true;
|
||||
}
|
||||
if (inTask) {
|
||||
taskHandler.startElement(url, name, qName, attributes);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (equalsOrSuffix(qName, "taskStatus")) {
|
||||
tasks.add(taskHandler.getResult());
|
||||
inTask = false;
|
||||
} else if (inTask) {
|
||||
taskHandler.endElement(uri, name, qName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void characters(char ch[], int start, int length) {
|
||||
if (inTask) {
|
||||
taskHandler.characters(ch, start, length);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,6 +19,7 @@
|
|||
package org.jclouds.ultradns.ws.xml;
|
||||
|
||||
import static org.jclouds.util.SaxUtils.currentOrNull;
|
||||
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
|
||||
|
||||
import org.jclouds.http.functions.ParseSax;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSError;
|
||||
|
@ -36,7 +37,7 @@ public class UltraWSExceptionHandler extends ParseSax.HandlerForGeneratedRequest
|
|||
@Override
|
||||
public UltraDNSWSError getResult() {
|
||||
try {
|
||||
return code > 0 ? UltraDNSWSError.fromCodeAndDescription(code, description) : null;
|
||||
return code != -1 ? UltraDNSWSError.fromCodeAndDescription(code, description) : null;
|
||||
} finally {
|
||||
code = -1;
|
||||
description = null;
|
||||
|
@ -45,9 +46,9 @@ public class UltraWSExceptionHandler extends ParseSax.HandlerForGeneratedRequest
|
|||
|
||||
@Override
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (qName.equals("errorCode")) {
|
||||
if (equalsOrSuffix(qName, "errorCode")) {
|
||||
code = Integer.parseInt(currentOrNull(currentText));
|
||||
} else if (qName.equals("errorDescription")) {
|
||||
} else if (equalsOrSuffix(qName, "errorDescription")) {
|
||||
description = currentOrNull(currentText);
|
||||
}
|
||||
currentText = new StringBuilder();
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.features;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNull;
|
||||
|
||||
import org.jclouds.http.HttpRequest;
|
||||
import org.jclouds.http.HttpResponse;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSApi;
|
||||
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiExpectTest;
|
||||
import org.jclouds.ultradns.ws.parse.GetAllTasksResponseTest;
|
||||
import org.jclouds.ultradns.ws.parse.GetStatusForTaskResponseResponseTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "unit", testName = "TaskApiExpectTest")
|
||||
public class TaskApiExpectTest extends BaseUltraDNSWSApiExpectTest {
|
||||
HttpRequest runTest = HttpRequest.builder().method("POST")
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader("Host", "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/run_test.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse runTestResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/taskid.xml", "application/xml")).build();
|
||||
|
||||
public void testRunTestWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(runTest, runTestResponse);
|
||||
|
||||
assertEquals(success.getTaskApi().runTest("foo").toString(), "8d7a1725-4f4a-4b70-affa-f01dcce1526e");
|
||||
}
|
||||
|
||||
HttpRequest get = HttpRequest.builder().method("POST")
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader("Host", "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/get_task.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse getResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/task.xml", "application/xml")).build();
|
||||
|
||||
public void testGetWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(get, getResponse);
|
||||
|
||||
assertEquals(
|
||||
success.getTaskApi().get("0b40c7dd-748d-4c49-8506-26f0c7d2ea9c").toString(),
|
||||
new GetStatusForTaskResponseResponseTest().expected().toString());
|
||||
}
|
||||
|
||||
HttpResponse taskDoesntExist = HttpResponse.builder().message("Server Error").statusCode(500)
|
||||
.payload(payloadFromResource("/task_doesnt_exist.xml")).build();
|
||||
|
||||
public void testGetWhenResponseError2401() {
|
||||
UltraDNSWSApi notFound = requestSendsResponse(get, taskDoesntExist);
|
||||
assertNull(notFound.getTaskApi().get("0b40c7dd-748d-4c49-8506-26f0c7d2ea9c"));
|
||||
}
|
||||
|
||||
HttpRequest clear = HttpRequest.builder().method("POST")
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader("Host", "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/clear_task.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse clearResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/task.xml", "application/xml")).build();
|
||||
|
||||
public void testClearWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(clear, clearResponse);
|
||||
success.getTaskApi().clear("0b40c7dd-748d-4c49-8506-26f0c7d2ea9c");
|
||||
}
|
||||
|
||||
public void testClearWhenResponseError2401() {
|
||||
UltraDNSWSApi notFound = requestSendsResponse(clear, taskDoesntExist);
|
||||
notFound.getTaskApi().clear("0b40c7dd-748d-4c49-8506-26f0c7d2ea9c");
|
||||
}
|
||||
|
||||
HttpRequest list = HttpRequest.builder().method("POST")
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader("Host", "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResourceWithContentType("/list_tasks.xml", "application/xml")).build();
|
||||
|
||||
HttpResponse listResponse = HttpResponse.builder().statusCode(200)
|
||||
.payload(payloadFromResourceWithContentType("/tasks.xml", "application/xml")).build();
|
||||
|
||||
public void testListWhenResponseIs2xx() {
|
||||
UltraDNSWSApi success = requestSendsResponse(list, listResponse);
|
||||
|
||||
assertEquals(
|
||||
success.getTaskApi().list().toString(),
|
||||
new GetAllTasksResponseTest().expected().toString());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.features;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertNull;
|
||||
|
||||
import org.jclouds.ultradns.ws.domain.Task;
|
||||
import org.jclouds.ultradns.ws.internal.BaseUltraDNSWSApiLiveTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(groups = "live", testName = "TaskApiLiveTest")
|
||||
public class TaskApiLiveTest extends BaseUltraDNSWSApiLiveTest {
|
||||
|
||||
private void checkTask(Task task) {
|
||||
checkNotNull(task.getGuid(), "Guid cannot be null for a Task %s", task);
|
||||
checkNotNull(task.getStatusCode(), "StatusCode cannot be null for a Task %s", task);
|
||||
checkNotNull(task.getMessage(), "While Message can be null for a Task, its Optional wrapper cannot %s", task);
|
||||
checkNotNull(task.getResultUrl(), "While ResultUrl can be null for a Task, its Optional wrapper cannot %s", task);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListTasks() {
|
||||
for (Task task : api().list()) {
|
||||
checkTask(task);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTask() {
|
||||
for (Task task : api().list()) {
|
||||
Task got = api().get(task.getGuid());
|
||||
assertEquals(got.getGuid(), task.getGuid());
|
||||
assertEquals(got.getStatusCode(), task.getStatusCode());
|
||||
assertEquals(got.getMessage(), task.getMessage());
|
||||
assertEquals(got.getResultUrl(), task.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearTask() {
|
||||
String guid = api().runTest("foo");
|
||||
checkTask(api().get(guid));
|
||||
api().clear(guid);
|
||||
assertNull(api().get(guid));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearTaskWhenNotFound() {
|
||||
api().clear("AAAAAAAAAAAAAAAA");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTaskWhenNotFound() {
|
||||
assertNull(api().get("AAAAAAAAAAAAAAAA"));
|
||||
}
|
||||
|
||||
protected TaskApi api() {
|
||||
return context.getApi().getTaskApi();
|
||||
}
|
||||
}
|
|
@ -45,6 +45,28 @@ public class UltraDNSWSErrorHandlerTest {
|
|||
UltraDNSWSErrorHandler function = Guice.createInjector(new SaxParserModule()).getInstance(
|
||||
UltraDNSWSErrorHandler.class);
|
||||
|
||||
@Test
|
||||
public void testCode0SetsResourceNotFoundException() throws IOException {
|
||||
HttpRequest request = HttpRequest.builder().method("POST")
|
||||
.endpoint("https://ultra-api.ultradns.com:8443/UltraDNS_WS/v01")
|
||||
.addHeader("Host", "ultra-api.ultradns.com:8443")
|
||||
.payload(payloadFromResource("/list_tasks.xml")).build();
|
||||
HttpCommand command = new HttpCommand(request);
|
||||
HttpResponse response = HttpResponse.builder().message("Server Error").statusCode(500)
|
||||
.payload(payloadFromResource("/task_doesnt_exist.xml")).build();
|
||||
|
||||
function.handleError(command, response);
|
||||
|
||||
assertEquals(command.getException().getClass(), ResourceNotFoundException.class);
|
||||
assertEquals(command.getException().getMessage(), "Cannot find task with guid AAAAAAAAAAAAAAAA");
|
||||
|
||||
UltraDNSWSResponseException exception = UltraDNSWSResponseException.class.cast(command.getException().getCause());
|
||||
|
||||
assertEquals(exception.getMessage(), "Error 0: Cannot find task with guid AAAAAAAAAAAAAAAA");
|
||||
assertEquals(exception.getError().getDescription(), "Cannot find task with guid AAAAAAAAAAAAAAAA");
|
||||
assertEquals(exception.getError().getCode(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCode2401SetsResourceNotFoundException() throws IOException {
|
||||
HttpRequest request = HttpRequest.builder().method("POST")
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.parse;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.ultradns.ws.domain.Task;
|
||||
import org.jclouds.ultradns.ws.domain.Task.StatusCode;
|
||||
import org.jclouds.ultradns.ws.xml.TaskListHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(testName = "GetAllTasksResponseTest")
|
||||
public class GetAllTasksResponseTest extends BaseHandlerTest {
|
||||
|
||||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/tasks.xml");
|
||||
|
||||
FluentIterable<Task> expected = expected();
|
||||
|
||||
TaskListHandler handler = injector.getInstance(TaskListHandler.class);
|
||||
FluentIterable<Task> result = factory.create(handler).parse(is);
|
||||
|
||||
assertEquals(result.toSet().toString(), expected.toSet().toString());
|
||||
}
|
||||
|
||||
public FluentIterable<Task> expected() {
|
||||
return FluentIterable.from(ImmutableSet.<Task> builder()
|
||||
.add(Task.builder()
|
||||
.guid("0b40c7dd-748d-4c49-8506-26f0c7d2ea9c")
|
||||
.statusCode(StatusCode.COMPLETE)
|
||||
.message("Processing complete")
|
||||
.resultUrl(URI.create("http://localhost:8008/users/node01/tasks/0b40c7dd-748d-4c49-8506-26f0c7d2ea9c/result"))
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.parse;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.ultradns.ws.domain.Task;
|
||||
import org.jclouds.ultradns.ws.domain.Task.StatusCode;
|
||||
import org.jclouds.ultradns.ws.xml.TaskHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(testName = "GetStatusForTaskResponseResponseTest")
|
||||
public class GetStatusForTaskResponseResponseTest extends BaseHandlerTest {
|
||||
|
||||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/task.xml");
|
||||
|
||||
Task expected = expected();
|
||||
|
||||
TaskHandler handler = injector.getInstance(TaskHandler.class);
|
||||
Task result = factory.create(handler).parse(is);
|
||||
|
||||
assertEquals(result.toString(), expected.toString());
|
||||
}
|
||||
|
||||
public Task expected() {
|
||||
return Task.builder()
|
||||
.guid("0b40c7dd-748d-4c49-8506-26f0c7d2ea9c")
|
||||
.statusCode(StatusCode.COMPLETE)
|
||||
.message("Processing complete")
|
||||
.resultUrl(URI.create("http://localhost:8008/users/node01/tasks/0b40c7dd-748d-4c49-8506-26f0c7d2ea9c/result"))
|
||||
.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.parse;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.ultradns.ws.xml.GuidHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(testName = "RunTestResponseTest")
|
||||
public class RunTestResponseTest extends BaseHandlerTest {
|
||||
|
||||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/taskid.xml");
|
||||
|
||||
GuidHandler handler = injector.getInstance(GuidHandler.class);
|
||||
assertEquals(factory.create(handler).parse(is), "8d7a1725-4f4a-4b70-affa-f01dcce1526e");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.ultradns.ws.parse;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.jclouds.http.functions.BaseHandlerTest;
|
||||
import org.jclouds.ultradns.ws.UltraDNSWSError;
|
||||
import org.jclouds.ultradns.ws.xml.UltraWSExceptionHandler;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* @author Adrian Cole
|
||||
*/
|
||||
@Test(testName = "TaskNotFoundTest")
|
||||
public class TaskNotFoundTest extends BaseHandlerTest {
|
||||
|
||||
public void test() {
|
||||
InputStream is = getClass().getResourceAsStream("/task_doesnt_exist.xml");
|
||||
|
||||
UltraDNSWSError expected = expected();
|
||||
|
||||
UltraWSExceptionHandler handler = injector.getInstance(UltraWSExceptionHandler.class);
|
||||
UltraDNSWSError result = factory.create(handler).parse(is);
|
||||
|
||||
assertEquals(result, expected);
|
||||
}
|
||||
|
||||
public UltraDNSWSError expected() {
|
||||
return UltraDNSWSError.fromCodeAndDescription(0, "Cannot find task with guid AAAAAAAAAAAAAAAA");
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
<soapenv:Envelope soapenv:mustUnderstand="1" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:clearTask><id><guid>0b40c7dd-748d-4c49-8506-26f0c7d2ea9c</guid></id></v01:clearTask></soapenv:Body></soapenv:Envelope>
|
|
@ -0,0 +1 @@
|
|||
<soapenv:Envelope soapenv:mustUnderstand="1" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:getStatusForTask><id><guid>0b40c7dd-748d-4c49-8506-26f0c7d2ea9c</guid></id></v01:getStatusForTask></soapenv:Body></soapenv:Envelope>
|
|
@ -0,0 +1 @@
|
|||
<soapenv:Envelope soapenv:mustUnderstand="1" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:getAllTasks/></soapenv:Body></soapenv:Envelope>
|
|
@ -0,0 +1 @@
|
|||
<soapenv:Envelope soapenv:mustUnderstand="1" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v01="http://webservice.api.ultra.neustar.com/v01/"><soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>identity</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">credential</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><v01:runTest><value>foo</value></v01:runTest></soapenv:Body></soapenv:Envelope>
|
|
@ -0,0 +1,13 @@
|
|||
<soap:Body>
|
||||
<ns1:getStatusForTaskResponse
|
||||
xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<TaskStatus xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
|
||||
<ns2:id>
|
||||
<ns2:guid>0b40c7dd-748d-4c49-8506-26f0c7d2ea9c</ns2:guid>
|
||||
</ns2:id>
|
||||
<ns2:code>COMPLETE</ns2:code>
|
||||
<ns2:message>Processing complete</ns2:message>
|
||||
<ns2:resultUrl>http://localhost:8008/users/node01/tasks/0b40c7dd-748d-4c49-8506-26f0c7d2ea9c/result</ns2:resultUrl>
|
||||
</TaskStatus>
|
||||
</ns1:getStatusForTaskResponse>
|
||||
</soap:Body>
|
|
@ -0,0 +1,16 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<soap:Fault>
|
||||
<faultcode>soap:Server</faultcode>
|
||||
<faultstring>Fault occurred while processing.</faultstring>
|
||||
<detail>
|
||||
<ns1:UltraWSException xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<errorCode xmlns:ns2="http://schema.ultraservice.neustar.com/v01/"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:type="xs:int">0</errorCode>
|
||||
<errorDescription xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">Cannot find task with guid AAAAAAAAAAAAAAAA</errorDescription>
|
||||
</ns1:UltraWSException>
|
||||
</detail>
|
||||
</soap:Fault>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,9 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns1:runTestResponse xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<TaskId xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
|
||||
<ns2:guid>8d7a1725-4f4a-4b70-affa-f01dcce1526e</ns2:guid>
|
||||
</TaskId>
|
||||
</ns1:runTestResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,14 @@
|
|||
<soap:Body>
|
||||
<ns1:getAllTasksResponse xmlns:ns1="http://webservice.api.ultra.neustar.com/v01/">
|
||||
<TaskStatusList xmlns:ns2="http://schema.ultraservice.neustar.com/v01/">
|
||||
<ns2:taskStatus>
|
||||
<ns2:id>
|
||||
<ns2:guid>0b40c7dd-748d-4c49-8506-26f0c7d2ea9c</ns2:guid>
|
||||
</ns2:id>
|
||||
<ns2:code>COMPLETE</ns2:code>
|
||||
<ns2:message>Processing complete</ns2:message>
|
||||
<ns2:resultUrl>http://localhost:8008/users/node01/tasks/0b40c7dd-748d-4c49-8506-26f0c7d2ea9c/result</ns2:resultUrl>
|
||||
</ns2:taskStatus>
|
||||
</TaskStatusList>
|
||||
</ns1:getAllTasksResponse>
|
||||
</soap:Body>
|
Loading…
Reference in New Issue