test_class.file: micro-application-register/src/test/java/com/oath/micro/server/application/registry/UriInfoParserTest.java
test_class.identifier: UriInfoParserTest
test_case.body: @Test
      public void toRegisterEntryFromQueryParameters() throws Exception {
          UriInfo uriInfo = Mockito.mock(UriInfo.class);
          MultivaluedMap<String, String> data = new MultivaluedHashMap<>();
          data.put("port", Arrays.asList("8080"));
          data.put("externalPort", Arrays.asList("9090"));
          data.put("hostname", Arrays.asList("host1"));
          data.put("module", Arrays.asList("module1"));
          data.put("context", Arrays.asList("context1"));
          data.put("target", Arrays.asList("target1"));
          data.put("health", Arrays.asList("OK"));
          data.put("manifest.Implementation-revision", Arrays.asList("revision1"));
          data.put("manifest.Implementation-Timestamp", Arrays.asList("2017_001"));
          data.put("manifest.Implementation-Version", Arrays.asList("v1"));
  
          when(uriInfo.getQueryParameters()).thenReturn(data);
  
          Optional<RegisterEntry> reOptional = UriInfoParser.toRegisterEntry(uriInfo);
          assertTrue(reOptional.isPresent());
  
          RegisterEntry re = reOptional.get();
          assertThat(re.getPort(), is(8080));
          assertThat(re.getExternalPort(), is(9090));
          assertThat(re.getHostname(), is("host1"));
          assertThat(re.getModule(), is("module1"));
          assertThat(re.getContext(), is("context1"));
          assertThat(re.getTarget(), is("target1"));
          assertThat(re.getHealth(), is(Health.OK));
          assertThat(re.getManifest().get("Implementation-revision"), is("revision1"));
          assertThat(re.getManifest().get("Implementation-Timestamp"), is("2017_001"));
          assertThat(re.getManifest().get("Implementation-Version"), is("v1"));
      }
test_case.class_method_signature: UriInfoParserTest.toRegisterEntryFromQueryParameters()
test_case.full_signature: @Test public void toRegisterEntryFromQueryParameters()
test_case.identifier: toRegisterEntryFromQueryParameters
test_case.invocations: mock put asList put asList put asList put asList put asList put asList put asList put asList put asList put asList thenReturn when getQueryParameters toRegisterEntry assertTrue isPresent get assertThat getPort is assertThat getExternalPort is assertThat getHostname is assertThat getModule is assertThat getContext is assertThat getTarget is assertThat getHealth is assertThat get getManifest is assertThat get getManifest is assertThat get getManifest is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void toRegisterEntryFromQueryParameters()
focal_class.file: micro-application-register/src/main/java/com/oath/micro/server/application/registry/UriInfoParser.java
focal_class.identifier: UriInfoParser
focal_class.class_method_signature: UriInfoParser.toRegisterEntry(UriInfo uriInfo)
focal_class.full_signature: public static Optional<RegisterEntry> toRegisterEntry(UriInfo uriInfo)
focal_class.identifier: toRegisterEntry
focal_class.modifiers: public static
focal_class.parameters: (UriInfo uriInfo)
focal_class.return: Optional<RegisterEntry>
focal_class.signature: Optional<RegisterEntry> toRegisterEntry(UriInfo uriInfo)
focal_class.class_method_signature: UriInfoParser.toHealth(String health)
focal_class.full_signature: private static Health toHealth(String health)
focal_class.identifier: toHealth
focal_class.modifiers: private static
focal_class.parameters: (String health)
focal_class.return: Health
focal_class.signature: Health toHealth(String health)
focal_class.class_method_signature: UriInfoParser.toInt(String port)
focal_class.full_signature: private static int toInt(String port)
focal_class.identifier: toInt
focal_class.modifiers: private static
focal_class.parameters: (String port)
focal_class.return: int
focal_class.signature: int toInt(String port)
focal_method.body: public static Optional<RegisterEntry> toRegisterEntry(UriInfo uriInfo) {
          if (uriInfo.getQueryParameters().isEmpty()) {
              return Optional.empty();
          } else {
              MultivaluedMap<String, String> parameters = uriInfo.getQueryParameters();
              RegisterEntry re = RegisterEntry.builder()
                  .context(parameters.getFirst("context"))
                  .hostname(parameters.getFirst("hostname"))
                  .port(toInt(parameters.getFirst("port")))
                  .target(parameters.getFirst("target"))
                  .externalPort(toInt(parameters.getFirst("externalPort")))
                  .module(parameters.getFirst("module"))
                  .health(toHealth(parameters.getFirst("health")))
                  .build();
  
              Map<String, String> manifest = ReactiveSeq.fromIterable(parameters.entrySet())
                  .filter(e -> e.getKey().startsWith("manifest."))
                  .toMap(e -> e.getKey().replace("manifest.", ""),
                      e -> parameters.getFirst(e.getKey()));
  
              re.getManifest().clear();
              re.getManifest().putAll(manifest);
  
              return Optional.of(re);
          }
      }
focal_method.class_method_signature: UriInfoParser.toRegisterEntry(UriInfo uriInfo)
focal_method.full_signature: public static Optional<RegisterEntry> toRegisterEntry(UriInfo uriInfo)
focal_method.identifier: toRegisterEntry
focal_method.invocations: isEmpty getQueryParameters empty getQueryParameters build health module externalPort target port hostname context builder getFirst getFirst toInt getFirst getFirst toInt getFirst getFirst toHealth getFirst toMap filter fromIterable entrySet startsWith getKey replace getKey getFirst getKey clear getManifest putAll getManifest of
focal_method.modifiers: public static
focal_method.parameters: (UriInfo uriInfo)
focal_method.return: Optional<RegisterEntry>
focal_method.signature: Optional<RegisterEntry> toRegisterEntry(UriInfo uriInfo)