Archana Chinnaiah created JCLOUDS-1248:
------------------------------------------
Summary: GetBlob Swift is returning the manifest content not the
actual content of the file
Key: JCLOUDS-1248
URL: https://issues.apache.org/jira/browse/JCLOUDS-1248
Project: jclouds
Issue Type: Bug
Components: jclouds-blobstore
Affects Versions: 2.0.0
Environment: Java - 1.7
RHEl - 7.2
Reporter: Archana Chinnaiah
Priority: Blocker
public static void main(String[] args) throws IOException
{
// TODO Auto-generated method stub
final String CONTAINER_NAME = "App20";
final String OBJECT_NAME = "jclouds-example.txt1";
System.out.println("1");
// Properties overrides = new Properties();
// overrides.setProperty("jclouds.mpu.part.size", "5242880");
BlobStoreContext context = ContextBuilder.newBuilder("openstack-swift")
.endpoint("http://x.xx.xx.xx:5000/v2.0")
.credentials("xxx:xxx", "xxx")
// .overrides(overrides)
.buildView(BlobStoreContext.class);
PutOptions opt = new PutOptions();
opt.multipart();
BlobStore blobStore = context.getBlobStore();
System.out.println("3");
blobStore.createContainerInLocation(null, CONTAINER_NAME);
File f = new File("/home/archupsg03/test_dir/sample2");
ByteSource source = Files.asByteSource(f);
Payload payload = Payloads.newByteSourcePayload(source);
payload.getContentMetadata().setContentLength(f.length());
String blobname = f.getName();
long length = f.length();
Blob blob = blobStore.blobBuilder(OBJECT_NAME)
.payload(payload)
.build();
blobStore.putBlob(CONTAINER_NAME, blob, opt);
Blob b1 = blobStore.getBlob(CONTAINER_NAME, OBJECT_NAME);
System.out.println(b1.getMetadata().getETag());
System.out.println(b1.getMetadata().getContentMetadata().getContentLength());
InputStream is = b1.getPayload().openStream();
System.out.println(getStringFromInputStream(is));
System.out.println("8");
System.out.print("Done Remove");
}
ETAG - bbcbe438ceeff56466f7c5734a00b177
Content length - 144
Content -
[{"path":"App20/jclouds-example.txt1/slo/1488190250.143000/1024/33554432/00000000","etag":"ac685d7cdabcf1579f488bdfb1659251","size_bytes":1024}]
[root@jupiter-vm564 ~]# swift list App20
jclouds-example.txt1
jclouds-example.txt1/slo/1488190112.628000/1024/33554432/00000000
[root@jupiter-vm564 ~]# swift stat App20 jclouds-example.txt1
Account: AUTH_f9d7c1cf6500469b80f0906f5f9b1791
Container: App20
Object: jclouds-example.txt1
Content Type: application/unknown
Content Length: 144
Last Modified: Mon, 27 Feb 2017 10:16:35 GMT
ETag: d5596ecc53f09f65e26d76c022577717
Accept-Ranges: bytes
Connection: keep-alive
X-Timestamp: 1488190594.10946
X-Trans-Id: txe9447d475a164a9191d00-0058b3fca6
[root@jupiter-vm564 ~]# swift stat App20
jclouds-example.txt1/slo/1488190112.628000/1024/33554432/00000000
Account: AUTH_f9d7c1cf6500469b80f0906f5f9b1791
Container: App20
Object:
jclouds-example.txt1/slo/1488190112.628000/1024/33554432/00000000
Content Type: application/unknown
Content Length: 1024
Last Modified: Mon, 27 Feb 2017 10:16:34 GMT
ETag: ac685d7cdabcf1579f488bdfb1659251
Accept-Ranges: bytes
Connection: keep-alive
X-Timestamp: 1488190593.34198
X-Trans-Id: tx1b21c0aea2004b0aaaf4b-0058b3fcb0
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)