Search in sources :

Example 16 with UnitResponse

use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.

the class NodeTest method testRecursiveNode.

@Test
public void testRecursiveNode() throws Exception {
    setUp(true);
    UnitResponse response = restAPI.getState(new StateRequest("music/storage/1", 1));
    String expected = "{\n" + "  \"attributes\": {\"hierarchical-group\": \"east.g2\"},\n" + "  \"state\": {\n" + "    \"generated\": {\n" + "      \"state\": \"up\",\n" + "      \"reason\": \"\"\n" + "    },\n" + "    \"unit\": {\n" + "      \"state\": \"up\",\n" + "      \"reason\": \"\"\n" + "    },\n" + "    \"user\": {\n" + "      \"state\": \"up\",\n" + "      \"reason\": \"\"\n" + "    }\n" + "  },\n" + "  \"partition\": {\n" + "    \"0\": {\n" + "      \"state\": {\"generated\": {\n" + "        \"state\": \"up\",\n" + "        \"reason\": \"\"\n" + "      }},\n" + "      \"metrics\": {\n" + "        \"bucket-count\": 1,\n" + "        \"unique-document-count\": 2,\n" + "        \"unique-document-total-size\": 3\n" + "      }\n" + "    },\n" + "    \"1\": {\n" + "      \"state\": {\"generated\": {\n" + "        \"state\": \"up\",\n" + "        \"reason\": \"\"\n" + "      }},\n" + "      \"metrics\": {\n" + "        \"bucket-count\": 1,\n" + "        \"unique-document-count\": 2,\n" + "        \"unique-document-total-size\": 3\n" + "      }\n" + "    }\n" + "  }\n" + "}";
    assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
Also used : UnitResponse(com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse) Test(org.junit.Test)

Example 17 with UnitResponse

use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.

the class PartitionTest method testRecursiveStorageClusterDoesNotIncludePartitionMetrics.

@Test
public void testRecursiveStorageClusterDoesNotIncludePartitionMetrics() throws Exception {
    setUp(true);
    UnitResponse response = restAPI.getState(new StateRequest("music/storage", 2));
    String expected = "{\"state\": {\"generated\": {\n" + "  \"state\": \"up\",\n" + "  \"reason\": \"\"\n" + "}}}";
    JSONObject json = jsonWriter.createJson(response);
    assertEquals(expected, json.getJSONObject("node").getJSONObject("1").getJSONObject("partition").getJSONObject("0").toString(2));
}
Also used : JSONObject(org.codehaus.jettison.json.JSONObject) UnitResponse(com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse) Test(org.junit.Test)

Example 18 with UnitResponse

use of com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse in project vespa by vespa-engine.

the class ServiceTest method testService.

@Test
public void testService() throws Exception {
    setUp(true);
    UnitResponse response = restAPI.getState(new StateRequest("music/distributor", 0));
    String expected = "{\"node\": {\n" + "  \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/1\"},\n" + "  \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/2\"},\n" + "  \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/3\"},\n" + "  \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/5\"},\n" + "  \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/distributor\\/7\"}\n" + "}}";
    assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
Also used : UnitResponse(com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse) Test(org.junit.Test)

Aggregations

UnitResponse (com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse)18 Test (org.junit.Test)16 SetNodeStateRequest (com.yahoo.vespa.clustercontroller.core.restapiv2.requests.SetNodeStateRequest)4 SetUnitStateRequest (com.yahoo.vespa.clustercontroller.utils.staterestapi.requests.SetUnitStateRequest)4 StringContains.containsString (org.hamcrest.core.StringContains.containsString)4 JSONObject (org.codehaus.jettison.json.JSONObject)2 Node (com.yahoo.vdslib.state.Node)1 NodeState (com.yahoo.vdslib.state.NodeState)1 ContentCluster (com.yahoo.vespa.clustercontroller.core.ContentCluster)1