org.apache.cxf.common.i18n.UncheckedException Java Examples

The following examples show how to use org.apache.cxf.common.i18n.UncheckedException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CxfWSDLImporter.java    From activiti6-boot2 with Apache License 2.0 6 votes vote down vote up
public void importFrom(Import theImport, String sourceSystemId) {
  this.namespace = theImport.getNamespace() == null ? "" : theImport.getNamespace() + ":";
  try {
    final URIResolver uriResolver = new URIResolver(sourceSystemId, theImport.getLocation());
    if (uriResolver.isResolved()) {
        if (uriResolver.getURI() != null) {
            this.importFrom(uriResolver.getURI().toString());
        } else if (uriResolver.isFile()) {
            this.importFrom(uriResolver.getFile().getAbsolutePath());
        } else if (uriResolver.getURL() != null) {
            this.importFrom(uriResolver.getURL().toString());
        }
    } else {
        throw new UncheckedException(new Exception("Unresolved import against " + sourceSystemId));
    }
    
  } catch (final IOException e) {
    throw new UncheckedException(e);
  }
}
 
Example #2
Source File: CxfWSDLImporter.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
@Override
public void importFrom(Import theImport, String sourceSystemId) {
    this.namespace = theImport.getNamespace() == null ? "" : theImport.getNamespace() + ":";
    try {
        final URIResolver uriResolver = this.createUriResolver(sourceSystemId, theImport);
        if (uriResolver.isResolved()) {
            if (uriResolver.getURI() != null) {
                this.importFrom(uriResolver.getURI().toString());
            } else if (uriResolver.isFile()) {
                this.importFrom(uriResolver.getFile().getAbsolutePath());
            } else if (uriResolver.getURL() != null) {
                this.importFrom(uriResolver.getURL().toString());
            }
        } else {
            throw new UncheckedException(new Exception("Unresolved import against " + sourceSystemId));
        }

    } catch (final IOException e) {
        throw new UncheckedException(e);
    }
}
 
Example #3
Source File: JAXWSClientMetricsTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void usingClientProxyStopIsCalledForUnsupportedOperation() throws Exception {
    final JaxWsClientFactoryBean factory = new JaxWsClientFactoryBean();
    factory.setAddress("local://services/Book");
    factory.setServiceClass(IBookWebService.class);
    factory.setFeatures(Arrays.asList(new MetricsFeature(provider)));
    
    try {
        final Client client = factory.create();
        expectedException.expect(UncheckedException.class);
        client.invoke("getBooks");
    } finally {
        Mockito.verifyNoInteractions(endpointContext);
        Mockito.verifyNoInteractions(operationContext);
        Mockito.verifyNoInteractions(resourceContext);
    }
}
 
Example #4
Source File: JavascriptGetInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void writeResponse(URI uri, Map<String, String> map, OutputStream os, Endpoint serverEndpoint) {
    OutputStreamWriter writer = new OutputStreamWriter(os, UTF_8);
    if (!map.containsKey(NO_UTILS_QUERY_KEY)) {
        writeUtilsToResponseStream(JavascriptGetInterceptor.class, os);
    }
    if (map.containsKey(CODE_QUERY_KEY)) {
        ServiceInfo serviceInfo = serverEndpoint.getService().getServiceInfos().get(0);
        Collection<SchemaInfo> schemata = serviceInfo.getSchemas();
        // we need to move this to the bus.
        BasicNameManager nameManager = BasicNameManager.newNameManager(serviceInfo, serverEndpoint);
        NamespacePrefixAccumulator prefixManager = new NamespacePrefixAccumulator(serviceInfo
            .getXmlSchemaCollection());
        try {
            for (SchemaInfo schema : schemata) {
                SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo
                    .getXmlSchemaCollection(), prefixManager, nameManager);
                String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
                writer.append(allThatJavascript);
            }

            ServiceJavascriptBuilder serviceBuilder
                = new ServiceJavascriptBuilder(serviceInfo,
                                               serverEndpoint.getEndpointInfo().getAddress(),
                                               prefixManager,
                                               nameManager);
            serviceBuilder.walk();
            String serviceJavascript = serviceBuilder.getCode();
            writer.append(serviceJavascript);
            writer.flush();
        } catch (IOException e) {
            throw new UncheckedException(e);
        }
    } else {
        throw new RuntimeException("Invalid query " + uri.toString());
    }
}
 
Example #5
Source File: ClientImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Object[] invoke(QName operationName, Object... params) throws Exception {
    BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
    if (op == null) {
        throw new UncheckedException(
            new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
    }

    if (op.isUnwrappedCapable()) {
        op = op.getUnwrappedOperation();
    }

    return invoke(op, params);
}
 
Example #6
Source File: ClientImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Object[] invokeWrapped(QName operationName, Object... params) throws Exception {
    BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
    if (op == null) {
        throw new UncheckedException(
            new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
    }
    return invoke(op, params);
}
 
Example #7
Source File: ClientImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void invoke(ClientCallback callback,
                   QName operationName,
                   Object... params) throws Exception {
    BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
    if (op == null) {
        throw new UncheckedException(
            new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
    }

    if (op.isUnwrappedCapable()) {
        op = op.getUnwrappedOperation();
    }

    invoke(callback, op, params);
}
 
Example #8
Source File: ClientImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
public void invokeWrapped(ClientCallback callback,
                          QName operationName,
                          Object... params)
    throws Exception {
    BindingOperationInfo op = getEndpoint().getEndpointInfo().getBinding().getOperation(operationName);
    if (op == null) {
        throw new UncheckedException(
            new org.apache.cxf.common.i18n.Message("NO_OPERATION", LOG, operationName));
    }
    invoke(callback, op, params);
}
 
Example #9
Source File: SuspendedInvocationExceptionTest.java    From cxf with Apache License 2.0 3 votes vote down vote up
@Test
public void testValidRuntimeException() {

    Throwable t = new UncheckedException(new Throwable());
    SuspendedInvocationException ex = new SuspendedInvocationException(t);

    assertSame(t, ex.getRuntimeException());
    assertSame(t, ex.getCause());

}