test_class.declarator: APP = ServerSuite.APP
test_class.modifier: @ClassRule public static final
test_class.original_string: @ClassRule public static final DropwizardAppRule<ServerConfiguration> APP = ServerSuite.APP;
test_class.type: DropwizardAppRule<ServerConfiguration>
test_class.var_name: APP
test_class.declarator: setup = new AtomicBoolean(false)
test_class.modifier: private static
test_class.original_string: private static AtomicBoolean setup = new AtomicBoolean(false);
test_class.type: AtomicBoolean
test_class.var_name: setup
test_class.declarator: basicPassword = "topsecret"
test_class.modifier: private
test_class.original_string: private String basicPassword = "topsecret";
test_class.type: String
test_class.var_name: basicPassword
test_class.declarator: gson
test_class.modifier: private
test_class.original_string: private Gson gson;
test_class.type: Gson
test_class.var_name: gson
test_class.declarator: seedGroupOneKey = "appOne"
test_class.modifier: private final
test_class.original_string: private final String seedGroupOneKey = "appOne";
test_class.type: String
test_class.var_name: seedGroupOneKey
test_class.declarator: seedServiceOne = "serviceOne"
test_class.modifier: private final
test_class.original_string: private final String seedServiceOne = "serviceOne";
test_class.type: String
test_class.var_name: seedServiceOne
test_class.declarator: seedMemberOne = "memberOne"
test_class.modifier: private final
test_class.original_string: private final String seedMemberOne = "memberOne";
test_class.type: String
test_class.var_name: seedMemberOne
test_class.declarator: seedGroupBarKey = "appBar"
test_class.modifier: private final
test_class.original_string: private final String seedGroupBarKey = "appBar";
test_class.type: String
test_class.var_name: seedGroupBarKey
test_class.declarator: seedServiceBar = "serviceBar"
test_class.modifier: private final
test_class.original_string: private final String seedServiceBar = "serviceBar";
test_class.type: String
test_class.var_name: seedServiceBar
test_class.declarator: injector
test_class.modifier: private
test_class.original_string: private Injector injector;
test_class.type: Injector
test_class.var_name: injector
test_class.declarator: groupService
test_class.modifier: private
test_class.original_string: private GroupService groupService;
test_class.type: GroupService
test_class.var_name: groupService
test_class.file: outland-feature-server/src/test/java/outland/feature/server/resources/FeatureResourceTest.java
test_class.identifier: FeatureResourceTest
test_case.body: @Test
    public void testUpdate() throws Exception {
  
  
      JerseyClient client = createClient();
  
      String featureKey = "testUpdateFeatureKey";
      Feature feature = buildTestFeature(seedGroupOneKey, featureKey);
      String featureJson = Protobuf3Support.toJsonString(feature);
  
      String url = createFeatureUrl() + "/" + seedGroupOneKey;
  
      // create a feature
  
      Response register = client.target(url)
          .request()
          // create using a service's access
          .property(HTTP_AUTHENTICATION_BASIC_USERNAME, seedServiceOne + "/service")
          .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, basicPassword)
          .post(Entity.entity(featureJson, MediaType.APPLICATION_JSON_TYPE));
  
      assertTrue(register.getStatus() == 201);
  
      String jsonRegister = register.readEntity(String.class);
      Feature.Builder builderRegister = Feature.newBuilder();
      JsonFormat.parser().merge(jsonRegister, builderRegister);
  
      // check our result
  
      String id = builderRegister.getId();
      String created = builderRegister.getCreated();
      String updated = builderRegister.getUpdated();
      Status state = builderRegister.getStatus();
  
      // same id
      assertNotNull(id);
      // updated
      assertNotNull(updated);
      // created
      assertNotNull(created);
      // disabled by default
      assertEquals(Status.off, state);
  
      // turn on our feature and send an update
  
      Feature update = builderRegister.build().toBuilder().setStatus(Status.on).build();
      String featureUpdateJson = Protobuf3Support.toJsonString(update);
      Response responseUpdate = client.target(url + "/" + featureKey)
          .request()
          // this time update using a member
          .property(HTTP_AUTHENTICATION_BASIC_USERNAME, seedMemberOne + "/member")
          .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, basicPassword)
          .post(Entity.entity(featureUpdateJson, MediaType.APPLICATION_JSON_TYPE));
  
      // check our update result
  
      assertTrue(responseUpdate.getStatus() == 200);
  
      String jsonUpdateResult = responseUpdate.readEntity(String.class);
      Feature.Builder builderUpdated = Feature.newBuilder();
      JsonFormat.parser().merge(jsonUpdateResult, builderUpdated);
  
      // same id
      assertEquals(id, builderUpdated.getId());
      // updated changed from create
      assertNotEquals(updated, builderUpdated.getUpdated());
      // same created
      assertEquals(created, builderUpdated.getCreated());
      // updated to enabled
      assertEquals(Status.on, builderUpdated.getStatus());
  
      // now read it back from the server and double check
  
      Response responseGet = client.target(url + "/" + featureKey)
          .request()
          // ask using a service's grant
          .property(HTTP_AUTHENTICATION_BASIC_USERNAME, seedServiceOne + "/service")
          .property(HTTP_AUTHENTICATION_BASIC_PASSWORD, basicPassword)
          .get();
  
      String jsonResponseGet = responseGet.readEntity(String.class);
      Feature.Builder responseGetBuilder = Feature.newBuilder();
      JsonFormat.parser().merge(jsonResponseGet, responseGetBuilder);
      Feature featResponseGet = responseGetBuilder.build();
      assertEquals(id, featResponseGet.getId());
  
      // same id
      assertEquals(id, featResponseGet.getId());
      // updated changed from create
      assertNotEquals(updated, featResponseGet.getUpdated());
      // updated sames as last update
      assertEquals(builderUpdated.getUpdated(), featResponseGet.getUpdated());
      // same created
      assertEquals(created, featResponseGet.getCreated());
      // still enabled
      assertEquals(Status.on, featResponseGet.getStatus());
    }
