Search in sources :

Example 1 with BinaryStoreAdapter

use of com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter in project navajo by Dexels.

the class TestHttpResource method testHead.

@Test
@Ignore
public void testHead() throws IOException, MappableException, UserException {
    BinaryStoreAdapter bsa = new BinaryStoreAdapter();
    bsa.load(access);
    Binary b = createBinary();
    b.setMimeType("text/plain");
    boolean exists = bsa.headBinary(b.getHexDigest(), "binstore", "junit");
    Assert.assertFalse(exists);
}
Also used : Binary(com.dexels.navajo.document.types.Binary) BinaryStoreAdapter(com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with BinaryStoreAdapter

use of com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter in project navajo by Dexels.

the class TestHttpResource method testPut.

@Test
@Ignore
public void testPut() throws IOException, MappableException, UserException {
    BinaryStoreAdapter bsa = new BinaryStoreAdapter();
    bsa.load(access);
    Binary b = createBinary();
    bsa.storeBinary(b, "binstore", "junit", false);
}
Also used : Binary(com.dexels.navajo.document.types.Binary) BinaryStoreAdapter(com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 3 with BinaryStoreAdapter

use of com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter in project navajo by Dexels.

the class TestHttpResource method testStoreAdapterBasics.

@Test
@Ignore
public void testStoreAdapterBasics() throws IOException, MappableException, UserException, InterruptedException {
    BinaryStoreAdapter bsa = new BinaryStoreAdapter();
    bsa.load(access);
    Binary b = createBinary();
    String bb = bsa.storeBinary(b, "binstore", "junit", false);
    System.err.println("Result of put: " + bb);
    boolean existsNow = bsa.headBinary(b.getHexDigest(), "binstore", "junit");
    Assert.assertTrue(existsNow);
    System.err.println("exists after insert: " + existsNow);
    ReactiveReply result = bsa.deleteBinary(b.getHexDigest(), "binstore", "junit", false);
    System.err.println("Delete: " + result.status());
    boolean exists = bsa.headBinary(b.getHexDigest(), "binstore", "junit");
    Assert.assertFalse(exists);
    System.err.println("exists after delete: " + exists);
}
Also used : ReactiveReply(com.dexels.navajo.client.stream.ReactiveReply) Binary(com.dexels.navajo.document.types.Binary) BinaryStoreAdapter(com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with BinaryStoreAdapter

use of com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter in project navajo by Dexels.

the class TestHttpResource method testDelete.

@Test
@Ignore
public void testDelete() throws IOException, MappableException, UserException {
    BinaryStoreAdapter bsa = new BinaryStoreAdapter();
    bsa.load(access);
    Binary b = createBinary();
    b.setMimeType("text/plain");
    ReactiveReply reply = bsa.deleteBinary(b.getHexDigest(), "binstore", "junit", false);
    Assert.assertNotSame(200, reply.status());
}
Also used : ReactiveReply(com.dexels.navajo.client.stream.ReactiveReply) Binary(com.dexels.navajo.document.types.Binary) BinaryStoreAdapter(com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 5 with BinaryStoreAdapter

use of com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter in project navajo by Dexels.

the class TestHttpResource method testStoreAdapterAdvanced.

@Test
@Ignore
public void testStoreAdapterAdvanced() throws IOException, MappableException, UserException, InterruptedException {
    Binary b = createBinary();
    BinaryStoreAdapter bsa = new BinaryStoreAdapter();
    bsa.load(access);
    bsa.setBinaryHash(b.getHexDigest());
    bsa.setResource("binstore");
    bsa.setBucket("junit");
    int delres = bsa.getDeleteResult();
    bsa.store();
    Assert.assertTrue(delres < 400);
    // --------------------------------------
    bsa = new BinaryStoreAdapter();
    bsa.load(access);
    bsa.setBinaryHash(b.getHexDigest());
    bsa.setResource("binstore");
    bsa.setBucket("junit");
    boolean existsAfterDelete = bsa.getHeadResult();
    bsa.store();
    Assert.assertFalse(existsAfterDelete);
    // --------------------------------------
    bsa = new BinaryStoreAdapter();
    bsa.load(access);
    bsa.setBinary(b);
    String hexDigest = b.getHexDigest();
    bsa.setResource("binstore");
    bsa.setBucket("junit");
    String put = bsa.getPutResult();
    bsa.store();
    Assert.assertTrue(hexDigest.equals(put));
    // --------------------------------------
    bsa = new BinaryStoreAdapter();
    bsa.load(access);
    bsa.setBinaryHash(b.getHexDigest());
    bsa.setResource("binstore");
    bsa.setBucket("junit");
    boolean existsAfterPut = bsa.getHeadResult();
    bsa.store();
    Assert.assertTrue(existsAfterPut);
// --------------------------------------
}
Also used : Binary(com.dexels.navajo.document.types.Binary) BinaryStoreAdapter(com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Binary (com.dexels.navajo.document.types.Binary)5 BinaryStoreAdapter (com.dexels.navajo.resource.http.adapter.BinaryStoreAdapter)5 Ignore (org.junit.Ignore)5 Test (org.junit.Test)5 ReactiveReply (com.dexels.navajo.client.stream.ReactiveReply)2