Skip to content

Commit

Permalink
Merge branch 'develop' into jbrisbin-tsput-column-names
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmoore committed Aug 25, 2016
2 parents 2dd723e + 17b4096 commit 632ccae
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 59 deletions.
34 changes: 17 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
sudo: required
dist: trusty

language: java
jdk: oraclejdk8

services:
- docker

- docker
cache:
directories:
- "$HOME/.m2"

- "$HOME/.m2"
before_script:
- docker run --name $RIAK_FLAVOR -d -p 8087:8087 -p 8098:8098 basho/riak-ts
- docker exec $RIAK_FLAVOR riak-admin wait-for-service riak_kv
- tools/devrel/riak-cluster-config "docker exec $RIAK_FLAVOR riak-admin" 8098 false false

- docker run --name $RIAK_FLAVOR -d -p 8087:8087 -p 8098:8098 basho/riak-ts
- docker exec $RIAK_FLAVOR riak-admin wait-for-service riak_kv
- tools/devrel/riak-cluster-config "docker exec $RIAK_FLAVOR riak-admin" 8098 false
false
script:
- mvn -Pitest,default -Dcom.basho.riak.timeseries=true verify

- if [ $RIAK_FLAVOR == "riak-kv" ]; then mvn -Pitest,default -Dcom.basho.riak.yokozuna=false
verify; else echo "Not riak-kv flavor"; fi
- if [ $RIAK_FLAVOR == "riak-ts" ]; then mvn -Pitest,default -Dcom.basho.riak.yokozuna=false
-Dcom.basho.riak.timeseries=true verify; else echo "Not riak-ts flavor"; fi
after_script:
- docker rm -f $RIAK_FLAVOR

- docker rm -f $RIAK_FLAVOR
env:
matrix:
- RIAK_FLAVOR=riak-ts
- RIAK_FLAVOR=riak-kv
- RIAK_FLAVOR=riak-ts
- RIAK_FLAVOR=riak-kv
global:
- RIAK_HOSTS=localhost:8087
- RIAK_HOSTS=localhost:8087
notifications:
slack:
secure: CQHpKSbvzvGOKfQ8GdYdK0Huaz0y2xLbwhUWNH/xkrxO/OuqvYvZn7SlJRCLIYobj+zSiwsQRrz9G19gXGZMaDCwtdVVgEnddzm15bLjsUsrWU0FgRufJuATre+AVFByngvhAmdDIvcxVVhobIYo+F6m/8/OWRGhnQvvWOVtnMA=
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ public Builder(String tableName, Iterable<Cell> keyValues)

