Skip to content

Commit 487a6f6

Browse files
committed
Add a simple Test to see if other WoT devices can be used
1 parent 5f0333e commit 487a6f6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package integration
2+
3+
import ai.ancf.lmos.wot.Servient
4+
import ai.ancf.lmos.wot.Wot
5+
import ai.ancf.lmos.wot.binding.http.HttpProtocolClientFactory
6+
import ai.ancf.lmos.wot.binding.http.HttpsProtocolClientFactory
7+
import ai.ancf.lmos.wot.thing.schema.DataSchemaValue
8+
import kotlinx.coroutines.test.runTest
9+
import kotlin.test.Test
10+
11+
class TestSimpleCoffeeMachine {
12+
13+
@Test
14+
fun `Should fetch thing with HTTP`() = runTest {
15+
val http = HttpProtocolClientFactory()
16+
val https = HttpsProtocolClientFactory()
17+
val servient = Servient(clientFactories = listOf(http, https))
18+
19+
val wot = Wot.create(servient)
20+
21+
val thingDescription =
22+
wot.requestThingDescription("https://zion.vaimee.com/things/urn:uuid:7ba2bca0-a7f6-47b3-bdce-498caa33bbaf")
23+
24+
val coffeeMachine = wot.consume(thingDescription)
25+
val resources = coffeeMachine.readProperty("resources").value() as DataSchemaValue.ObjectValue
26+
27+
println(resources)
28+
}
29+
}

0 commit comments

Comments
 (0)