test_class.declarator: objectMapper = new ObjectMapper()
test_class.modifier: private static
test_class.original_string: private static ObjectMapper objectMapper = new ObjectMapper();
test_class.type: ObjectMapper
test_class.var_name: objectMapper
test_class.file: bigdata-intro/cep-intro/siddhi-kafka-rest/src/test/java/net/redborder/cep/rest/RestRulesTest.java
test_class.identifier: RestRulesTest
test_class.superclass: extends JerseyTest
test_case.body: @Test
      public void synchronize() throws Exception {
          // Create a set of rules that will be added
          List<Map<String, Object>> listOfRules = new ArrayList<>();
  
          Map<String, Object> elementMap = new HashMap<>();
          Map<String, String> outputTopics = new HashMap<>();
          outputTopics.put("outputStream", "outputTopic");
          elementMap.put("id", "rule_list_one");
          elementMap.put("input", Arrays.asList("test"));
          elementMap.put("output", outputTopics);
          elementMap.put("executionPlan", "from test select a, b insert into outputStream;");
          listOfRules.add(elementMap);
  
          Map<String, Object> elementMap2 = new HashMap<>();
          Map<String, String> outputTopics2 = new HashMap<>();
          outputTopics2.put("outputStream", "outputTopic");
          elementMap2.put("id", "rule_list_two");
          elementMap2.put("input", Arrays.asList("test"));
          elementMap2.put("output", outputTopics2);
          elementMap2.put("executionPlan", "from test select a, b insert into outputStream;");
          listOfRules.add(elementMap2);
  
          String json = objectMapper.writeValueAsString(listOfRules);
  
          Entity<String> entity = Entity.json(json);
          Response response = target("/v1/synchronize").request(MediaType.APPLICATION_JSON_TYPE).post(entity);
          int statusCode = response.getStatus();
  
          assertEquals(Response.Status.OK.getStatusCode(), statusCode);
      }
test_case.class_method_signature: RestRulesTest.synchronize()
test_case.full_signature: @Test public void synchronize()
test_case.identifier: synchronize
test_case.invocations: put put put asList put put add put put put asList put put add writeValueAsString json post request target getStatus assertEquals getStatusCode
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void synchronize()
focal_class.declarator: log = LoggerFactory.getLogger(RestRules.class)
focal_class.modifier: private final
focal_class.original_string: private final Logger log = LoggerFactory.getLogger(RestRules.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: mapper = new ObjectMapper()
focal_class.modifier: private
focal_class.original_string: private ObjectMapper mapper = new ObjectMapper();
focal_class.type: ObjectMapper
focal_class.var_name: mapper
focal_class.file: bigdata-intro/cep-intro/siddhi-kafka-rest/src/main/java/net/redborder/cep/rest/RestRules.java
focal_class.identifier: RestRules
focal_class.class_method_signature: RestRules.add(String json)
focal_class.full_signature: @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response add(String json)
focal_class.identifier: add
focal_class.modifiers: @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public
focal_class.parameters: (String json)
focal_class.return: Response
focal_class.signature: Response add(String json)
focal_class.class_method_signature: RestRules.remove(@PathParam("id") String id)
focal_class.full_signature: @DELETE @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public Response remove(@PathParam("id") String id)
focal_class.identifier: remove
focal_class.modifiers: @DELETE @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public
focal_class.parameters: (@PathParam("id") String id)
focal_class.return: Response
focal_class.signature: Response remove(@PathParam("id") String id)
focal_class.class_method_signature: RestRules.synchronize(String json)
focal_class.full_signature: @POST @Path("/synchronize") @Consumes (MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response synchronize(String json)
focal_class.identifier: synchronize
focal_class.modifiers: @POST @Path("/synchronize") @Consumes (MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public
focal_class.parameters: (String json)
focal_class.return: Response
focal_class.signature: Response synchronize(String json)
focal_class.class_method_signature: RestRules.list()
focal_class.full_signature: @GET @Produces(MediaType.APPLICATION_JSON) public Response list()
focal_class.identifier: list
focal_class.modifiers: @GET @Produces(MediaType.APPLICATION_JSON) public
focal_class.parameters: ()
focal_class.return: Response
focal_class.signature: Response list()
focal_class.class_method_signature: RestRules.parseMap(String str)
focal_class.full_signature: private Map<String, Object> parseMap(String str)
focal_class.identifier: parseMap
focal_class.modifiers: private
focal_class.parameters: (String str)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> parseMap(String str)
focal_class.class_method_signature: RestRules.parseList(String str)
focal_class.full_signature: private List<Map<String, Object>> parseList(String str)
focal_class.identifier: parseList
focal_class.modifiers: private
focal_class.parameters: (String str)
focal_class.return: List<Map<String, Object>>
focal_class.signature: List<Map<String, Object>> parseList(String str)
focal_class.class_method_signature: RestRules.toMap(Throwable e, Response.Status status)
focal_class.full_signature: private Map<String, Object> toMap(Throwable e, Response.Status status)
focal_class.identifier: toMap
focal_class.modifiers: private
focal_class.parameters: (Throwable e, Response.Status status)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> toMap(Throwable e, Response.Status status)
focal_method.body: @POST
      @Path("/synchronize")
      @Consumes (MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      public Response synchronize(String json) {
          RestListener listener = RestManager.getListener();
          Response response;
  
          try {
              log.info("Synchronize request with json: {}", json);
              listener.synchronize(parseList(json));
              response = Response.ok().build();
          } catch (RestInvalidException e) {
              log.info("Synchronize request was invalid: {}", e.getMessage());
              e.printStackTrace();
              response = Response.status(Response.Status.BAD_REQUEST)
                      .entity(toMap(e, Response.Status.BAD_REQUEST))
                      .build();
          } catch (Exception e) {
              e.printStackTrace();
              response = Response.serverError()
                      .entity(toMap(e, Response.Status.INTERNAL_SERVER_ERROR))
                      .build();
          }
  
          return response;
      }
focal_method.class_method_signature: RestRules.synchronize(String json)
focal_method.full_signature: @POST @Path("/synchronize") @Consumes (MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response synchronize(String json)
focal_method.identifier: synchronize
focal_method.invocations: getListener info synchronize parseList build ok info getMessage printStackTrace build entity status toMap printStackTrace build entity serverError toMap
focal_method.modifiers: @POST @Path("/synchronize") @Consumes (MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public
focal_method.parameters: (String json)
focal_method.return: Response
focal_method.signature: Response synchronize(String json)