Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhks committed Dec 8, 2015
2 parents a13527b + 52be29a commit 9749151
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
Binary file added src/docs/_static/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions src/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os
import shlex

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down Expand Up @@ -124,7 +120,7 @@
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
html_favicon = 'favicon.png'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public void putDataPoint(String metricName,
DataPointsRowKey rowKey = null;
//time the data is written.
long writeTime = System.currentTimeMillis();
if (ttl != 0)
if (0 == ttl)
ttl = m_cassandraConfiguration.getDatapointTtl();

int rowKeyTtl = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ private static void loadCassandraData() throws DatastoreException
@BeforeClass
public static void setupDatastore() throws InterruptedException, DatastoreException
{
String cassandraHost = "localhost:9160";
System.out.println("Starting Cassandra Connection");
String cassandraHost = "kairos04:9160";
if (System.getenv("CASSANDRA_HOST") != null)
cassandraHost = System.getenv("CASSANDRA_HOST");

Expand Down Expand Up @@ -439,4 +440,42 @@ private static CachedSearchResult createCache(String metricName) throws IOExcept
return CachedSearchResult.createCachedSearchResult(metricName,
tempFile + "/" + random.nextLong(), dataPointFactory);
}

@Test
public void test_setTTL() throws DatastoreException, InterruptedException
{
DataPointSet set = new DataPointSet("ttlMetric");
set.addTag("tag", "value");
set.addDataPoint(new LongDataPoint(1, 1L));
set.addDataPoint(new LongDataPoint(2, 2L));
set.addDataPoint(new LongDataPoint(0, 3L));
set.addDataPoint(new LongDataPoint(3, 4L));
set.addDataPoint(new LongDataPoint(4, 5L));
set.addDataPoint(new LongDataPoint(5, 6L));
putDataPoints(set);

s_datastore.putDataPoint("ttlMetric", set.getTags(),
new LongDataPoint(50, 7L), 1);

Thread.sleep(2000);
Map<String, String> tags = new TreeMap<String, String>();
QueryMetric query = new QueryMetric(0, 500, 0, "ttlMetric");

query.setTags(tags);

DatastoreQuery dq = super.s_datastore.createQuery(query);

List<DataPointGroup> results = dq.execute();
try
{
assertThat(results.size(), CoreMatchers.equalTo(1));
DataPointGroup dpg = results.get(0);
assertThat(dpg.getName(), is("ttlMetric"));
assertThat(dq.getSampleSize(), CoreMatchers.equalTo(6));
}
finally
{
dq.close();
}
}
}

0 comments on commit 9749151

Please sign in to comment.