test_case.class_method_signature: FeatureResourceTest.testUpdate()
test_case.full_signature: @Test public void testUpdate()
test_case.identifier: testUpdate
test_case.invocations: createClient buildTestFeature toJsonString createFeatureUrl post property property request target entity assertTrue getStatus readEntity newBuilder merge parser getId getCreated getUpdated getStatus assertNotNull assertNotNull assertNotNull assertEquals build setStatus toBuilder build toJsonString post property property request target entity assertTrue getStatus readEntity newBuilder merge parser assertEquals getId assertNotEquals getUpdated assertEquals getCreated assertEquals getStatus get property property request target readEntity newBuilder merge parser build assertEquals getId assertEquals getId assertNotEquals getUpdated assertEquals getUpdated getUpdated assertEquals getCreated assertEquals getStatus
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUpdate()
focal_class.declarator: featureService
focal_class.modifier: private final
focal_class.original_string: private final FeatureService featureService;
focal_class.type: FeatureService
focal_class.var_name: featureService
focal_class.declarator: groupService
focal_class.modifier: private final
focal_class.original_string: private final GroupService groupService;
focal_class.type: GroupService
focal_class.var_name: groupService
focal_class.declarator: idempotencyChecker
focal_class.modifier: private final
focal_class.original_string: private final IdempotencyChecker idempotencyChecker;
focal_class.type: IdempotencyChecker
focal_class.var_name: idempotencyChecker
focal_class.declarator: accessControlSupport
focal_class.modifier: private final
focal_class.original_string: private final AccessControlSupport accessControlSupport;
focal_class.type: AccessControlSupport
focal_class.var_name: accessControlSupport
focal_class.declarator: baseURI
focal_class.modifier: private final
focal_class.original_string: private final URI baseURI;
focal_class.type: URI
focal_class.var_name: baseURI
focal_class.declarator: headers
focal_class.modifier: private final
focal_class.original_string: private final Headers headers;
focal_class.type: Headers
focal_class.var_name: headers
focal_class.declarator: groupValidator
focal_class.modifier: private final
focal_class.original_string: private final GroupValidator groupValidator;
focal_class.type: GroupValidator
focal_class.var_name: groupValidator
focal_class.file: outland-feature-server/src/main/java/outland/feature/server/resources/FeatureResource.java
focal_class.identifier: FeatureResource
focal_class.class_method_signature: FeatureResource.FeatureResource(
        FeatureService featureService,
        GroupService groupService,
        IdempotencyChecker idempotencyChecker,
        AccessControlSupport accessControlSupport,
        ServerConfiguration serviceConfiguration,
        Headers headers
    )
