Search in sources :

Example 6 with UnitResponse

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

the class PartitionTest method testRecursiveCluster.

@Test
public void testRecursiveCluster() throws Exception {
    setUp(true);
    UnitResponse response = restAPI.getState(new StateRequest("music/storage/1/0", 1));
    String expected = "{\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" + "}";
    assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
Also used : UnitResponse(com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse) Test(org.junit.Test)

Example 7 with UnitResponse

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

the class ServiceTest method testRecursiveCluster.

@Test
public void testRecursiveCluster() throws Exception {
    setUp(true);
    UnitResponse response = restAPI.getState(new StateRequest("music/distributor", 1));
    String expected = "{\"node\": {\n" + "  \"1\": {\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" + "  },\n" + "  \"2\": {\n" + "    \"attributes\": {\"hierarchical-group\": \"east.g1\"},\n" + "    \"state\": {\n" + "      \"generated\": {\n" + "        \"state\": \"down\",\n" + "        \"reason\": \"\"\n" + "      },\n" + "      \"unit\": {\n" + "        \"state\": \"down\",\n" + "        \"reason\": \"Node not seen in slobrok.\"\n" + "      },\n" + "      \"user\": {\n" + "        \"state\": \"up\",\n" + "        \"reason\": \"\"\n" + "      }\n" + "    }\n" + "  },\n" + "  \"3\": {\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" + "  },\n" + "  \"5\": {\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" + "  },\n" + "  \"7\": {\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" + "  }\n" + "}}";
    assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
Also used : UnitResponse(com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse) Test(org.junit.Test)

Example 8 with UnitResponse

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

the class ClusterTest method testRecursiveCluster.

@Test
public void testRecursiveCluster() throws Exception {
    setUp(true);
    UnitResponse response = restAPI.getState(new StateRequest("music", 1));
    String expected = "{\n" + "  \"state\": {\"generated\": {\n" + "    \"state\": \"up\",\n" + "    \"reason\": \"\"\n" + "  }},\n" + "  \"service\": {\n" + "    \"storage\": {\"node\": {\n" + "      \"1\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/1\"},\n" + "      \"2\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/2\"},\n" + "      \"3\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/3\"},\n" + "      \"5\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/5\"},\n" + "      \"7\": {\"link\": \"\\/cluster\\/v2\\/music\\/storage\\/7\"}\n" + "    }},\n" + "    \"distributor\": {\"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" + "    }}\n" + "  },\n" + "  \"distribution-states\": {\"published\": {\n" + "    \"baseline\": \"distributor:8 .0.s:d .2.s:d .4.s:d .6.s:d storage:8 .0.s:d .2.s:d .4.s:d .6.s:d\",\n" + "    \"bucket-spaces\": []\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 9 with UnitResponse

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

the class ClusterTest method testCluster.

@Test
public void testCluster() throws Exception {
    setUp(true);
    UnitResponse response = restAPI.getState(new StateRequest("books", 0));
    String expected = "{\n" + "  \"state\": {\"generated\": {\n" + "    \"state\": \"up\",\n" + "    \"reason\": \"\"\n" + "  }},\n" + "  \"service\": {\n" + "    \"storage\": {\"link\": \"\\/cluster\\/v2\\/books\\/storage\"},\n" + "    \"distributor\": {\"link\": \"\\/cluster\\/v2\\/books\\/distributor\"}\n" + "  },\n" + "  \"distribution-states\": {\"published\": {\n" + "    \"baseline\": \"distributor:4 storage:4\",\n" + "    \"bucket-spaces\": [\n" + "      {\n" + "        \"name\": \"default\",\n" + "        \"state\": \"distributor:4 storage:4 .3.s:m\"\n" + "      },\n" + "      {\n" + "        \"name\": \"global\",\n" + "        \"state\": \"distributor:4 storage:4\"\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 10 with UnitResponse

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

the class SetNodeStateTest method verifyStateSet.

private void verifyStateSet(String state, String reason) throws Exception {
    restAPI.setUnitState(new SetUnitStateRequestImpl("music/distributor/1").setNewState("user", state, reason));
    UnitResponse response = restAPI.getState(new StateRequest("music/distributor/1", 0));
    String expected = musicClusterExpectedUserStateString("east.g2", "up", "up", state.toLowerCase(), reason);
    assertEquals(expected, jsonWriter.createJson(response).toString(2));
}
Also used : SetNodeStateRequest(com.yahoo.vespa.clustercontroller.core.restapiv2.requests.SetNodeStateRequest) SetUnitStateRequest(com.yahoo.vespa.clustercontroller.utils.staterestapi.requests.SetUnitStateRequest) UnitResponse(com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse) StringContains.containsString(org.hamcrest.core.StringContains.containsString)

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