Examples of EncodingMetadata


Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

      final DeliveryToken token = new DeliveryToken (AmqpQueueConsumerConnectorProxy.this, inbound.getDelivery ());
      final byte[] data = inbound.getData ();
      AmqpQueueConsumerConnectorProxy.this.transcript.traceDebugging ("delivered the message `%s` for consumer `%s`...", token, AmqpQueueConsumerConnectorProxy.this.consumerIdentifier);
      TMessage message = null;
      CallbackCompletion<Void> result = null;
      final EncodingMetadata encodingMetadata = new EncodingMetadata (inbound.getContentType (), inbound.getContentEncoding ());
      try {
        message = AmqpQueueConsumerConnectorProxy.this.messageEncoder.decode (data, encodingMetadata);
      } catch (final EncodingException exception) {
        AmqpQueueConsumerConnectorProxy.this.exceptions.traceDeferredException (exception, "decoding the message `%s` failed; deferring!", token);
        result = CallbackCompletion.createFailure (exception);
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

    requestBuilder.setRoutingKey (routingKey);
    requestBuilder.setData (ByteString.copyFrom (data));
    requestBuilder.setMandatory (mandatory);
    requestBuilder.setImmediate (immediate);
    requestBuilder.setDurable (durable);
    requestBuilder.setEnvelope (this.buildEnvelope (new EncodingMetadata (contentType, contentEncoding)));
    if (correlation != null) {
      requestBuilder.setCorrelationId (correlation);
    }
    if (callback != null) {
      requestBuilder.setReplyTo (callback);
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

   
    @Override
    public CallbackCompletion<Void> handleDelivery (final AmqpInboundMessage message)
    {
      String recvMessage;
      final EncodingMetadata encoding = new EncodingMetadata (message.getContentType (), message.getContentEncoding ());
      try {
        recvMessage = AmqpQueueRawConnectorTest.this.encoder.decode (message.getData (), encoding);
        Assert.assertTrue ("Received message: " + recvMessage, AmqpQueueRawConnectorTest.this.sentMessage.equals (recvMessage));
      } catch (final EncodingException e) {
        Assert.fail ("Delivery exception " + e.getMessage ());
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

  @Override
  protected void testSet ()
  {
    final String k1 = this.scenario.keyPrefix + "_key_fantastic";
    final String k2 = this.scenario.keyPrefix + "_key_famous";
    final EncodingMetadata encoding1 = new EncodingMetadata ("text/plain", "identity");
    Assert.assertNull (this.awaitOutcome (this.connector.set (k1, 30, "fantastic")));
    Assert.assertNull (this.awaitOutcome (this.connector.set (k2, 30, "famous")));
  }
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

  }
 
  protected void testGet ()
  {
    final String k1 = this.scenario.keyPrefix + "_key_fantastic";
    final EncodingMetadata encoding1 = new EncodingMetadata ("text/plain", "identity");
    Assert.assertEquals ("fantastic", this.awaitOutcome (this.connector.get (k1)));
  }
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

          throw (new EncodingException ("invalid http body", exception));
        }
      } else {
        throw (new EncodingException (String.format ("invalid body encoding `%s`", httpBodyEncoding)));
      }
      final EncodingMetadata bodyEncodingMetadata = new EncodingMetadata (httpHeaders.get ("content-type"), httpHeaders.get ("content-encoding"));
      final TRequestBody httpBody;
      if (httpBodyBytes != null) {
        try {
          httpBody = this.requestBodyEncoder.decode (httpBodyBytes, bodyEncodingMetadata);
        } catch (final EncodingException exception) {
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

        if (httpHeaderName.equals ("content-encoding")) {
          bodyContentEncoding = httpHeaderValue;
        }
      }
      final JSONObject metadata = new JSONObject ();
      final EncodingMetadata httpBodyEncodingMetadata = new EncodingMetadata (bodyContentType, bodyContentEncoding);
      final byte[] httpBodyBytes;
      try {
        final EncodeOutcome outcome = this.responseBodyEncoder.encode (response.body, httpBodyEncodingMetadata);
        httpBodyBytes = outcome.data;
      } catch (final EncodingException exception) {
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    }
    Threading.sleep (1000);
    final IOperationCompletionHandler<KeyValueMessage> handler3 = new TestLoggingHandler<KeyValueMessage> ("check deleted");
    final IResult<KeyValueMessage> r3 = this.wrapper.invokeGetOperation (RiakDriverTest.keyPrefix, k1, new EncodingMetadata ("text/plain", "identity"), handler3);
    try {
      Assert.assertNull (r3.getResult ().getData ());
    } catch (final InterruptedException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

        ClassNotFoundException,
        EncodingException
  {
    final String k1 = RiakDriverTest.keyPrefix + "_key_famous";
    final IOperationCompletionHandler<KeyValueMessage> handler = new TestLoggingHandler<KeyValueMessage> ("get");
    final IResult<KeyValueMessage> r1 = this.wrapper.invokeGetOperation (RiakDriverTest.keyPrefix, k1, new EncodingMetadata ("text/plain", "identity"), handler);
    try {
      final KeyValueMessage mssg = r1.getResult ();
      Assert.assertEquals ("famous", this.encoder.decode (mssg.getData (), new EncodingMetadata ("text/plain", "identity")));
    } catch (final InterruptedException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    } catch (final ExecutionException e) {
      this.exceptions.traceIgnoredException (e);
View Full Code Here

Examples of eu.mosaic_cloud.platform.core.utils.EncodingMetadata

  public void testSet ()
      throws IOException,
        EncodingException
  {
    final String k1 = RiakDriverTest.keyPrefix + "_key_fantastic";
    final byte[] b1 = this.encoder.encode ("fantastic", new EncodingMetadata ("text/plain", "identity")).data;
    KeyValueMessage mssg = new KeyValueMessage (k1, b1, "identity", "text/plain");
    final IOperationCompletionHandler<Boolean> handler1 = new TestLoggingHandler<Boolean> ("set 1");
    final IResult<Boolean> r1 = this.wrapper.invokeSetOperation (RiakDriverTest.keyPrefix, mssg, handler1);
    Assert.assertNotNull (r1);
    final String k2 = RiakDriverTest.keyPrefix + "_key_famous";
    final byte[] b2 = this.encoder.encode ("famous", new EncodingMetadata ("text/plain", "identity")).data;
    mssg = new KeyValueMessage (k2, b2, "identity", "text/plain");
    final IOperationCompletionHandler<Boolean> handler2 = new TestLoggingHandler<Boolean> ("set 2");
    final IResult<Boolean> r2 = this.wrapper.invokeSetOperation (RiakDriverTest.keyPrefix, mssg, handler2);
    Assert.assertNotNull (r2);
    try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.