focal_class.full_signature: @Inject public  FeatureResource(
        FeatureService featureService,
        GroupService groupService,
        IdempotencyChecker idempotencyChecker,
        AccessControlSupport accessControlSupport,
        ServerConfiguration serviceConfiguration,
        Headers headers
    )
focal_class.identifier: FeatureResource
focal_class.modifiers: @Inject public
focal_class.parameters: (
        FeatureService featureService,
        GroupService groupService,
        IdempotencyChecker idempotencyChecker,
        AccessControlSupport accessControlSupport,
        ServerConfiguration serviceConfiguration,
        Headers headers
    )
focal_class.signature:  FeatureResource(
        FeatureService featureService,
        GroupService groupService,
        IdempotencyChecker idempotencyChecker,
        AccessControlSupport accessControlSupport,
        ServerConfiguration serviceConfiguration,
        Headers headers
    )
focal_class.class_method_signature: FeatureResource.registerFeature(
        @Auth AuthPrincipal principal,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.full_signature: @POST @Path("/{group}") @PermitAll @Timed(name = "registerFeature") public Response registerFeature(
        @Auth AuthPrincipal principal,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.identifier: registerFeature
focal_class.modifiers: @POST @Path("/{group}") @PermitAll @Timed(name = "registerFeature") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.return: Response
focal_class.signature: Response registerFeature(
        @Auth AuthPrincipal principal,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.class_method_signature: FeatureResource.updateFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.full_signature: @POST @Path("/{group}/{feature_key}") @PermitAll @Timed(name = "updateFeature") public Response updateFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.identifier: updateFeature
focal_class.modifiers: @POST @Path("/{group}/{feature_key}") @PermitAll @Timed(name = "updateFeature") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.return: Response
focal_class.signature: Response updateFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        Feature feature,
        @Context HttpHeaders httpHeaders
    )
focal_class.class_method_signature: FeatureResource.getFeatureByKey(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey
    )
focal_class.full_signature: @GET @Path("/{group}/{feature_key}") @PermitAll @Timed(name = "getFeatureByKey") public Response getFeatureByKey(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey
    )
focal_class.identifier: getFeatureByKey
focal_class.modifiers: @GET @Path("/{group}/{feature_key}") @PermitAll @Timed(name = "getFeatureByKey") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey
    )
focal_class.return: Response
focal_class.signature: Response getFeatureByKey(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey
    )
focal_class.class_method_signature: FeatureResource.getFeatures(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group
    )
focal_class.full_signature: @GET @Path("/{group}") @PermitAll @Timed(name = "getFeatures") public Response getFeatures(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group
    )
focal_class.identifier: getFeatures
focal_class.modifiers: @GET @Path("/{group}") @PermitAll @Timed(name = "getFeatures") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        @PathParam("group") String group
    )
focal_class.return: Response
focal_class.signature: Response getFeatures(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group
    )
focal_class.class_method_signature: FeatureResource.getFeaturesSince(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @QueryParam("since") long since
    )
focal_class.full_signature: @GET @Path("/{group}/feed") @PermitAll @Timed(name = "getFeaturesSince") public Response getFeaturesSince(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @QueryParam("since") long since
    )
focal_class.identifier: getFeaturesSince
focal_class.modifiers: @GET @Path("/{group}/feed") @PermitAll @Timed(name = "getFeaturesSince") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @QueryParam("since") long since
    )
