Java 类javax.xml.ws.Holder 实例源码

项目:Camel    文件:CxfHolderConsumerTest.java   
@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
    ClientFactoryBean clientBean = proxyFactory.getClientFactoryBean();
    clientBean.setAddress(ADDRESS);
    clientBean.setServiceClass(MyOrderEndpoint.class);

    MyOrderEndpoint client = (MyOrderEndpoint) proxyFactory.create();

    Holder<String> strPart = new Holder<String>();
    strPart.value = "parts";
    Holder<String> strCustomer = new Holder<String>();
    strCustomer.value = "";

    String result = client.myOrder(strPart, 2, strCustomer);
    assertEquals("Get a wrong order result", "Ordered ammount 2", result);
    assertEquals("Get a wrong parts", "parts", strPart.value);
    assertEquals("Get a wrong customer", "newCustomer", strCustomer.value);
}
项目:incubator-servicecomb-java-chassis    文件:VertxUtils.java   
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;
}
项目:incubator-servicecomb-java-chassis    文件:TestVertxServerRequestToHttpServletRequest.java   
@Test
public void setBodyBuffer() {
  Holder<Buffer> bodyHolder = new Holder<>();
  context = new MockUp<RoutingContext>() {
    @Mock
    HttpServerRequest request() {
      return vertxRequest;
    }

    @Mock
    void setBody(Buffer body) {
      bodyHolder.value = body;
    }
  }.getMockInstance();
  request = new VertxServerRequestToHttpServletRequest(context);

  Buffer bodyBuffer = Buffer.buffer();
  request.setBodyBuffer(bodyBuffer);

  Assert.assertSame(bodyBuffer, bodyHolder.value);
  Assert.assertSame(bodyBuffer, request.getBodyBuffer());
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
private Handler<RestResponse> syncHandlerEx(CountDownLatch countDownLatch, Holder<ResponseWrapper> holder) {
  return restResponse -> {
    RequestContext requestContext = restResponse.getRequestContext();
    HttpClientResponse response = restResponse.getResponse();
    if (response == null) {
      // 请求失败,触发请求SC的其他实例
      if (!requestContext.isRetry()) {
        retry(requestContext, syncHandlerEx(countDownLatch, holder));
      } else {
        countDownLatch.countDown();
      }

      return;
    }

    response.bodyHandler(bodyBuffer -> {
      ResponseWrapper responseWrapper = new ResponseWrapper();
      responseWrapper.response = response;
      responseWrapper.bodyBuffer = bodyBuffer;
      holder.value = responseWrapper;
      countDownLatch.countDown();
    });
  };
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
@Override
public List<Microservice> getAllMicroservices() {
  Holder<GetAllServicesResponse> holder = new Holder<>();
  IpPort ipPort = ipPortManager.getAvailableAddress();

  CountDownLatch countDownLatch = new CountDownLatch(1);
  RestUtils.get(ipPort,
      Const.REGISTRY_API.MICROSERVICE_OPERATION_ALL,
      new RequestParam(),
      syncHandler(countDownLatch, GetAllServicesResponse.class, holder));
  try {
    countDownLatch.await();
    if (holder.value != null) {
      return holder.value.getServices();
    }
  } catch (Exception e) {
    LOGGER.error("query all microservices failed", e);
  }
  return emptyList();
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
@Override
public boolean isSchemaExist(String microserviceId, String schemaId) {
  Holder<GetExistenceResponse> holder = new Holder<>();
  IpPort ipPort = ipPortManager.getAvailableAddress();

  CountDownLatch countDownLatch = new CountDownLatch(1);
  RestUtils.get(ipPort,
      Const.REGISTRY_API.MICROSERVICE_EXISTENCE,
      new RequestParam().addQueryParam("type", "schema")
          .addQueryParam("serviceId", microserviceId)
          .addQueryParam("schemaId", schemaId),
      syncHandler(countDownLatch, GetExistenceResponse.class, holder));
  try {
    countDownLatch.await();
  } catch (Exception e) {
    LOGGER.error("query schema exist {}/{} fail",
        microserviceId,
        schemaId,
        e);
  }
  return holder.value != null;
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
@Override
public String getSchema(String microserviceId, String schemaId) {
  Holder<GetSchemaResponse> holder = new Holder<>();
  IpPort ipPort = ipPortManager.getAvailableAddress();

  CountDownLatch countDownLatch = new CountDownLatch(1);
  RestUtils.get(ipPort,
      String.format(Const.REGISTRY_API.MICROSERVICE_SCHEMA, microserviceId, schemaId),
      new RequestParam(),
      syncHandler(countDownLatch, GetSchemaResponse.class, holder));
  try {
    countDownLatch.await();
  } catch (Exception e) {
    LOGGER.error("query schema exist {}/{} failed",
        microserviceId,
        schemaId,
        e);
  }
  if (holder.value != null) {
    return holder.value.getSchema();
  }

  return null;
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
@Override
public Microservice getMicroservice(String microserviceId) {
  Holder<GetServiceResponse> holder = new Holder<>();
  IpPort ipPort = ipPortManager.getAvailableAddress();

  CountDownLatch countDownLatch = new CountDownLatch(1);
  RestUtils.get(ipPort,
      String.format(Const.REGISTRY_API.MICROSERVICE_OPERATION_ONE, microserviceId),
      new RequestParam(),
      syncHandler(countDownLatch, GetServiceResponse.class, holder));
  try {
    countDownLatch.await();
    if (holder.value != null) {
      return holder.value.getService();
    }
  } catch (Exception e) {
    LOGGER.error("query microservice {} failed", microserviceId, e);
  }
  return null;
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
@Override
public List<MicroserviceInstance> getMicroserviceInstance(String consumerId, String providerId) {
  Holder<GetInstancesResponse> holder = new Holder<>();
  IpPort ipPort = ipPortManager.getAvailableAddress();

  CountDownLatch countDownLatch = new CountDownLatch(1);
  RestUtils.get(ipPort,
      String.format(Const.REGISTRY_API.MICROSERVICE_INSTANCE_OPERATION_ALL, providerId),
      new RequestParam().addHeader("X-ConsumerId", consumerId),
      syncHandler(countDownLatch, GetInstancesResponse.class, holder));
  try {
    countDownLatch.await();
    if (holder.value != null) {
      return holder.value.getInstances();
    }
  } catch (Exception e) {
    LOGGER.error("query microservice instances {} failed", providerId, e);
  }
  return null;
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
@Override
public boolean unregisterMicroserviceInstance(String microserviceId, String microserviceInstanceId) {
  Holder<HttpClientResponse> holder = new Holder<>();
  IpPort ipPort = ipPortManager.getAvailableAddress();

  CountDownLatch countDownLatch = new CountDownLatch(1);
  RestUtils.delete(ipPort,
      String.format(Const.REGISTRY_API.MICROSERVICE_INSTANCE_OPERATION_ONE, microserviceId, microserviceInstanceId),
      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;
}
项目:incubator-servicecomb-java-chassis    文件:ServiceRegistryClientImpl.java   
@Override
public MicroserviceInstance findServiceInstance(String serviceId, String instanceId) {
  try {
    Holder<MicroserviceInstanceResponse> holder = new Holder<>();
    IpPort ipPort = ipPortManager.getAvailableAddress();
    CountDownLatch countDownLatch = new CountDownLatch(1);
    RestUtils.get(ipPort,
        String.format(Const.REGISTRY_API.MICROSERVICE_INSTANCE_OPERATION_ONE, serviceId, instanceId),
        new RequestParam().addHeader("X-ConsumerId", serviceId),
        syncHandler(countDownLatch, MicroserviceInstanceResponse.class, holder));
    countDownLatch.await();
    if (null != holder.value) {
      return holder.value.getInstance();
    }
    return null;
  } catch (Exception e) {
    LOGGER.error("get instance from sc failed");
    return null;
  }
}
项目:incubator-servicecomb-java-chassis    文件:TestMicroserviceManager.java   
private void testPullEvent(Object event) {
  Map<String, MicroserviceVersions> versionsByName = Deencapsulation.getField(microserviceManager, "versionsByName");

  Holder<Integer> count = new Holder<>();
  count.value = 0;
  MicroserviceVersions versions = new MockUp<MicroserviceVersions>() {
    @Mock
    void submitPull() {
      count.value++;
    }
  }.getMockInstance();
  versionsByName.put("ms", versions);

  eventBus.post(event);
  Assert.assertEquals(1, (int) count.value);
}
项目:incubator-servicecomb-java-chassis    文件:TestMicroserviceWatchTask.java   
@Test
public void testWatchOpen(@Mocked ServiceRegistryConfig serviceRegistryConfig,
    @Mocked ServiceRegistryClient srClient,
    @Mocked Microservice microservice) {
  initWatch(serviceRegistryConfig, srClient, microservice);

  new MockUp<ServiceRegistryClient>(srClient) {
    @Mock
    void watch(String selfMicroserviceId, AsyncResultCallback<MicroserviceInstanceChangedEvent> callback,
        AsyncResultCallback<Void> onOpen, AsyncResultCallback<Void> onClose) {
      onOpen.success(null);
    }
  };

  Holder<Boolean> openHolder = new Holder<>();
  eventBus.register(new Object() {
    @Subscribe
    public void onOpen(RecoveryEvent event) {
      openHolder.value = true;
    }
  });
  Assert.assertNull(openHolder.value);
  microserviceWatchTask.run();
  Assert.assertTrue(openHolder.value);
}
项目:incubator-servicecomb-java-chassis    文件:TestMicroserviceWatchTask.java   
@Test
public void testWatchFailed(@Mocked ServiceRegistryConfig serviceRegistryConfig,
    @Mocked ServiceRegistryClient srClient,
    @Mocked Microservice microservice) {
  initWatch(serviceRegistryConfig, srClient, microservice);

  new MockUp<ServiceRegistryClient>(srClient) {
    @Mock
    void watch(String selfMicroserviceId, AsyncResultCallback<MicroserviceInstanceChangedEvent> callback,
        AsyncResultCallback<Void> onOpen, AsyncResultCallback<Void> onClose) {
      callback.fail(new Error("test failed"));
    }
  };

  Holder<Throwable> holder = new Holder<>();
  eventBus.register(new Object() {
    @Subscribe
    public void onException(ExceptionEvent event) {
      holder.value = event.getThrowable();
    }
  });
  Assert.assertNull(holder.value);
  microserviceWatchTask.run();
  Assert.assertEquals("test failed", holder.value.getMessage());
}
项目:incubator-servicecomb-java-chassis    文件:TestServletRestDispatcher.java   
@Test
public void service() {
  Holder<Boolean> handled = new Holder<>();

  new MockUp<RestServletProducerInvocation>() {
    @Mock
    void invoke(Transport transport, HttpServletRequestEx requestEx, HttpServletResponseEx responseEx,
        List<HttpServerFilter> httpServerFilters) {
      handled.value = true;
    }
  };

  dispatcher.service(request, response);

  Assert.assertTrue(handled.value);
}
项目:incubator-servicecomb-java-chassis    文件:TestAbstractRestInvocation.java   
@Test
public void sendFailResponseHaveProduceProcessor() {
  Holder<Response> result = new Holder<>();
  restInvocation = new AbstractRestInvocationForTest() {
    @Override
    protected void doInvoke() throws Throwable {
    }

    @Override
    protected void sendResponseQuietly(Response response) {
      result.value = response;
    }
  };
  initRestInvocation();
  restInvocation.produceProcessor = ProduceProcessorManager.PLAIN_PROCESSOR;

  Throwable e = new InvocationException(Status.BAD_GATEWAY, "");
  restInvocation.sendFailResponse(e);
  Assert.assertSame(e, result.value.getResult());
  Assert.assertSame(ProduceProcessorManager.PLAIN_PROCESSOR, restInvocation.produceProcessor);
}
项目:incubator-servicecomb-java-chassis    文件:TestAbstractRestInvocation.java   
@Test
public void sendResponseQuietlyNormal(@Mocked Response response) {
  Holder<Response> result = new Holder<>();
  restInvocation = new AbstractRestInvocationForTest() {
    @Override
    protected void doInvoke() throws Throwable {
    }

    @Override
    protected void sendResponse(Response response) throws Exception {
      result.value = response;
    }
  };
  initRestInvocation();

  restInvocation.sendResponseQuietly(response);

  Assert.assertSame(response, result.value);
}
项目:incubator-servicecomb-java-chassis    文件:TestAbstractRestInvocation.java   
@Test
public void doInvoke(@Mocked Endpoint endpoint, @Mocked OperationMeta operationMeta,
    @Mocked Object[] swaggerArguments, @Mocked SchemaMeta schemaMeta) throws Throwable {
  Response response = Response.ok("ok");
  Handler handler = new Handler() {
    @Override
    public void handle(Invocation invocation, AsyncResponse asyncResp) throws Exception {
      asyncResp.complete(response);
    }
  };
  List<Handler> handlerChain = Arrays.asList(handler);
  Deencapsulation.setField(invocation, "handlerList", handlerChain);

  Holder<Response> result = new Holder<>();
  restInvocation = new AbstractRestInvocationForTest() {
    @Override
    protected void sendResponseQuietly(Response response) {
      result.value = response;
    }
  };
  restInvocation.invocation = invocation;

  restInvocation.doInvoke();

  Assert.assertSame(response, result.value);
}
项目:incubator-netbeans    文件:DerbyDatabasesTest.java   
public void testDatabaseNotExtractedToExistingDirectoryIssue80122() {
    final Holder<Boolean> exceptionHappend = new Holder<>(false);

    Lookups.executeWith(sampleDBLookup, new Runnable() {

        @Override
        public void run() {
            try {
                File sampleDir = new File(systemHome, "sample");
                sampleDir.mkdirs();

                FileUtil.toFileObject(sampleDir).createData("test.file");

                assertEquals("There should be no files in the sample directory", 1, sampleDir.listFiles().length);

                DerbyDatabasesImpl.getDefault().extractSampleDatabase("sample", false);
            } catch (IOException ex) {
                exceptionHappend.value = true;
            }
        }
    });

    assertTrue("Extracting sample db was interrupted", exceptionHappend.value);
}
项目:incubator-netbeans    文件:DerbyDatabasesTest.java   
public void testDatabaseNotExtractedIfDBExists() {
    final Holder<Boolean> exceptionHappend = new Holder<>(false);

    Lookups.executeWith(sampleDBLookup, new Runnable() {

        @Override
        public void run() {
            try {
                DerbyDatabasesImpl.getDefault().extractSampleDatabase("sample1", true);
                DerbyDatabasesImpl.getDefault().extractSampleDatabase("sample1", true);
            } catch (IOException ex) {
                exceptionHappend.value = true;
            }
        }
    });

    assertTrue("Extracting sample db was interrupted", exceptionHappend.value);
}
项目:incubator-netbeans    文件:DerbyDatabasesTest.java   
public void testDatabaseSilentlyNotExtractedIfExists() {
    final Holder<Boolean> exceptionHappend = new Holder<>(false);

    Lookups.executeWith(sampleDBLookup, new Runnable() {

        @Override
        public void run() {
            try {
                DerbyDatabasesImpl.getDefault().extractSampleDatabase("sample2", false);
                DerbyDatabasesImpl.getDefault().extractSampleDatabase("sample2", false);
            } catch (IOException ex) {
                exceptionHappend.value = true;
            }
        }
    });

    assertFalse("Extracting sample db was not interrupted", exceptionHappend.value);
}
项目:mpay24-java    文件:SoapCommunication.java   
private List<Payment> getPaymentHistory(Holder<Status> statusHolder, Holder<String> returnCodeHolder, Holder<List<HistoryEntry>> historyEntryHolder,
                BigInteger mPayTid) {
    List<Payment> paymentList = new ArrayList<Payment>();
    if (historyEntryHolder == null) {
        return paymentList;
    }
    for (HistoryEntry historyEntry : historyEntryHolder.value) {
        Payment payment = new Payment();
        payment.setAmount(getConvertedAmount(historyEntry.getAmount()));
        payment.setApprovalCode(historyEntry.getApprovalCode());
        payment.setErrorNumber(historyEntry.getErrNo());
        payment.setErrorText(historyEntry.getErrText());
        payment.setmPayTid(mPayTid);
        payment.setParentStateID(historyEntry.getParentStateID());
        payment.setProfileStatus(historyEntry.getProfileStatus());
        payment.setStateID(historyEntry.getStateID());
        payment.setTimeStamp(historyEntry.getTimeStamp().toGregorianCalendar().getTime());
        payment.setState(State.valueOf(historyEntry.getTxState().toString()));
        paymentList.add(payment);
    }
    return paymentList;
}
项目:mpay24-java    文件:SoapCommunication.java   
private List<PaymentData> getProfileList(Holder<String> returnCodeHolder, Holder<List<Profile>> profileListHolder) {
    List<PaymentData> paymentDataList = new ArrayList<PaymentData>();
    for (Profile profile : profileListHolder.value) {
        if (profile.getPayment() == null || profile.getPayment().size() == 0 ) {
            paymentDataList.add(getProfile(profile));
        } else {
            for (PaymentProfile paymentProfile: profile.getPayment()) {
                PaymentData paymentData = getProfile(profile);
                addPaymentProfileData(paymentProfile, paymentData);
                paymentDataList.add(paymentData);
            }
        }
    }

    return paymentDataList;
}
项目:mpay24-java    文件:SoapCommunication.java   
private List<Payment> getPaymentList(Holder<String> returnCodeHolder, Holder<List<TransactionDetails>> transactionDetailsHolder) {
    List<Payment> paymentList = new ArrayList<Payment>();
    for (TransactionDetails txDetails : transactionDetailsHolder.value) {
        Payment payment = new Payment();
        payment.setAmount(getConvertedAmount(txDetails.getAmount()));
        payment.setCurrency(txDetails.getCurrency());
        payment.setmPayTid(txDetails.getMpayTID());
        payment.setDescription(txDetails.getOrderDescription());
        payment.setPaymentType(txDetails.getPType());
        payment.setStateID(txDetails.getStateID());
        payment.setTransactionId(txDetails.getTid());
        payment.setState(State.valueOf(txDetails.getTStatus().toString()));
        paymentList.add(payment);
    }
    return paymentList;
}
项目:mpay24-java    文件:SoapCommunication.java   
private Payment getPaymentResponse(Holder<Status> statusHolder, Holder<String> returnCodeHolder, Holder<Integer> errorNumberHolder,
                Holder<String> errorTextHolder, Holder<String> locationHolder, Holder<BigInteger> mPayTidHolder, com.mpay.soap.client.Payment payment,
                Order order) throws PaymentException {
    checkForError(statusHolder, errorNumberHolder, errorTextHolder, returnCodeHolder);
    Payment paymentResponse = new Payment();
    if (returnCodeHolder != null)
        paymentResponse.setReturnCode(returnCodeHolder.value);
    if (locationHolder != null)
        paymentResponse.setRedirectLocation(locationHolder.value);
    if (mPayTidHolder != null)
        paymentResponse.setmPayTid(mPayTidHolder.value);
    if (payment != null) {
        paymentResponse.setAmount(getConvertedAmount(payment.getAmount()));
        paymentResponse.setTimeStamp(new Date());
    }
    return paymentResponse;
}
项目:mpay24-java    文件:SoapCommunication.java   
private void checkForError(Holder<Status> statusHolder, Holder<Integer> errorNumberHolder, Holder<String> errorTextHolder, Holder<String> returnCodeHolder)
                throws PaymentException {
    if (statusHolder != null && statusHolder.value != null && Status.ERROR == statusHolder.value) {
        PaymentException exception = new PaymentException();
        exception.setStatus(statusHolder.value);
        if (errorNumberHolder != null) {
            exception.setErrorCode("" + errorNumberHolder.value);
        }
        if (errorTextHolder != null) {
            exception.setErrorText(errorTextHolder.value);
        }
        if (returnCodeHolder != null) {
            exception.setReturnCode(returnCodeHolder.value);
        }
        throw exception;
    }
}
项目:OpenJSharp    文件:WSDLGenResolver.java   
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
项目:OpenJSharp    文件:WSDLGenerator.java   
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
项目:openjdk-jdk10    文件:WSDLGenResolver.java   
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
项目:openjdk-jdk10    文件:WSDLGenerator.java   
/**
     * Creates the {@link Result} object used by JAXB to generate a schema for the
     * namesapceUri namespace.
     * @param namespaceUri The namespace for the schema being generated
     * @param suggestedFileName the JAXB suggested file name for the schema file
     * @return the {@link Result} for JAXB to generate the schema into
     * @throws java.io.IOException thrown if on IO error occurs
     */
    public Result createOutputFile(String namespaceUri, String suggestedFileName) throws IOException {
        Result result;
        if (namespaceUri == null) {
            return null;
        }

        Holder<String> fileNameHolder = new Holder<String>();
        fileNameHolder.value = schemaPrefix + suggestedFileName;
        result = wsdlResolver.getSchemaOutput(namespaceUri, fileNameHolder);
//        System.out.println("schema file: "+fileNameHolder.value);
//        System.out.println("result: "+result);
        String schemaLoc;
        if (result == null)
            schemaLoc = fileNameHolder.value;
        else
            schemaLoc = relativize(result.getSystemId(), wsdlLocation);
        boolean isEmptyNs = namespaceUri.trim().equals("");
        if (!isEmptyNs) {
            com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import _import = types.schema()._import();
            _import.namespace(namespaceUri);
            _import.schemaLocation(schemaLoc);
        }
        return result;
    }
项目:openjdk9    文件:WSDLGenResolver.java   
/**
 * Updates filename if the suggested filename need to be changed in
 * xsd:import. If there is already a schema document for the namespace
 * in the metadata, then it is not generated.
 *
 * return null if schema need not be generated
 *        Result the generated schema document
 */
public Result getSchemaOutput(String namespace, Holder<String> filename) {
    List<SDDocumentImpl> schemas = nsMapping.get(namespace);
    if (schemas != null) {
        if (schemas.size() > 1) {
            throw new ServerRtException("server.rt.err",
                "More than one schema for the target namespace "+namespace);
        }
        filename.value = schemas.get(0).getURL().toExternalForm();
        return null;            // Don't generate schema
    }

    URL url = createURL(filename.value);
    MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
    xsb.setSystemId(url.toExternalForm());
    SDDocumentSource sd = SDDocumentSource.create(url,xsb);
    newDocs.add(sd);

    XMLStreamBufferResult r = new XMLStreamBufferResult(xsb);
    r.setSystemId(filename.value);
    return r;
}
项目:mpay24-java    文件:SoapCommunication.java   
private List<PaymentData> getProfileList(Holder<String> returnCodeHolder, Holder<List<Profile>> profileListHolder) {
    List<PaymentData> paymentDataList = new ArrayList<PaymentData>();
    for (Profile profile : profileListHolder.value) {
        if (profile.getPayment() == null || profile.getPayment().size() == 0 ) {
            paymentDataList.add(getProfile(profile));
        } else {
            for (PaymentProfile paymentProfile: profile.getPayment()) {
                PaymentData paymentData = getProfile(profile);
                addPaymentProfileData(paymentProfile, paymentData);
                paymentDataList.add(paymentData);
            }
        }
    }

    return paymentDataList;
}
项目:TopPI    文件:ExplorationStep.java   
/**
 * Start exploration on an abstract dataset
 */
public ExplorationStep(int minimumSupport, int k, Iterable<TransactionReader> source) {
    this.core_item = Integer.MAX_VALUE;
    this.selectChain = null;
    Holder<int[]> renamingHolder = new Holder<int[]>();
    DenseCounters firstCounter = new DenseCounters(minimumSupport, source.iterator(), renamingHolder);
    this.counters = firstCounter;
    TransactionsRenamingDecorator filtered = new TransactionsRenamingDecorator(source.iterator(), renamingHolder.value);
    this.dataset = new Dataset(this.counters, filtered, this.counters.getMinSupport(),
            this.counters.getMaxFrequent());
    this.candidates = this.counters.getExtensionsIterator();
    this.failedFPTests = new TIntIntHashMap();

    this.datasetProvider = new DatasetProvider(this);
    ExplorationStep.findUnclosedInsertionBound(firstCounter.getSupportCounts(), minimumSupport + k);
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test106GetConfigWrongUsernameText() throws Exception {
    final String TEST_NAME = "test106GetConfigWrongUsernameText";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort("admin", USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_TEXT);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no user");
}
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test152GetConfigNoPasswordEmptyDigest() throws Exception {
    final String TEST_NAME = "test152GetConfigNoPasswordEmptyDigest";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(USER_NOPASSWORD_USERNAME, " ", WSConstants.PW_DIGEST);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no credentials in user");
}
项目:Camel    文件:MultiPartCustomerServiceImpl.java   
@Override
public void saveCustomerToo(SaveCustomer parameters, Product product,
        Holder<Company> company) {
    if (product == null) {
        throw new IllegalArgumentException("product may not be null.");
    }

    if (company == null) {
        throw new IllegalArgumentException("company may not be null.");
    }

    Company returnCompany = new Company();
    returnCompany.setName("MultipartSoft");
    returnCompany.setPresident("Dr. Multipart");

    company.value = returnCompany;

    lastSavedCustomer = parameters.getCustomer();
}
项目:OntologyBasedInormationExtractor    文件:AWSECommerceServicePortType.java   
/**
 * 
 * @param shared
 * @param operationRequest
 * @param xmlEscaping
 * @param marketplaceDomain
 * @param request
 * @param awsAccessKeyId
 * @param cart
 * @param validate
 * @param associateTag
 */
@WebMethod(operationName = "CartModify", action = "http://soap.amazon.com/CartModify")
@RequestWrapper(localName = "CartModify", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", className = "com.amazon.webservices.awsecommerceservice._2011_08_01.CartModify")
@ResponseWrapper(localName = "CartModifyResponse", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", className = "com.amazon.webservices.awsecommerceservice._2011_08_01.CartModifyResponse")
public void cartModify(
        @WebParam(name = "MarketplaceDomain", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String marketplaceDomain,
        @WebParam(name = "AWSAccessKeyId", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String awsAccessKeyId,
        @WebParam(name = "AssociateTag", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String associateTag,
        @WebParam(name = "Validate", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String validate,
        @WebParam(name = "XMLEscaping", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String xmlEscaping,
        @WebParam(name = "Shared", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        CartModifyRequest shared,
        @WebParam(name = "Request", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        List<CartModifyRequest> request,
        @WebParam(name = "OperationRequest", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", mode = WebParam.Mode.OUT)
        Holder<OperationRequest> operationRequest,
        @WebParam(name = "Cart", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", mode = WebParam.Mode.OUT)
        Holder<List<Cart>> cart);
项目:KeyStor    文件:VibeSimple.java   
/**
 *
 * @param dataOut
 * @param creditCardNumber
 * @param identity
 * @param tweak
 * @param fullApplicationIdentityOut
 * @param authMethod
 * @param authInfo
 * @throws FaultResponse
 */
@WebMethod(operationName = "ProtectCreditCardNumberListV2", action = "http://voltage.com/vibesimple/ProtectCreditCardNumberListV2")
@RequestWrapper(localName = "ProtectCreditCardNumberListV2", targetNamespace = "http://voltage.com/vibesimple", className = "com.kunai.keyvault.crypto.voltage.vibesimple.ProtectCreditCardNumberListV2")
@ResponseWrapper(localName = "ProtectCreditCardNumberListV2Response", targetNamespace = "http://voltage.com/vibesimple", className = "com.kunai.keyvault.crypto.voltage.vibesimple.ProtectCreditCardNumberListV2Response")
public void protectCreditCardNumberListV2(
        @WebParam(name = "creditCardNumber", targetNamespace = "")
        List<String> creditCardNumber,
        @WebParam(name = "identity", targetNamespace = "")
        String identity,
        @WebParam(name = "tweak", targetNamespace = "")
        String tweak,
        @WebParam(name = "authMethod", targetNamespace = "")
        AuthMethod authMethod,
        @WebParam(name = "authInfo", targetNamespace = "")
        String authInfo,
        @WebParam(name = "dataOut", targetNamespace = "", mode = WebParam.Mode.OUT)
        Holder<List<String>> dataOut,
        @WebParam(name = "fullApplicationIdentityOut", targetNamespace = "", mode = WebParam.Mode.OUT)
        Holder<String> fullApplicationIdentityOut)
    throws FaultResponse
;
项目:OntologyBasedInormationExtractor    文件:AWSECommerceServicePortType.java   
/**
 * 
 * @param shared
 * @param operationRequest
 * @param xmlEscaping
 * @param marketplaceDomain
 * @param request
 * @param awsAccessKeyId
 * @param cart
 * @param validate
 * @param associateTag
 */
@WebMethod(operationName = "CartAdd", action = "http://soap.amazon.com/CartAdd")
@RequestWrapper(localName = "CartAdd", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", className = "com.amazon.webservices.awsecommerceservice._2011_08_01.CartAdd")
@ResponseWrapper(localName = "CartAddResponse", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", className = "com.amazon.webservices.awsecommerceservice._2011_08_01.CartAddResponse")
public void cartAdd(
        @WebParam(name = "MarketplaceDomain", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String marketplaceDomain,
        @WebParam(name = "AWSAccessKeyId", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String awsAccessKeyId,
        @WebParam(name = "AssociateTag", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String associateTag,
        @WebParam(name = "Validate", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String validate,
        @WebParam(name = "XMLEscaping", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        String xmlEscaping,
        @WebParam(name = "Shared", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        CartAddRequest shared,
        @WebParam(name = "Request", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01")
        List<CartAddRequest> request,
        @WebParam(name = "OperationRequest", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", mode = WebParam.Mode.OUT)
        Holder<OperationRequest> operationRequest,
        @WebParam(name = "Cart", targetNamespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", mode = WebParam.Mode.OUT)
        Holder<List<Cart>> cart);
项目:engerek    文件:TestWSSecurity.java   
@Test
public void test108GetConfigBlankUsernameText() throws Exception {
    final String TEST_NAME = "test108GetConfigBlankUsernameText";
    displayTestTitle(TEST_NAME);

    LogfileTestTailer tailer = createLogTailer();
    modelPort = createModelPort(" ", USER_ADMINISTRATOR_PASSWORD, WSConstants.PW_TEXT);

    Holder<ObjectType> objectHolder = new Holder<ObjectType>();
    Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();

    // WHEN
    try {
        modelPort.getObject(getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), 
            null, objectHolder, resultHolder);

        AssertJUnit.fail("Unexpected success");

    } catch (SOAPFaultException e) {
        assertSoapSecurityFault(e, "FailedAuthentication", "could not be authenticated or authorized");         
    }

    tailer.tail();
    assertAuditLoginFailed(tailer, "no username");
}