Search in sources :

Example 1 with WebLink

use of org.eclipse.californium.core.WebLink in project mule-coap-connector by teslanet-nl.

the class DynamicResourcesTest method testWellKnownCore.

@Test
public void testWellKnownCore() {
    assertEquals("wrong number of weblinks", 15, links.size());
    WebLink link = links.get("/.well-known/core");
    assertNotNull("/.well-known/core is missing", link);
}
Also used : WebLink(org.eclipse.californium.core.WebLink) Test(org.junit.Test)

Example 2 with WebLink

use of org.eclipse.californium.core.WebLink in project mule-coap-connector by teslanet-nl.

the class DynamicResourcesTest method additionalSetUp.

@Before
public void additionalSetUp() {
    setClientUri("/service/add_resources");
    try {
        // post to create resource on server
        client.post("nothing important", 0);
        Set<WebLink> response = client.discover();
        links = new HashMap<String, WebLink>();
        for (WebLink link : response) {
            links.put(link.getURI(), link);
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : WebLink(org.eclipse.californium.core.WebLink) Before(org.junit.Before)

Example 3 with WebLink

use of org.eclipse.californium.core.WebLink in project mule-coap-connector by teslanet-nl.

the class DynamicResourcesTest method testObs.

@Test
public void testObs() {
    WebLink link = links.get("/service/resource2_with_obs");
    assertNotNull("/service/resource2_with_obs is missing", link);
    boolean obs = link.getAttributes().hasObservable();
    assertTrue("obs not true", obs);
}
Also used : WebLink(org.eclipse.californium.core.WebLink) Test(org.junit.Test)

Example 4 with WebLink

use of org.eclipse.californium.core.WebLink in project mule-coap-connector by teslanet-nl.

the class DynamicResourcesTest method testTitle.

@Test
public void testTitle() {
    WebLink link = links.get("/service/resource2_with_title");
    assertNotNull("/service/resource2_with_title is missing", link);
    String title = link.getAttributes().getTitle();
    assertEquals("title has wrong value", "another resource with a title", title);
}
Also used : WebLink(org.eclipse.californium.core.WebLink) Test(org.junit.Test)

Example 5 with WebLink

use of org.eclipse.californium.core.WebLink in project mule-coap-connector by teslanet-nl.

the class StaticResourcesTest method testWellKnownCore.

@Test
public void testWellKnownCore() {
    assertEquals("wrong number of weblinks", 9, links.size());
    WebLink link = links.get("/.well-known/core");
    assertNotNull("/.well-known/core is missing", link);
}
Also used : WebLink(org.eclipse.californium.core.WebLink) Test(org.junit.Test)

Aggregations

WebLink (org.eclipse.californium.core.WebLink)32 Test (org.junit.Test)17 ConcurrentSkipListSet (java.util.concurrent.ConcurrentSkipListSet)3 Endpoint (org.eclipse.californium.core.network.Endpoint)3 CoapClient (org.eclipse.californium.core.CoapClient)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Before (org.junit.Before)2 Gson (com.google.gson.Gson)1 GsonBuilder (com.google.gson.GsonBuilder)1 JsonElement (com.google.gson.JsonElement)1 CBOREncodeOptions (com.upokecenter.cbor.CBOREncodeOptions)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Scanner (java.util.Scanner)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 TreeItem (javafx.scene.control.TreeItem)1 Image (javafx.scene.image.Image)1