Skip to content

Commit

Permalink
Merge pull request #2268 from chathuranga-jayanath-99/revert-2242-han…
Browse files Browse the repository at this point in the history
…dle-new-resource-file-keys

Revert "Handle new resource file key values. "
  • Loading branch information
arunans23 authored Dec 19, 2024
2 parents 277a791 + 122646d commit b601051
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ public class SynapseConfigUtils {

private static final Log log = LogFactory.getLog(SynapseConfigUtils.class);

public static final String RESOURCES_IDENTIFIER = "resources:";
public static final String CONVERTED_RESOURCES_IDENTIFIER = "gov:mi-resources/";

private static ConcurrentHashMap<String, SynapseConfiguration> lastRegisteredSynapseConfigurationMap =
new ConcurrentHashMap<String, SynapseConfiguration>();
Expand Down Expand Up @@ -905,13 +903,5 @@ public static SynapseConfiguration getSynapseConfiguration(String tenantDomain){
public static void addSynapseConfiguration(String tenantDomain , SynapseConfiguration synapseConfiguration){
lastRegisteredSynapseConfigurationMap.put(tenantDomain,synapseConfiguration);
}

public static String transformFileKey(String fileKey) {

if (fileKey.startsWith(RESOURCES_IDENTIFIER)) {
return CONVERTED_RESOURCES_IDENTIFIER + fileKey.substring(RESOURCES_IDENTIFIER.length());
}
return fileKey;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -1018,15 +1018,14 @@ public Object getEntry(String key) {
* @return its value
*/
public Entry getEntryDefinition(String key) {
String transformedKey = SynapseConfigUtils.transformFileKey(key);
Object o = localRegistry.get(key);
if (o == null || o instanceof Entry) {
if (o == null) {
// this is not a local definition
synchronized (this) {
o = localRegistry.get(key);
if (o == null) {
Entry entry = new Entry(transformedKey);
Entry entry = new Entry(key);
entry.setType(Entry.REMOTE_ENTRY);
addEntry(key, entry);
return entry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

import junit.framework.TestCase;
import org.apache.synapse.endpoints.HTTPEndpoint;
import org.apache.synapse.registry.url.SimpleURLRegistry;
import org.apache.synapse.registry.url.SimpleURLRegistryTest;

public class SynapseConfigurationTest extends TestCase {

Expand Down Expand Up @@ -122,12 +120,4 @@ public void run() {
throw new RuntimeException(e);
}
}

public void testGetEntryDefinition() throws Exception {

String key = "resources:xslt/sample.xslt";
SynapseConfiguration config = new SynapseConfiguration();
Entry entry = config.getEntryDefinition(key);
assertEquals("Key of entry should be transformed.", "gov:mi-resources/xslt/sample.xslt", entry.getKey());
}
}

0 comments on commit b601051

Please sign in to comment.