Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #48 from pilhuhn/fix-url
Browse files Browse the repository at this point in the history
fix-url
  • Loading branch information
jmazzitelli committed Mar 12, 2015
2 parents 9190c0c + f4ef625 commit c2af10c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AbstractTestBase {

@BeforeClass
static void initClient() {
client = new RESTClient("http://$baseURI/", ContentType.JSON)
client = new RESTClient("http://$baseURI", ContentType.JSON)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.junit.Test

import static junit.framework.Assert.assertEquals

class Scenario1 extends org.hawkular.integration.test.AbstractTestBase {
class Scenario1 extends AbstractTestBase {

def tenantId = "i-test"
def hawk_id = "hawkular_web"
Expand All @@ -40,9 +40,9 @@ class Scenario1 extends org.hawkular.integration.test.AbstractTestBase {

hawk_web.id = hawk_id;
hawk_web.type = ResourceType.URL
hawk_web.addParameter("url","http://hawkular.org")
hawk_web.addParameter("url","http://hawkular.github.io")

def response = client.post(path: "/inventory/$tenantId/resources", body : hawk_web)
def response = client.post(path: "inventory/$tenantId/resources", body : hawk_web)

assertEquals(200, response.status)

Expand All @@ -52,10 +52,11 @@ class Scenario1 extends org.hawkular.integration.test.AbstractTestBase {
def statusTime = new MetricDefinition("status.time",MetricUnit.MILLI_SECOND);
statusTime.description = "Time to ping the target in ms"

response = client.post(path: "/inventory/$tenantId/resource/$hawk_id/metrics",
response = client.post(path: "inventory/$tenantId/resources/$hawk_id/metrics",
body: [ statusCode, statusTime])

assertEquals(200, response.status)
def good = response.status == 200 || response.status == 304
assert good

// 3 inform pinger is internal

Expand All @@ -65,8 +66,10 @@ class Scenario1 extends org.hawkular.integration.test.AbstractTestBase {
postMetricValue(hawk_id, statusCode, 200, i)
}

postMetricValue(statusCode, 500, i-2)
postMetricValue(statusCode, 404, i-1)
postMetricValue(hawk_id, statusCode, 500, -2)
postMetricValue(hawk_id, statusCode, 404, -1)
postMetricValue(hawk_id, statusCode, 200, 0)
postMetricValue(hawk_id, statusTime, 42, 0)


// 5 was simulated in step 4 as well
Expand All @@ -75,12 +78,14 @@ class Scenario1 extends org.hawkular.integration.test.AbstractTestBase {

def end = System.currentTimeMillis()
def start = end - 4 *3600 * 1000 // 4h earlier
response = client.get(path: "/metrics/$tenantId/metrics/numeric/${hawk_id}.status.time/data", query:
response = client.get(path: "/hawkular-metrics/$tenantId/metrics/numeric/${hawk_id}.status.time/data", query:
[start: start, end: end])

println(response.data)

// 7 define an alert

response = client.post(path: "/alerts/triggers/")
// response = client.post(path: "alerts/triggers/")

}

Expand All @@ -91,7 +96,7 @@ class Scenario1 extends org.hawkular.integration.test.AbstractTestBase {

long time = now + (timeSkewMinutes * 60 * 1000)

response = client.post(path: "/metrics/$tenantId/metrics/numeric/$tmp/data",
response = client.post(path: "/hawkular-metrics/$tenantId/metrics/numeric/$tmp/data",
body: [[timestamp: time, value: value]])
assertEquals(200, response.status)
}
Expand Down

0 comments on commit c2af10c

Please sign in to comment.