Examples of URLImageInputStream


Examples of org.apache.hadoop.hdfs.qjournal.client.URLImageInputStream

    // //// try reading images
    for (RemoteImage ri : expectedImages) {
      if (ri.getDigest() == null) {
        // download should fail
        try {
          URLImageInputStream is = new URLImageInputStream(ch, ri.getTxId(),
              1000);
          is.getSize();
          fail("Should fail here");
        } catch (IOException e) {
          LOG.info("Expected exception: ", e);
        }
      } else {
        // the node should contain a valid image
        URLImageInputStream stream = new URLImageInputStream(ch, ri.getTxId(), 1000);

        // verify the digest
        assertEquals(stream.getImageDigest(), digests.get(ri.getTxId()));
        // verify size
        assertEquals(stream.getSize(), content.get(ri.getTxId()).length);

        // read the bytes
        byte readBytes[] = new byte[(int) stream.getSize()];
        stream.read(readBytes);

        // assert contents
        assertTrue(Arrays.equals(content.get(ri.getTxId()), readBytes));
      }
    }
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.