-
Notifications
You must be signed in to change notification settings - Fork 619
Add preferences API resource with POST method #8150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 14 commits
a322684
71ade01
8d34434
e7a1a5b
a07fd22
64d0a79
bc7f851
ca5dca9
ca3e0eb
b94035a
0c7e849
ffbb833
0fb18c6
de33c82
eb4459b
bdd31dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -598,6 +598,29 @@ public Attribute replaceAttribute(String resourceTypeName, String resourceName, | |||||||||||||||||
| return attribute; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Resolve the default configurations for the given resource from the registered default config resolvers. | ||||||||||||||||||
| * | ||||||||||||||||||
| * @param resourceType Resource type name. | ||||||||||||||||||
| * @param resourceName Resource name. | ||||||||||||||||||
| * @return Default resource from the first resolver that can handle it. | ||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
Outdated
|
||||||||||||||||||
| * @throws ConfigurationManagementException if no resolver can handle the given resource type and name | ||||||||||||||||||
| * (ERROR_CODE_RESOURCE_DOES_NOT_EXISTS). | ||||||||||||||||||
| */ | ||||||||||||||||||
| @Override | ||||||||||||||||||
| public Resource getDefaultResource(String resourceType, String resourceName) | ||||||||||||||||||
| throws ConfigurationManagementException { | ||||||||||||||||||
|
Comment on lines
+610
to
+612
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 1
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| DefaultConfigResolver resolver = ConfigurationManagerComponentDataHolder.getInstance() | ||||||||||||||||||
| .getDefaultConfigResolver(resourceType, resourceName); | ||||||||||||||||||
|
|
||||||||||||||||||
| if (resolver == null) { | ||||||||||||||||||
| throw handleServerException(ERROR_CODE_RESOURCE_DOES_NOT_EXISTS, resourceName); | ||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
Outdated
|
||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| return resolver.getDefaultConfigs(resourceType, resourceName); | ||||||||||||||||||
| } | ||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
|
||||||||||||||||||
|
|
||||||||||||||||||
| private void validateSearchRequest(Condition condition) throws ConfigurationManagementClientException { | ||||||||||||||||||
|
|
||||||||||||||||||
| if (condition == null) { | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.wso2.carbon.identity.configuration.mgt.core; | ||
|
|
||
| import org.wso2.carbon.identity.configuration.mgt.core.model.Resource; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceIdentifier; | ||
|
|
||
| /** | ||
| * Interface for resolving default configurations for a given resource type and name. | ||
| */ | ||
| public interface DefaultConfigResolver { | ||
|
|
||
| /** | ||
| * Get the resource identifier that this resolver can handle. | ||
| * @return ResourceIdentifier of the default configuration. | ||
| */ | ||
| ResourceIdentifier getResourceIdentifier(); | ||
|
|
||
| /** | ||
| * Get the default configurations for the given resource type and name. | ||
| * | ||
| * @param resourceTypeName Name of the resource type. | ||
| * @param resourceName Name of the resource. | ||
| * @return Resource containing the default configurations. | ||
| */ | ||
| Resource getDefaultConfigs(String resourceTypeName, String resourceName); | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,7 @@ | |||||||||||||||||||||||||||
| import org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException; | ||||||||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManager; | ||||||||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManagerImpl; | ||||||||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.DefaultConfigResolver; | ||||||||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.dao.ConfigurationDAO; | ||||||||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.dao.impl.CachedBackedConfigurationDAO; | ||||||||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl; | ||||||||||||||||||||||||||||
|
|
@@ -189,4 +190,27 @@ protected void unsetOrgResourceResolverService(OrgResourceResolverService orgRes | |||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ConfigurationManagerComponentDataHolder.getInstance().setOrgResourceResolverService(null); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| @Reference( | ||||||||||||||||||||||||||||
| name = "default.config.resolver", | ||||||||||||||||||||||||||||
| service = DefaultConfigResolver.class, | ||||||||||||||||||||||||||||
| cardinality = ReferenceCardinality.MULTIPLE, | ||||||||||||||||||||||||||||
| policy = ReferencePolicy.DYNAMIC, | ||||||||||||||||||||||||||||
| unbind = "unsetDefaultConfigResolver" | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
| protected void setDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) { | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| if (log.isDebugEnabled()) { | ||||||||||||||||||||||||||||
| log.debug("DefaultConfigResolver registered: " + defaultConfigResolver.getClass().getName()); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| ConfigurationManagerComponentDataHolder.getInstance().addDefaultConfigResolver(defaultConfigResolver); | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 3
Suggested change
|
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| protected void unsetDefaultConfigResolver(DefaultConfigResolver defaultConfigResolver) { | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| if (log.isDebugEnabled()) { | ||||||||||||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
|
||||||||||||||||||||||||||||
| log.debug("DefaultConfigResolver unregistered: " + defaultConfigResolver.getClass().getName()); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| ConfigurationManagerComponentDataHolder.getInstance().removeDefaultConfigResolver(defaultConfigResolver); | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 4
Suggested change
|
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,22 +16,34 @@ | |||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. update license headers on changed files. check on all other places |
||||||||||||||||||||||
| package org.wso2.carbon.identity.configuration.mgt.core.internal; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import org.apache.commons.logging.Log; | ||||||||||||||||||||||
| import org.apache.commons.logging.LogFactory; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import java.util.Map; | ||||||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
|
||||||||||||||||||||||
| import java.util.concurrent.ConcurrentHashMap; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.DefaultConfigResolver; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceIdentifier; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.organization.management.service.OrganizationManager; | ||||||||||||||||||||||
| import org.wso2.carbon.identity.organization.resource.hierarchy.traverse.service.OrgResourceResolverService; | ||||||||||||||||||||||
| import org.wso2.carbon.user.core.service.RealmService; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import java.util.List; | ||||||||||||||||||||||
| import java.util.concurrent.CopyOnWriteArrayList; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * A class to keep the data of the configuration manager component. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public class ConfigurationManagerComponentDataHolder { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| private static final Log LOG = LogFactory.getLog(ConfigurationManagerComponentDataHolder.class); | ||||||||||||||||||||||
| private static ConfigurationManagerComponentDataHolder instance = new ConfigurationManagerComponentDataHolder(); | ||||||||||||||||||||||
| private static boolean useCreatedTime = false; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| private boolean configurationManagementEnabled; | ||||||||||||||||||||||
| private RealmService realmService; | ||||||||||||||||||||||
| private OrganizationManager organizationManager; | ||||||||||||||||||||||
| private OrgResourceResolverService orgResourceResolverService; | ||||||||||||||||||||||
| private final Map<ResourceIdentifier, DefaultConfigResolver > defaultConfigResolvers = new ConcurrentHashMap<>(); | ||||||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| public static ConfigurationManagerComponentDataHolder getInstance() { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -107,4 +119,48 @@ public void setOrgResourceResolverService(OrgResourceResolverService orgResource | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| this.orgResourceResolverService = orgResourceResolverService; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Add a DefaultConfigResolver. Called by the OSGi DS bind callback when a resolver service is registered. | ||||||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * @param resolver DefaultConfigResolver to add. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public void addDefaultConfigResolver(DefaultConfigResolver resolver) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ResourceIdentifier resourceIdentifier = resolver.getResourceIdentifier(); | ||||||||||||||||||||||
| if (resourceIdentifier == null) { | ||||||||||||||||||||||
| LOG.warn("Skipping registration of DefaultConfigResolver with a null resource identifier: " | ||||||||||||||||||||||
|
raviendalpatadu marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||
| + resolver.getClass().getName()); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| defaultConfigResolvers.put(resourceIdentifier, resolver); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+124
to
+136
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 5
Suggested change
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Remove a DefaultConfigResolver. Called by the OSGi DS unbind callback when a resolver service is | ||||||||||||||||||||||
| * unregistered. | ||||||||||||||||||||||
| * | ||||||||||||||||||||||
| * @param resolver DefaultConfigResolver to remove. | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public void removeDefaultConfigResolver(DefaultConfigResolver resolver) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ResourceIdentifier resourceIdentifier = resolver.getResourceIdentifier(); | ||||||||||||||||||||||
| if (resourceIdentifier == null) { | ||||||||||||||||||||||
| LOG.warn("Skipping removal of DefaultConfigResolver with a null resource identifier: " | ||||||||||||||||||||||
| + resolver.getClass().getName()); | ||||||||||||||||||||||
| return; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| defaultConfigResolvers.remove(resourceIdentifier); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /** | ||||||||||||||||||||||
| * Get the DefaultConfigResolver for the given resource type and name. | ||||||||||||||||||||||
| * @param resourceType | ||||||||||||||||||||||
| * @param resourceName | ||||||||||||||||||||||
| * @return | ||||||||||||||||||||||
| */ | ||||||||||||||||||||||
| public DefaultConfigResolver getDefaultConfigResolver(String resourceType, String resourceName){ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return defaultConfigResolvers.get(new ResourceIdentifier(resourceType, resourceName)); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
Comment on lines
+143
to
166
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 6
Suggested change
|
||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.wso2.carbon.identity.configuration.mgt.core.model; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| public class ResourceIdentifier { | ||
|
|
||
| private final String resourceType; | ||
| private final String resourceName; | ||
|
|
||
| public ResourceIdentifier(String resourceType, String resourceName) { | ||
|
|
||
| this.resourceType = resourceType; | ||
| this.resourceName = resourceName; | ||
| } | ||
|
|
||
| public String getResourceType() { | ||
|
|
||
| return resourceType; | ||
| } | ||
|
|
||
| public String getResourceName() { | ||
|
|
||
| return resourceName; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
|
|
||
| if (!(o instanceof ResourceIdentifier that)) { | ||
| return false; | ||
| } | ||
| return Objects.equals(resourceType, that.resourceType) && | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check on this "That" |
||
| Objects.equals(resourceName, that.resourceName); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check on this |
||
|
|
||
| return Objects.hash(resourceType, resourceName); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,13 +30,15 @@ | |
| import org.wso2.carbon.identity.configuration.mgt.core.dao.ConfigurationDAO; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.dao.impl.ConfigurationDAOImpl; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.exception.ConfigurationManagementClientException; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.exception.ConfigurationManagementException; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.internal.ConfigurationManagerComponentDataHolder; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.Attribute; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ConfigurationManagerConfigurationHolder; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.Resource; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceAdd; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceType; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceFile; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceIdentifier; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.ResourceTypeAdd; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.model.Resources; | ||
| import org.wso2.carbon.identity.configuration.mgt.core.search.ComplexCondition; | ||
|
|
@@ -64,6 +66,7 @@ | |
| import static org.junit.Assert.assertFalse; | ||
| import static org.junit.Assert.assertNotEquals; | ||
| import static org.junit.Assert.assertNotNull; | ||
| import static org.junit.Assert.assertNull; | ||
| import static org.junit.Assert.assertTrue; | ||
| import static org.junit.Assert.fail; | ||
| import static org.mockito.ArgumentMatchers.any; | ||
|
|
@@ -889,6 +892,77 @@ private void prepareConfigs(MockedStatic<PrivilegedCarbonContext> privilegedCarb | |
| configurationManager = new ConfigurationManagerImpl(configurationHolder); | ||
| } | ||
|
|
||
| @Test(priority = 44) | ||
| public void testAddAndGetDefaultConfigResolver() { | ||
|
|
||
| ConfigurationManagerComponentDataHolder dataHolder = | ||
| ConfigurationManagerComponentDataHolder.getInstance(); | ||
| DefaultConfigResolver resolver = mock(DefaultConfigResolver.class); | ||
| when(resolver.getResourceIdentifier()).thenReturn(new ResourceIdentifier("testType", "testName")); | ||
| try { | ||
| dataHolder.addDefaultConfigResolver(resolver); | ||
| assertEquals("Resolver should be present after bind", resolver, | ||
| dataHolder.getDefaultConfigResolver("testType", "testName")); | ||
| } finally { | ||
| dataHolder.removeDefaultConfigResolver(resolver); | ||
| } | ||
| assertNull("Resolver should be absent after unbind", | ||
| dataHolder.getDefaultConfigResolver("testType", "testName")); | ||
| } | ||
|
|
||
| @Test(priority = 45) | ||
| public void testGetDefaultResourceUsesMatchingResolver() throws Exception { | ||
|
|
||
| ConfigurationManagerComponentDataHolder dataHolder = | ||
| ConfigurationManagerComponentDataHolder.getInstance(); | ||
| Resource expected = new Resource(); | ||
| expected.setResourceName("default"); | ||
|
|
||
| DefaultConfigResolver matching = mock(DefaultConfigResolver.class); | ||
| when(matching.getResourceIdentifier()).thenReturn(new ResourceIdentifier("anyType", "anyName")); | ||
| when(matching.getDefaultConfigs(anyString(), anyString())).thenReturn(expected); | ||
|
|
||
| DefaultConfigResolver shouldNotBeCalled = mock(DefaultConfigResolver.class); | ||
| when(shouldNotBeCalled.getResourceIdentifier()) | ||
| .thenReturn(new ResourceIdentifier("otherType", "otherName")); | ||
|
|
||
| try { | ||
| dataHolder.addDefaultConfigResolver(matching); | ||
| dataHolder.addDefaultConfigResolver(shouldNotBeCalled); | ||
|
|
||
| Resource actual = configurationManager.getDefaultResource("anyType", "anyName"); | ||
|
|
||
| assertEquals(expected, actual); | ||
| verify(matching, times(1)).getDefaultConfigs("anyType", "anyName"); | ||
| verify(shouldNotBeCalled, times(0)).getDefaultConfigs(anyString(), anyString()); | ||
| } finally { | ||
| dataHolder.removeDefaultConfigResolver(matching); | ||
| dataHolder.removeDefaultConfigResolver(shouldNotBeCalled); | ||
| } | ||
| } | ||
|
|
||
| @Test(priority = 46, expectedExceptions = ConfigurationManagementException.class) | ||
| public void testGetDefaultResourceThrowsWhenNoResolverMatches() throws Exception { | ||
|
|
||
| ConfigurationManagerComponentDataHolder dataHolder = | ||
| ConfigurationManagerComponentDataHolder.getInstance(); | ||
| DefaultConfigResolver nonMatching = mock(DefaultConfigResolver.class); | ||
| when(nonMatching.getResourceIdentifier()).thenReturn(new ResourceIdentifier("someType", "someName")); | ||
|
|
||
| try { | ||
| dataHolder.addDefaultConfigResolver(nonMatching); | ||
| configurationManager.getDefaultResource("unknownType", "unknownName"); | ||
| } finally { | ||
| dataHolder.removeDefaultConfigResolver(nonMatching); | ||
| } | ||
| } | ||
|
|
||
| @Test(priority = 47, expectedExceptions = ConfigurationManagementException.class) | ||
| public void testGetDefaultResourceThrowsWhenNoResolversRegistered() throws Exception { | ||
|
|
||
| configurationManager.getDefaultResource("anyType", "anyName"); | ||
| } | ||
|
Comment on lines
+960
to
+964
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the “no resolvers registered” test isolated from shared singleton state. This test assumes an empty global resolver registry. If another test leaves a resolver behind, Line 965 can become flaky. Clear resolver registrations in 🤖 Prompt for AI Agents |
||
|
|
||
| private void mockCarbonContextForTenant(int tenantId, String tenantDomain, | ||
| MockedStatic<PrivilegedCarbonContext> privilegedCarbonContext) { | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1651,7 +1651,8 @@ INSERT INTO IDN_CONFIG_TYPE (ID, NAME, DESCRIPTION) VALUES | |||||
| ('32360745-9c3e-4391-b563-66f17f0eb93a', 'ADMIN_ADVISORY_BANNER', 'A resource type to store admin advisory banner configurations.'), | ||||||
| ('82ab7001-fb0e-44da-9169-1f63e4964d9b', 'REMOTE_LOGGING_CONFIG', 'A resource type to store remote server logger configurations.'), | ||||||
| ('08fbc096-56c5-4ae6-9edc-54198a07e0dc', 'ISSUER_USAGE_SCOPE', 'A resource type to store issuer usage scope for organizations.'), | ||||||
| ('12c78d11-65cd-4b6e-b482-98538ecd7a5c', 'FAPI_CONFIGURATION', 'A resource type to keep the FAPI configurations.') | ||||||
| ('12c78d11-65cd-4b6e-b482-98538ecd7a5c', 'FAPI_CONFIGURATION', 'A resource type to keep the FAPI configurations.'), | ||||||
| ('4fed2813-cfa8-40b1-83e6-4ab85d7fcb16', 'DEVICE_MANAGEMENT', 'A resource type to keep tenant level configurations for push authentication') | ||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| / | ||||||
|
|
||||||
| CREATE TABLE IDN_CONFIG_RESOURCE ( | ||||||
|
|
@@ -2608,7 +2609,7 @@ CREATE TABLE IDN_PUSH_DEVICE_STORE ( | |||||
| PROVIDER VARCHAR(45) NOT NULL, | ||||||
| TENANT_ID INTEGER NOT NULL, | ||||||
| PRIMARY KEY (ID), | ||||||
| UNIQUE (USER_ID) | ||||||
| UNIQUE (USER_ID, DEVICE_TOKEN, TENANT_ID) | ||||||
| ) | ||||||
| / | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.