Examples of EncodingMetadata


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

      public KeyValueMessage call ()
          throws IOException
      {
        KeyValueMessage result = null;
        final String key = (String) parameters[0];
        final EncodingMetadata expectedEncoding = (EncodingMetadata) parameters[1];
        // FIXME: use the vector clock...
        IRiakObject riakObj = null;
        try {
          riakObj = RiakOperationFactory.this.bucket.fetch (key).execute ();
        } catch (final UnresolvedConflictException e) {
          FallbackExceptionTracer.defaultInstance.traceIgnoredException (e);
        } catch (final RiakRetryFailedException e) {
          // TODO: shutdown all connectors for this bucket?
          FallbackExceptionTracer.defaultInstance.traceIgnoredException (e);
        } catch (final ConversionException e) {
          FallbackExceptionTracer.defaultInstance.traceIgnoredException (e);
        }
        if (null != riakObj) {
          result = new KeyValueMessage (key, riakObj.getValue (), riakObj.getUsermeta (IOperationFactory.CONTENT_ENCODING), riakObj.getContentType ());
        } else {
          result = new KeyValueMessage (key, null, expectedEncoding.getContentEncoding (), expectedEncoding.getContentType ());
        }
        return result;
      }
    });
  }
View Full Code Here

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

    } catch (final ExecutionException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    }
    final IOperationCompletionHandler<KeyValueMessage> handler3 = new TestLoggingHandler<KeyValueMessage> ("check deleted");
    final IResult<KeyValueMessage> r3 = this.wrapper.invokeGetOperation (RedisDriverTest.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 = RedisDriverTest.keyPrefix + "_key_fantastic";
    final IOperationCompletionHandler<KeyValueMessage> handler = new TestLoggingHandler<KeyValueMessage> ("get");
    final IResult<KeyValueMessage> r1 = this.wrapper.invokeGetOperation (RedisDriverTest.keyPrefix, k1, new EncodingMetadata ("text/plain", "identity"), handler);
    try {
      final KeyValueMessage mssg = r1.getResult ();
      Assert.assertEquals ("fantastic", 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 = RedisDriverTest.keyPrefix + "_key_fantastic";
    final byte[] b1 = this.encoder.encode ("fantastic", new EncodingMetadata ("text/plain", "identity")).data;
    ;
    KeyValueMessage mssg = new KeyValueMessage (k1, b1, RedisDriver.DEFAULT_CONTENT_ENCODING, RedisDriver.DEFAULT_CONTENT_TYPE);
    final IOperationCompletionHandler<Boolean> handler1 = new TestLoggingHandler<Boolean> ("set 1");
    final IResult<Boolean> r1 = this.wrapper.invokeSetOperation (RedisDriverTest.keyPrefix, mssg, handler1);
    Assert.assertNotNull (r1);
    final String k2 = RedisDriverTest.keyPrefix + "_key_famous";
    final byte[] b2 = this.encoder.encode ("famous", new EncodingMetadata ("text/plain", "identity")).data;
    mssg = new KeyValueMessage (k2, b2, RedisDriver.DEFAULT_CONTENT_ENCODING, RedisDriver.DEFAULT_CONTENT_TYPE);
    final IOperationCompletionHandler<Boolean> handler2 = new TestLoggingHandler<Boolean> ("set 2");
    final IResult<Boolean> r2 = this.wrapper.invokeSetOperation (RedisDriverTest.keyPrefix, mssg, handler2);
    Assert.assertNotNull (r2);
    try {
View Full Code Here

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

      public KeyValueMessage call ()
      {
        final String key = (String) parameters[0];
        final byte[] keyBytes = SafeEncoder.encode (key);
        final byte[] result = RedisOperationFactory.this.redisClient.get (keyBytes);
        final EncodingMetadata expectedEncoding = (EncodingMetadata) parameters[1];
        KeyValueMessage kvMessage = null;
        kvMessage = new KeyValueMessage (key, result, expectedEncoding.getContentEncoding (), expectedEncoding.getContentType ());
        return kvMessage;
      }
    });
  }
View Full Code Here

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

      throws IOException,
        EncodingException
  {
    final String k1 = MemcachedDriverTest.keyPrefix + "_key_fantastic";
    final String k2 = MemcachedDriverTest.keyPrefix + "_key_fabulous";
    final byte[] b1 = this.encoder.encode ("wrong", new EncodingMetadata ("text/plain", "identity")).data;
    final byte[] b2 = this.encoder.encode ("fabulous", new EncodingMetadata ("text/plain", "identity")).data;
    final KeyValueMessage mssg1 = new KeyValueMessage (k1, b1, "identity", "text/plain");
    final KeyValueMessage mssg2 = new KeyValueMessage (k2, b2, "identity", "text/plain");
    final IOperationCompletionHandler<Boolean> handler1 = new TestLoggingHandler<Boolean> ("add1");
    final IOperationCompletionHandler<Boolean> handler2 = new TestLoggingHandler<Boolean> ("add2");
    final IResult<Boolean> r1 = this.wrapper.invokeAddOperation (MemcachedDriverTest.keyPrefix, mssg1, 30, handler1);
View Full Code Here

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

      throws IOException,
        ClassNotFoundException,
        EncodingException
  {
    final String k1 = MemcachedDriverTest.keyPrefix + "_key_fabulous";
    final byte[] b1 = this.encoder.encode (" and miraculous", new EncodingMetadata ("text/plain", "identity")).data;
    final KeyValueMessage mssg1 = new KeyValueMessage (k1, b1, "identity", "text/plain");
    final IOperationCompletionHandler<Boolean> handler = new TestLoggingHandler<Boolean> ("append");
    final IResult<Boolean> r1 = this.wrapper.invokeAppendOperation (MemcachedDriverTest.keyPrefix, mssg1, handler);
    try {
      Assert.assertTrue (r1.getResult ());
    } catch (final InterruptedException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    } catch (final ExecutionException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    }
    final IOperationCompletionHandler<KeyValueMessage> handler1 = new TestLoggingHandler<KeyValueMessage> ("Get after append");
    final IResult<KeyValueMessage> r2 = this.wrapper.invokeGetOperation (MemcachedDriverTest.keyPrefix, k1, new EncodingMetadata ("text/plain", "identity"), handler1);
    try {
      final KeyValueMessage mssg = r2.getResult ();
      Assert.assertEquals ("fantabulous and miraculous", 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

      throws IOException,
        ClassNotFoundException,
        EncodingException
  {
    final String k1 = MemcachedDriverTest.keyPrefix + "_key_fabulous";
    final byte[] b1 = this.encoder.encode ("replaced by dummy", new EncodingMetadata ("text/plain", "identity")).data;
    final KeyValueMessage mssg1 = new KeyValueMessage (k1, b1, "identity", "text/plain");
    final IOperationCompletionHandler<Boolean> handler = new TestLoggingHandler<Boolean> ("cas");
    final IResult<Boolean> r1 = this.wrapper.invokeCASOperation (MemcachedDriverTest.keyPrefix, mssg1, handler);
    try {
      Assert.assertTrue (r1.getResult ());
    } catch (final InterruptedException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    } catch (final ExecutionException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    }
    final IOperationCompletionHandler<KeyValueMessage> handler1 = new TestLoggingHandler<KeyValueMessage> ("Get after cas");
    final IResult<KeyValueMessage> r2 = this.wrapper.invokeGetOperation (MemcachedDriverTest.keyPrefix, k1, new EncodingMetadata ("text/plain", "identity"), handler1);
    try {
      final KeyValueMessage mssg = r2.getResult ();
      Assert.assertEquals ("replaced by dummy", 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

    } catch (final ExecutionException e) {
      this.exceptions.traceIgnoredException (e);
      Assert.fail ();
    }
    final IOperationCompletionHandler<KeyValueMessage> handler1 = new TestLoggingHandler<KeyValueMessage> ("Get after delete");
    final IResult<KeyValueMessage> r2 = this.wrapper.invokeGetOperation (MemcachedDriverTest.keyPrefix, k1, new EncodingMetadata ("text/plain", "identity"), handler1);
    try {
      Assert.assertNull (r2.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 = MemcachedDriverTest.keyPrefix + "_key_fantastic";
    final IOperationCompletionHandler<KeyValueMessage> handler = new TestLoggingHandler<KeyValueMessage> ("get");
    final IResult<KeyValueMessage> r1 = this.wrapper.invokeGetOperation (MemcachedDriverTest.keyPrefix, k1, new EncodingMetadata ("text/plain", "identity"), handler);
    try {
      final KeyValueMessage mssg = r1.getResult ();
      Assert.assertEquals ("fantastic", 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
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.