focal_class.return: Response
focal_class.signature: Response getFeaturesSince(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @QueryParam("since") long since
    )
focal_class.class_method_signature: FeatureResource.addNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        NamespaceFeature namespaceFeature
    )
focal_class.full_signature: @POST @Path("/{group}/{feature_key}/namespaces") @PermitAll @Timed(name = "addNamespaceFeature") public Response addNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        NamespaceFeature namespaceFeature
    )
focal_class.identifier: addNamespaceFeature
focal_class.modifiers: @POST @Path("/{group}/{feature_key}/namespaces") @PermitAll @Timed(name = "addNamespaceFeature") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        NamespaceFeature namespaceFeature
    )
focal_class.return: Response
focal_class.signature: Response addNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        NamespaceFeature namespaceFeature
    )
focal_class.class_method_signature: FeatureResource.updateNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace,
        NamespaceFeature namespaceFeature
    )
focal_class.full_signature: @POST @Path("/{group}/{feature_key}/namespaces/{namespace}") @PermitAll @Timed(name = "updateNamespaceFeature") public Response updateNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace,
        NamespaceFeature namespaceFeature
    )
focal_class.identifier: updateNamespaceFeature
focal_class.modifiers: @POST @Path("/{group}/{feature_key}/namespaces/{namespace}") @PermitAll @Timed(name = "updateNamespaceFeature") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace,
        NamespaceFeature namespaceFeature
    )
focal_class.return: Response
focal_class.signature: Response updateNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace,
        NamespaceFeature namespaceFeature
    )
focal_class.class_method_signature: FeatureResource.removeNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace
    )
focal_class.full_signature: @DELETE @Path("/{group}/{feature_key}/namespaces/{namespace}") @PermitAll @Timed(name = "removeNamespaceFeature") public Response removeNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace
    )
focal_class.identifier: removeNamespaceFeature
focal_class.modifiers: @DELETE @Path("/{group}/{feature_key}/namespaces/{namespace}") @PermitAll @Timed(name = "removeNamespaceFeature") public
focal_class.parameters: (
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace
    )
focal_class.return: Response
focal_class.signature: Response removeNamespaceFeature(
        @Auth AuthPrincipal principal,
        @PathParam("group") String group,
        @PathParam("feature_key") String featureKey,
        @PathParam("namespace") String namespace
    )
focal_class.class_method_signature: FeatureResource.postUpdate(
        AuthPrincipal authPrincipal, String group, String featureKey,
        Function<Feature, Feature> updater)
focal_class.full_signature: private Response postUpdate(
        AuthPrincipal authPrincipal, String group, String featureKey,
        Function<Feature, Feature> updater)
focal_class.identifier: postUpdate
focal_class.modifiers: private
focal_class.parameters: (
        AuthPrincipal authPrincipal, String group, String featureKey,
        Function<Feature, Feature> updater)
focal_class.return: Response
focal_class.signature: Response postUpdate(
        AuthPrincipal authPrincipal, String group, String featureKey,
        Function<Feature, Feature> updater)
focal_class.class_method_signature: FeatureResource.toOffset(@QueryParam("since") long since)
focal_class.full_signature: private OffsetDateTime toOffset(@QueryParam("since") long since)
focal_class.identifier: toOffset
focal_class.modifiers: private
focal_class.parameters: (@QueryParam("since") long since)
focal_class.return: OffsetDateTime
focal_class.signature: OffsetDateTime toOffset(@QueryParam("since") long since)
focal_class.class_method_signature: FeatureResource.featureNotFound()
focal_class.full_signature: private Response.ResponseBuilder featureNotFound()
focal_class.identifier: featureNotFound
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Response.ResponseBuilder
focal_class.signature: Response.ResponseBuilder featureNotFound()
focal_class.class_method_signature: FeatureResource.loadFeature(Feature feature)
focal_class.full_signature: private Optional<Feature> loadFeature(Feature feature)
focal_class.identifier: loadFeature
focal_class.modifiers: private
focal_class.parameters: (Feature feature)
focal_class.return: Optional<Feature>
focal_class.signature: Optional<Feature> loadFeature(Feature feature)
focal_class.class_method_signature: FeatureResource.respondAlreadyCreated(
        Feature feature, long start, URI loc, Optional<String> maybeSeen)