/**
* Set the Riak-side timeout value.
*
* @param timeout The timeout, in milliseconds.
* <p>
* By default, Riak has a 60s timeout for operations. Setting
* this value will override that default for this operation.
* </p>
* @param timeout the timeout in milliseconds to be sent to riak.
* @return a reference to this object.
*/
public Builder withTimeout(int timeout)
{
if (timeout < 0)
if (timeout < 1)
{
throw new IllegalArgumentException("Timeout must be positive, or 0 for no timeout.");
throw new IllegalArgumentException("Timeout must be a positive integer");
}

this.timeout = timeout;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,20 @@ public Builder(String tableName, Iterable<Cell> keyValues)

/**
* Set the Riak-side timeout value.
*
* @param timeout The timeout, in milliseconds.
* <p>
* By default, Riak has a 60s timeout for operations. Setting
* this value will override that default for this operation.
* </p>
* @param timeout the timeout in milliseconds to be sent to riak.
* @return a reference to this object.
*/
public Builder withTimeout(int timeout)
{
if (timeout < 0)
if (timeout < 1)
{
throw new IllegalArgumentException("Timeout must be positive, or 0 for no timeout.");
throw new IllegalArgumentException("Timeout must be a positive integer");
}

this.timeout = timeout;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,19 @@ public Builder(String tableName)
/**
* Set the Riak-side timeout value.
* <p>
* By default, riak has a 60s timeout for operations. Setting
* By default, Riak has a 60s timeout for operations. Setting
* this value will override that default for this operation.
* </p>
* @param timeout the timeout in milliseconds to be sent to riak.
* @return a reference to this object.
*/
public Builder withTimeout(int timeout)
{
if (timeout < 1)
{
throw new IllegalArgumentException("Timeout must be a positive integer");
}

this.timeout = timeout;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@ public static OtpOutputStream encodeTsGetRequest(String tableName, Collection<Ce
}
os.write_nil(); // NB: finishes the list

os.write_long(timeout);
if(timeout != 0)
{
os.write_long(timeout);
}
else
{
os.write_atom(UNDEFINED);
}

return os;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,23 @@ public Builder(String tableName, Iterable<Cell> keyValues)
this.keyValues = keyValues;
}

/**
* Set the Riak-side timeout value.
* <p>
* By default, Riak has a 60s timeout for operations. Setting
* this value will override that default for this operation.
* </p>
* @param timeout the timeout in milliseconds to be sent to riak.
* @return a reference to this object.
*/
public Builder withTimeout(int timeout)
{
if (timeout < 0)
if (timeout < 1)
{
throw new IllegalArgumentException("Timeout must be positive, or 0 for no timeout.");
throw new IllegalArgumentException("Timeout must be a positive integer");
}
this.reqBuilder.setTimeout(timeout);

reqBuilder.setTimeout(timeout);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static class Builder
{
private final String tableName;
private final Iterable<Cell> keyValues;
private int timeout = 0;
private int timeout;

public Builder(String tableName, Iterable<Cell> keyValues)
{
Expand All @@ -84,8 +84,22 @@ public Builder(String tableName, Iterable<Cell> keyValues)
this.keyValues = keyValues;
}

/**
* Set the Riak-side timeout value.
* <p>
* By default, Riak has a 60s timeout for operations. Setting
* this value will override that default for this operation.
* </p>
* @param timeout the timeout in milliseconds to be sent to riak.
* @return a reference to this object.
*/
public Builder withTimeout(int timeout)
{
if (timeout < 1)
{
throw new IllegalArgumentException("Timeout must be a positive integer");
}

this.timeout = timeout;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,22 @@ public Builder(String tableName)
this.tableName = tableName;
}

/**
* Set the Riak-side timeout value.
* <p>
* By default, Riak has a 60s timeout for operations. Setting
* this value will override that default for this operation.
* </p>
* @param timeout the timeout in milliseconds to be sent to riak.
* @return a reference to this object.
*/
public Builder withTimeout(int timeout)
{
if (timeout <= 0)
if (timeout < 1)
{
throw new IllegalArgumentException("Timeout can not be zero or less");
throw new IllegalArgumentException("Timeout must be a positive integer");
}

reqBuilder.setTimeout(timeout);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class ITestFullBucketRead extends ITestBase
public static void BeforeClass() throws ExecutionException, InterruptedException
{
Assume.assumeTrue(testTimeSeries);
Assume.assumeTrue(testCoveragePlan);
setupData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public class ITestSearchMapReduce extends ISearchTestBase
@BeforeClass
public static void Setup() throws ExecutionException, InterruptedException
{
Assume.assumeTrue(testYokozuna);
Assume.assumeTrue(testBucketType);
Assume.assumeFalse(security);

setupSearchEnvironment(mrBucketName, indexName);
}

Expand All @@ -56,10 +60,6 @@ public static void TearDown() throws ExecutionException, InterruptedException
@Test
public void searchMR() throws InterruptedException, ExecutionException
{
Assume.assumeTrue(testYokozuna);
Assume.assumeTrue(testBucketType);
Assume.assumeFalse(security);

SearchMapReduce smr = new SearchMapReduce.Builder()
.withIndex(indexName)
.withQuery("doc_type_i:1 AND NOT leader_b:true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public abstract class ITestBase
protected static boolean testBucketType;
protected static boolean testCrdt;
protected static boolean testTimeSeries;
protected static boolean testCoveragePlan;
protected static boolean legacyRiakSearch;
protected static boolean security;
protected static BinaryValue bucketName;
Expand Down Expand Up @@ -149,8 +150,11 @@ public static void setUp() throws CertificateException, IOException, KeyStoreExc
mapReduceBucketType = BinaryValue.create("mr");

testCrdt = Boolean.parseBoolean(System.getProperty("com.basho.riak.crdt", "true"));

testTimeSeries = Boolean.parseBoolean(System.getProperty("com.basho.riak.timeseries", "false"));

testCoveragePlan = Boolean.parseBoolean(System.getProperty("com.basho.riak.coveragePlan", "false"));

/**
* Riak PBC host
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ public class ITestCoveragePlan extends ITestAutoCleanupBase

// TODO: Remove assumption as Riak KV with PEx and Coverage plan will be released
@BeforeClass
public static void BeforeClass() {
public static void BeforeClass()
{
Assume.assumeTrue(testTimeSeries);
Assume.assumeTrue(testCoveragePlan);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.basho.riak.client.core.query.Namespace;
import com.basho.riak.client.core.query.RiakObject;
import com.basho.riak.client.core.util.BinaryValue;

import java.util.Random;
import java.util.concurrent.ExecutionException;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
Expand All @@ -33,59 +35,66 @@
*/
public class ITestDeleteOperation extends ITestAutoCleanupBase
{
private static long keySeed = new Random().nextLong();

@Test
public void testDeleteObjectDefaultType() throws InterruptedException, ExecutionException
{
testDeleteObject(Namespace.DEFAULT_BUCKET_TYPE);
}

@Test
public void testDeleteObjectTestType() throws InterruptedException, ExecutionException
{
assumeTrue(testBucketType);
testDeleteObject(bucketType.toString());
}

private void testDeleteObject(String bucketType) throws InterruptedException, ExecutionException
{
final BinaryValue key = BinaryValue.unsafeCreate("my_key".getBytes());
final BinaryValue key = generateKey();
final String value = "{\"value\":\"value\"}";

RiakObject rObj = new RiakObject().setValue(BinaryValue.unsafeCreate(value.getBytes()));

Location location = new Location(new Namespace(bucketType, bucketName.toString()), key);
StoreOperation storeOp =
StoreOperation storeOp =
new StoreOperation.Builder(location)
.withContent(rObj)
.build();
.build();

cluster.execute(storeOp);
storeOp.get();
FetchOperation fetchOp =

FetchOperation fetchOp =
new FetchOperation.Builder(location).build();


cluster.execute(fetchOp);
FetchOperation.Response response = fetchOp.get();

RiakObject rObj2 = response.getObjectList().get(0);

assertEquals(rObj.getValue(), rObj2.getValue());

DeleteOperation delOp =
new DeleteOperation.Builder(location)
.withVclock(rObj2.getVClock()).build();
cluster.execute(delOp);
delOp.get();
fetchOp =

fetchOp =
new FetchOperation.Builder(location).build();

cluster.execute(fetchOp);
response = fetchOp.get();
assertTrue(response.isNotFound());
assertTrue(response.getObjectList().isEmpty());


}

private BinaryValue generateKey()
{
final String key = testName.getMethodName() + keySeed;
return BinaryValue.unsafeCreate(key.getBytes());
}
}
Loading

0 comments on commit 632ccae

Please sign in to comment.