use of javax.xml.ws.Holder in project midpoint by Evolveum.
the class ExportAction method executeGet.
private void executeGet(ModelPortType port, Writer writer) throws FaultMessage, IOException, JAXBException {
SelectorQualifiedGetOptionsType options = createOptions();
QName type = ObjectType.getType(getParams().getType());
if (type == null) {
type = ObjectType.OBJECT.getType();
}
Holder<com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType> object = new Holder<>();
Holder<OperationResultType> result = new Holder<>();
port.getObject(type, getParams().getOid(), options, object, result);
ToolsUtils.serializeObject(object.value, writer);
}
use of javax.xml.ws.Holder in project java-chassis by ServiceComb.
the class TestShutdownHookHandler method testShutdownHookHandlerReject.
@Test
public void testShutdownHookHandlerReject() throws Exception {
Deencapsulation.setField(ShutdownHookHandler.INSTANCE, "shuttingDown", true);
Holder<InvocationType> typeHolder = new Holder<>(InvocationType.PRODUCER);
Invocation invocation = new MockUp<Invocation>() {
@Mock
public InvocationType getInvocationType() {
return typeHolder.value;
}
}.getMockInstance();
ShutdownHookHandler handler = ShutdownHookHandler.INSTANCE;
handler.handle(invocation, asyncResp -> {
InvocationException e = asyncResp.getResult();
Assert.assertEquals(((CommonExceptionData) e.getErrorData()).getMessage(), "shutting down in progress");
Assert.assertEquals(e.getStatusCode(), 590);
});
typeHolder.value = InvocationType.CONSUMER;
handler.handle(invocation, asyncResp -> {
InvocationException e = asyncResp.getResult();
Assert.assertEquals(((CommonExceptionData) e.getErrorData()).getMessage(), "shutting down in progress");
Assert.assertEquals(e.getStatusCode(), 490);
});
}
use of javax.xml.ws.Holder in project java-chassis by ServiceComb.
the class VertxUtils method blockDeploy.
public static <VERTICLE extends AbstractVerticle> boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options) throws InterruptedException {
Holder<Boolean> result = new Holder<>();
CountDownLatch latch = new CountDownLatch(1);
vertx.deployVerticle(cls.getName(), options, ar -> {
result.value = ar.succeeded();
if (ar.failed()) {
LOGGER.error("deploy vertx failed, cause ", ar.cause());
}
latch.countDown();
});
latch.await();
return result.value;
}
use of javax.xml.ws.Holder in project java-chassis by ServiceComb.
the class TestHighwayServerConnection method testRequestError.
@Test
public void testRequestError() throws Exception {
header.setMsgType(MsgType.REQUEST);
Buffer headerBuffer = createBuffer(requestHeaderSchema, header);
Buffer bodyBuffer = Buffer.buffer();
Holder<Boolean> holder = new Holder<>(false);
new MockUp<HighwayServerInvoke>() {
@Mock
public boolean init(NetSocket netSocket, long msgId, RequestHeader header, Buffer bodyBuffer) {
return false;
}
};
connection.handle(0, headerBuffer, bodyBuffer);
Assert.assertEquals(null, connection.getProtocol());
Assert.assertEquals(null, connection.getZipName());
Assert.assertEquals(false, holder.value);
}
use of javax.xml.ws.Holder in project java-chassis by ServiceComb.
the class ServiceRegistryClientImpl method unregisterMicroserviceInstance.
@Override
public boolean unregisterMicroserviceInstance(String microserviceId, String microserviceInstanceId) {
Holder<HttpClientResponse> holder = new Holder<>();
IpPort ipPort = IpPortManager.INSTANCE.get();
StringBuilder url = new StringBuilder(Const.MS_API_PATH);
url.append(Const.MICROSERVICE_PATH).append("/").append(microserviceId).append(Const.INSTANCES_PATH).append("/").append(microserviceInstanceId);
CountDownLatch countDownLatch = new CountDownLatch(1);
RestUtils.delete(ipPort, url.toString(), new RequestParam(), syncHandler(countDownLatch, HttpClientResponse.class, holder));
try {
countDownLatch.await();
if (holder.value != null) {
if (holder.value.statusCode() == Status.OK.getStatusCode()) {
return true;
}
LOGGER.warn(holder.value.statusMessage());
}
} catch (Exception e) {
LOGGER.error("unregister microservice instance {}/{} failed", microserviceId, microserviceInstanceId, e);
}
return false;
}
Aggregations