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

Commit

Permalink
HWKINVENT-78 Remove version from ResourceType
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga committed Jul 14, 2015
1 parent b02bcd6 commit 40f6075
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class InventoryITest extends AbstractTestBase {
private static final String environmentId = "itest-env-" + UUID.randomUUID().toString()
private static final String pingableHostRTypeId = "itest-pingable-host-" + UUID.randomUUID().toString()
private static final String roomRTypeId = "itest-room-type-" + UUID.randomUUID().toString()
private static final String typeVersion = "1.0"
private static final String responseTimeMTypeId = "itest-response-time-" + UUID.randomUUID().toString()
private static final String responseStatusCodeMTypeId = "itest-response-status-code-" + UUID.randomUUID().toString()
private static final String statusDurationMTypeId = "status.duration.type"
Expand Down Expand Up @@ -119,12 +118,12 @@ class InventoryITest extends AbstractTestBase {
assertEquals(urlTypeId, response.data.id)

/* Create a custom resource type */
response = postDeletable(path: "resourceTypes", body: [id : pingableHostRTypeId, version : typeVersion])
response = postDeletable(path: "resourceTypes", body: [id : pingableHostRTypeId])
assertEquals(201, response.status)
assertEquals(baseURI + "$basePath/resourceTypes/$pingableHostRTypeId", response.headers.Location)

/* Create another resource type */
response = postDeletable(path: "resourceTypes", body: [id : roomRTypeId, version : typeVersion])
response = postDeletable(path: "resourceTypes", body: [id : roomRTypeId])
assertEquals(201, response.status)
assertEquals(baseURI + "$basePath/resourceTypes/$roomRTypeId", response.headers.Location)

Expand Down Expand Up @@ -282,11 +281,11 @@ class InventoryITest extends AbstractTestBase {
@Test
void testResourcesFilters() {
def response = client.get(path: "$basePath/$environmentId/resources",
query: [type: pingableHostRTypeId, typeVersion: typeVersion])
query: [type: pingableHostRTypeId])
assertEquals(2, response.data.size())

response = client.get(path: "$basePath/$environmentId/resources",
query: [type: roomRTypeId, typeVersion: typeVersion])
query: [type: roomRTypeId])
assertEquals(1, response.data.size())

}
Expand All @@ -307,26 +306,26 @@ class InventoryITest extends AbstractTestBase {
@Test
void testPaging() {
String path = "$basePath/$environmentId/resources"
def response = client.get(path: path, query: [type: pingableHostRTypeId, typeVersion: typeVersion, page: 0, per_page: 2, sort: "id"])
def response = client.get(path: path, query: [type: pingableHostRTypeId, page: 0, per_page: 2, sort: "id"])
assertEquals(2, response.data.size())

def first = response.data.get(0)
def second = response.data.get(1)

response = client.get(path: path, query: [type: pingableHostRTypeId, typeVersion: typeVersion, page: 0, per_page: 1, sort: "id"])
response = client.get(path: path, query: [type: pingableHostRTypeId, page: 0, per_page: 1, sort: "id"])
assertEquals(1, response.data.size())
assertEquals(first, response.data.get(0))

response = client.get(path: path, query: [type: pingableHostRTypeId, typeVersion: typeVersion, page: 1, per_page: 1, sort: "id"])
response = client.get(path: path, query: [type: pingableHostRTypeId, page: 1, per_page: 1, sort: "id"])
assertEquals(1, response.data.size())
assertEquals(second, response.data.get(0))

response = client.get(path: path, query: [type: pingableHostRTypeId, typeVersion: typeVersion, page : 0, per_page: 1, sort: "id",
response = client.get(path: path, query: [type: pingableHostRTypeId, page : 0, per_page: 1, sort: "id",
order: "desc"])
assertEquals(1, response.data.size())
assertEquals(second, response.data.get(0))

response = client.get(path: path, query: [type: pingableHostRTypeId, typeVersion: typeVersion, page : 1, per_page: 1, sort: "id",
response = client.get(path: path, query: [type: pingableHostRTypeId, page : 1, per_page: 1, sort: "id",
order: "desc"])
assertEquals(1, response.data.size())
assertEquals(first, response.data.get(0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static Resource createTestResource() {
Map<String, Object> props = new HashMap<>();
props.put(ResourceField.url.name(), PingerTestUtils.TEST_URL);
props.put(ResourceField.method.name(), PingerTestUtils.GET_METHOD);
ResourceType urlType = new ResourceType(PingerTestUtils.TEST_TENANT_ID, PingDestination.URL_TYPE, "0");
ResourceType urlType = new ResourceType(PingerTestUtils.TEST_TENANT_ID, PingDestination.URL_TYPE);
Resource urlResource = new Resource(PingerTestUtils.TEST_TENANT_ID, PingerTestUtils.TEST_ENVIRONMENT_ID, null,
PingerTestUtils.TEST_RESOURCE_ID, urlType, props);
return urlResource;
Expand Down

0 comments on commit 40f6075

Please sign in to comment.