private void cleanupEndpoints() throws RemoteException, EndpointAdminEndpointAdminException {
   String[] endpointNames = endPointAdminClient.getEndpointNames();
   List endpointList;
   if (endpointNames != null && endpointNames.length > 0 && endpointNames[0] != null) {
     endpointList = Arrays.asList(endpointNames);
     if (endpointList.contains(ENDPOINT_NAME)) {
       endPointAdminClient.deleteEndpoint(ENDPOINT_NAME);
     }
   }
 }
  private void endpointAdditionScenario() throws Exception {
    int beforeCount = endPointAdminClient.getEndpointCount();

    addEndpoint(
        AXIOMUtil.stringToOM(
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                + "<endpoint xmlns=\"http://ws.apache.org/ns/synapse\" name=\""
                + ENDPOINT_NAME
                + "\">\n"
                + "<http method=\"POST\"\n"
                + "              uri-template=\"http://localhost:9000/services/SimpleStockQuoteService\"/>"
                + "</endpoint>"));
    int afterCount = endPointAdminClient.getEndpointCount();
    assertEquals(1, afterCount - beforeCount);

    String[] endpoints = endPointAdminClient.getEndpointNames();
    if (endpoints != null && endpoints.length > 0 && endpoints[0] != null) {
      List endpointList = Arrays.asList(endpoints);
      assertTrue(endpointList.contains(ENDPOINT_NAME));
    } else {
      fail("Endpoint has not been added to the system properly");
    }
  }