focal_class.full_signature: private Response respondAlreadyCreated(
        Feature feature, long start, URI loc, Optional<String> maybeSeen)
focal_class.identifier: respondAlreadyCreated
focal_class.modifiers: private
focal_class.parameters: (
        Feature feature, long start, URI loc, Optional<String> maybeSeen)
focal_class.return: Response
focal_class.signature: Response respondAlreadyCreated(
        Feature feature, long start, URI loc, Optional<String> maybeSeen)
focal_class.class_method_signature: FeatureResource.alreadyUpdated(Feature feature, long start, Optional<String> maybeSeen)
focal_class.full_signature: private Response alreadyUpdated(Feature feature, long start, Optional<String> maybeSeen)
focal_class.identifier: alreadyUpdated
focal_class.modifiers: private
focal_class.parameters: (Feature feature, long start, Optional<String> maybeSeen)
focal_class.return: Response
focal_class.signature: Response alreadyUpdated(Feature feature, long start, Optional<String> maybeSeen)
focal_class.class_method_signature: FeatureResource.notFound(long start)
focal_class.full_signature: private Response notFound(long start)
focal_class.identifier: notFound
focal_class.modifiers: private
focal_class.parameters: (long start)
focal_class.return: Response
focal_class.signature: Response notFound(long start)
focal_class.class_method_signature: FeatureResource.locationUrl(Feature feature)
focal_class.full_signature: private URI locationUrl(Feature feature)
focal_class.identifier: locationUrl
focal_class.modifiers: private
focal_class.parameters: (Feature feature)
focal_class.return: URI
focal_class.signature: URI locationUrl(Feature feature)
focal_class.class_method_signature: FeatureResource.update(@PathParam("group") String group, Feature feature)
focal_class.full_signature: private Feature update(@PathParam("group") String group, Feature feature)
focal_class.identifier: update
focal_class.modifiers: private
focal_class.parameters: (@PathParam("group") String group, Feature feature)
focal_class.return: Feature
focal_class.signature: Feature update(@PathParam("group") String group, Feature feature)
focal_class.class_method_signature: FeatureResource.grantedGuard(@Auth AuthPrincipal principal, @PathParam("group") String group)
focal_class.full_signature: private void grantedGuard(@Auth AuthPrincipal principal, @PathParam("group") String group)
focal_class.identifier: grantedGuard
focal_class.modifiers: private
focal_class.parameters: (@Auth AuthPrincipal principal, @PathParam("group") String group)
focal_class.return: void
focal_class.signature: void grantedGuard(@Auth AuthPrincipal principal, @PathParam("group") String group)
focal_class.class_method_signature: FeatureResource.groupValidGuard(String group, String featureKey, Feature feature)
focal_class.full_signature: private void groupValidGuard(String group, String featureKey, Feature feature)
focal_class.identifier: groupValidGuard
focal_class.modifiers: private
focal_class.parameters: (String group, String featureKey, Feature feature)
focal_class.return: void
focal_class.signature: void groupValidGuard(String group, String featureKey, Feature feature)
focal_method.body: private Feature update(@PathParam("group") String group, Feature feature) {
      return featureService.updateFeature(group, feature.getKey(), feature)
          .orElseThrow(() -> new RuntimeException(""));
    }
focal_method.class_method_signature: FeatureResource.update(@PathParam("group") String group, Feature feature)
focal_method.full_signature: private Feature update(@PathParam("group") String group, Feature feature)
focal_method.identifier: update
focal_method.invocations: orElseThrow updateFeature getKey
focal_method.modifiers: private
focal_method.parameters: (@PathParam("group") String group, Feature feature)
focal_method.return: Feature
focal_method.signature: Feature update(@PathParam("group") String group, Feature feature)