-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude Non-Loadable Packages from ClassLoader. Fixes #issue 1385 (#1384
) We encountered an issue with the package loader that loads every package indiscriminately, instead of using the Maven class loader's smart loading. This is a known problem, and while some packages have already been excluded, the process requires a merge request for each exclusion. Therefore, we identified the need for a faster and more dynamic exclusion mechanism. This fix introduces a system property string containing a comma-separated list of packages to exclude. By setting this property, the specified packages will be excluded from the loaded packages. Fixes #1385
- Loading branch information
1 parent
55af7cd
commit a1ab305
Showing
6 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
.../pulumi/src/test/java/com/pulumi/serialization/internal/ResourcePackagesIsolatedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.pulumi.serialization.internal; | ||
|
||
import com.pulumi.Log; | ||
import org.junit.jupiter.api.Test; | ||
import java.util.Optional; | ||
import com.pulumi.core.annotations.ResourceType; | ||
import com.pulumi.resources.ComponentResource; | ||
import com.pulumi.resources.ComponentResourceOptions; | ||
import com.pulumi.resources.Resource; | ||
import com.pulumi.resources.ResourceArgs; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.fail; | ||
|
||
|
||
|
||
public class ResourcePackagesIsolatedTest { | ||
|
||
@Test | ||
void ExcludedResource() { | ||
try { | ||
System.setProperty("pulumi.resourcepackages.excludes", ResourcePackagesIsolatedTest.ExcludedResource.class.getPackageName()); | ||
var resourcePackages = new ResourcePackages(Log.ignore()); | ||
Optional<Class<Resource>> resourceType = resourcePackages.tryGetResourceType("test-excludePackages:index/ExcludedResource", null); | ||
|
||
if (resourceType.isPresent()) { | ||
fail("Test resource was found"); | ||
} else { | ||
assertThat(resourceType).isNotPresent(); | ||
} | ||
} finally { | ||
// Clear the system property after the test | ||
System.clearProperty("pulumi.resourcepackages.excludes"); | ||
} | ||
} | ||
|
||
@ResourceType(type = "test-excludePackages:index/ExcludedResource") | ||
private static class ExcludedResource extends ComponentResource { | ||
public ExcludedResource(String type, String name, @Nullable ResourceArgs args, @Nullable ComponentResourceOptions options) { | ||
super(type, name, args, options); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters