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

Commit

Permalink
[HWKINVENT-131] Update integration tests
Browse files Browse the repository at this point in the history
The tenant ID is now included in the paths returned from inventory REST.
  • Loading branch information
metlos committed Aug 28, 2015
1 parent ef69f4d commit fad7197
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.hawkular.inventory.rest.test

import org.hawkular.integration.test.AbstractTestBase
import org.hawkular.inventory.api.model.CanonicalPath
import org.junit.AfterClass
import org.junit.Assert
import org.junit.BeforeClass
Expand Down Expand Up @@ -799,17 +800,19 @@ class InventoryITest extends AbstractTestBase {
private static void assertEntityExists(path, cp) {
def response = client.get(path: "$basePath/$path")
assertEquals(200, response.status)
assertEquals(cp, response.data.path)
assertEquals(fullCanonicalPath(cp), response.data.path)
}

private static void assertEntitiesExist(path, cps) {
def response = client.get(path: "$basePath/$path")

def fullCps = cps.collect { fullCanonicalPath(it) }

//noinspection GroovyAssignabilityCheck
def expectedPaths = new ArrayList<>(cps)
def expectedPaths = new ArrayList<>(fullCps)
println response.data
def entityPaths = response.data.collect { it.path }
cps.forEach { entityPaths.remove(it); expectedPaths.remove(it) }
fullCps.forEach { entityPaths.remove(it); expectedPaths.remove(it) }

Assert.assertTrue("Unexpected entities with paths: " + entityPaths, entityPaths.empty)
Assert.assertTrue("Following entities not found: " + expectedPaths, expectedPaths.empty)
Expand Down Expand Up @@ -846,4 +849,9 @@ class InventoryITest extends AbstractTestBase {
println "posting $args"
return client.post(args)
}

private static String fullCanonicalPath(cp) {
return CanonicalPath.fromPartiallyUntypedString(cp, CanonicalPath.of().tenant(tenantId).get(), (Class<?>) null)
.toString()
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<version.org.hawkular.bus>0.4.0</version.org.hawkular.bus>
<version.org.hawkular.commons>0.2.1.Final</version.org.hawkular.commons>
<version.org.hawkular.metrics>0.5.0.Final</version.org.hawkular.metrics>
<version.org.hawkular.inventory>0.3.2.Final</version.org.hawkular.inventory>
<version.org.hawkular.inventory>0.3.3-SNAPSHOT</version.org.hawkular.inventory>
<version.org.hawkular.nest>${version.org.hawkular.bus}</version.org.hawkular.nest>
<version.org.keycloak>1.3.1.Final</version.org.keycloak>
<version.org.testng>6.5.2</version.org.testng>
Expand Down

0 comments on commit fad7197

Please sign in to comment.