test_class.file: adapters/oidc/osgi-adapter/src/test/java/org/keycloak/adapters/osgi/HierarchicalPathBasedKeycloakConfigResolverTest.java
test_class.identifier: HierarchicalPathBasedKeycloakConfigResolverTest
test_case.body: @Test
      public void genericAndSpecificConfigurations() throws Exception {
          HierarchicalPathBasedKeycloakConfigResolver resolver = new HierarchicalPathBasedKeycloakConfigResolver();
          populate(resolver, true);
  
          assertThat(resolver.resolve(new MockRequest("http://localhost/a/b/c/d/e?a=b")).getRealm(), equalTo("a-b-c-d-e"));
          assertThat(resolver.resolve(new MockRequest("http://localhost/a/b/c/d/x?a=b")).getRealm(), equalTo("a-b-c-d"));
          assertThat(resolver.resolve(new MockRequest("http://localhost/a/b/c/x/x?a=b")).getRealm(), equalTo("a-b-c"));
          assertThat(resolver.resolve(new MockRequest("http://localhost/a/b/x/x/x?a=b")).getRealm(), equalTo("a-b"));
          assertThat(resolver.resolve(new MockRequest("http://localhost/a/x/x/x/x?a=b")).getRealm(), equalTo("a"));
          assertThat(resolver.resolve(new MockRequest("http://localhost/x/x/x/x/x?a=b")).getRealm(), equalTo(""));
  
          populate(resolver, false);
          try {
              resolver.resolve(new MockRequest("http://localhost/x/x/x/x/x?a=b"));
              fail("Expected java.lang.IllegalStateException: Can't find Keycloak configuration ...");
          } catch (IllegalStateException expected) {
          }
      }
test_case.class_method_signature: HierarchicalPathBasedKeycloakConfigResolverTest.genericAndSpecificConfigurations()
test_case.full_signature: @Test public void genericAndSpecificConfigurations()
test_case.identifier: genericAndSpecificConfigurations
test_case.invocations: populate assertThat getRealm resolve equalTo assertThat getRealm resolve equalTo assertThat getRealm resolve equalTo assertThat getRealm resolve equalTo assertThat getRealm resolve equalTo assertThat getRealm resolve equalTo populate resolve fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void genericAndSpecificConfigurations()
focal_class.declarator: log = Logger.getLogger(HierarchicalPathBasedKeycloakConfigResolver.class)
focal_class.modifier: protected static final
focal_class.original_string: protected static final Logger log = Logger.getLogger(HierarchicalPathBasedKeycloakConfigResolver.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.file: adapters/oidc/osgi-adapter/src/main/java/org/keycloak/adapters/osgi/HierarchicalPathBasedKeycloakConfigResolver.java
focal_class.identifier: HierarchicalPathBasedKeycloakConfigResolver
focal_class.class_method_signature: HierarchicalPathBasedKeycloakConfigResolver.HierarchicalPathBasedKeycloakConfigResolver()
focal_class.full_signature: public  HierarchicalPathBasedKeycloakConfigResolver()
focal_class.identifier: HierarchicalPathBasedKeycloakConfigResolver
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  HierarchicalPathBasedKeycloakConfigResolver()
focal_class.class_method_signature: HierarchicalPathBasedKeycloakConfigResolver.resolve(OIDCHttpFacade.Request request)
focal_class.full_signature: @Override public KeycloakDeployment resolve(OIDCHttpFacade.Request request)
focal_class.identifier: resolve
focal_class.modifiers: @Override public
focal_class.parameters: (OIDCHttpFacade.Request request)
focal_class.return: KeycloakDeployment
focal_class.signature: KeycloakDeployment resolve(OIDCHttpFacade.Request request)
focal_class.class_method_signature: HierarchicalPathBasedKeycloakConfigResolver.collectPaths(String[] segments)
focal_class.full_signature: private List<String> collectPaths(String[] segments)
focal_class.identifier: collectPaths
focal_class.modifiers: private
focal_class.parameters: (String[] segments)
focal_class.return: List<String>
focal_class.signature: List<String> collectPaths(String[] segments)
focal_class.superclass: extends PathBasedKeycloakConfigResolver
focal_method.body: @Override
      public KeycloakDeployment resolve(OIDCHttpFacade.Request request) {
          // we cached all available deployments initially and now we'll try to check them from
          // most specific to most general
          URI uri = URI.create(request.getURI());
          String path = uri.getPath();
          if (path != null) {
              while (path.startsWith("/")) {
                  path = path.substring(1);
              }
              String[] segments = path.split("/");
              List<String> paths = collectPaths(segments);
              for (String pathFragment: paths) {
                  KeycloakDeployment cachedDeployment = super.getCachedDeployment(pathFragment);
                  if (cachedDeployment != null) {
                      return cachedDeployment;
                  }
              }
          }
  
          throw new IllegalStateException("Can't find Keycloak configuration related to URI path " + uri);
      }
focal_method.class_method_signature: HierarchicalPathBasedKeycloakConfigResolver.resolve(OIDCHttpFacade.Request request)
focal_method.full_signature: @Override public KeycloakDeployment resolve(OIDCHttpFacade.Request request)
focal_method.identifier: resolve
focal_method.invocations: create getURI getPath startsWith substring split collectPaths getCachedDeployment
focal_method.modifiers: @Override public
focal_method.parameters: (OIDCHttpFacade.Request request)
focal_method.return: KeycloakDeployment
focal_method.signature: KeycloakDeployment resolve(OIDCHttpFacade.Request request)