Search in sources :

Example 11 with ConfigurationCondition

use of org.graalvm.nativeimage.impl.ConfigurationCondition in project graal by oracle.

the class ProxyConfigurationParser method parseWithConditionalConfig.

private void parseWithConditionalConfig(Map<String, Object> proxyConfigObject) {
    checkAttributes(proxyConfigObject, "proxy descriptor object", Collections.singleton("interfaces"), Collections.singletonList(CONDITIONAL_KEY));
    ConfigurationCondition condition = parseCondition(proxyConfigObject);
    parseInterfaceList(condition, asList(proxyConfigObject.get("interfaces"), "\"interfaces\" must be an array of fully qualified interface names"));
}
Also used : ConfigurationCondition(org.graalvm.nativeimage.impl.ConfigurationCondition)

Example 12 with ConfigurationCondition

use of org.graalvm.nativeimage.impl.ConfigurationCondition in project graal by oracle.

the class TypeMethodsWithFlagsTest method doTestSerializationConfig.

private static void doTestSerializationConfig(SerializationConfiguration serializationConfig) {
    ConfigurationCondition condition = ConfigurationCondition.alwaysTrue();
    Assert.assertFalse(serializationConfig.contains(condition, "seenType", null));
    Assert.assertTrue(serializationConfig.contains(condition, "unseenType", null));
}
Also used : ConfigurationCondition(org.graalvm.nativeimage.impl.ConfigurationCondition)

Example 13 with ConfigurationCondition

use of org.graalvm.nativeimage.impl.ConfigurationCondition in project graal by oracle.

the class TypeMethodsWithFlagsTest method doTestProxyConfig.

private static void doTestProxyConfig(ProxyConfiguration proxyConfig) {
    ConfigurationCondition condition = ConfigurationCondition.alwaysTrue();
    Assert.assertFalse(proxyConfig.contains(condition, "testProxySeenA", "testProxySeenB", "testProxySeenC"));
    Assert.assertTrue(proxyConfig.contains(condition, "testProxyUnseen"));
}
Also used : ConfigurationCondition(org.graalvm.nativeimage.impl.ConfigurationCondition)

Example 14 with ConfigurationCondition

use of org.graalvm.nativeimage.impl.ConfigurationCondition in project graal by oracle.

the class ResourceConfigurationTest method anyResourceMatches.

@Test
public void anyResourceMatches() {
    ResourceConfiguration rc = new ResourceConfiguration();
    ConfigurationCondition defaultCond = ConfigurationCondition.alwaysTrue();
    rc.addResourcePattern(defaultCond, ".*/Resource.*txt$");
    Assert.assertTrue(rc.anyResourceMatches("com/my/app/Resource0.txt"));
    Assert.assertTrue(rc.anyResourceMatches("com/my/app/Resource1.txt"));
    Assert.assertTrue(rc.anyResourceMatches("/Resource2.txt"));
    Assert.assertTrue(rc.anyResourceMatches("/Resource3.txt"));
    rc.ignoreResourcePattern(defaultCond, ".*/Resource2.txt$");
    Assert.assertTrue(rc.anyResourceMatches("com/my/app/Resource0.txt"));
    Assert.assertTrue(rc.anyResourceMatches("com/my/app/Resource1.txt"));
    Assert.assertFalse(rc.anyResourceMatches("/Resource2.txt"));
    Assert.assertTrue(rc.anyResourceMatches("/Resource3.txt"));
}
Also used : ConfigurationCondition(org.graalvm.nativeimage.impl.ConfigurationCondition) ResourceConfiguration(com.oracle.svm.configure.config.ResourceConfiguration) Test(org.junit.Test)

Aggregations

ConfigurationCondition (org.graalvm.nativeimage.impl.ConfigurationCondition)14 List (java.util.List)3 ConfigurationMemberDeclaration (com.oracle.svm.configure.config.ConfigurationMemberInfo.ConfigurationMemberDeclaration)2 ResourceConfiguration (com.oracle.svm.configure.config.ResourceConfiguration)2 Test (org.junit.Test)2 ConfigurationMemberAccessibility (com.oracle.svm.configure.config.ConfigurationMemberInfo.ConfigurationMemberAccessibility)1 TypeConfiguration (com.oracle.svm.configure.config.TypeConfiguration)1 JsonWriter (com.oracle.svm.configure.json.JsonWriter)1 TargetClass (com.oracle.svm.core.annotate.TargetClass)1 ResourceConfigurationParser (com.oracle.svm.core.configure.ResourceConfigurationParser)1 ResourcesRegistry (com.oracle.svm.core.configure.ResourcesRegistry)1 IOException (java.io.IOException)1 PipedReader (java.io.PipedReader)1 PipedWriter (java.io.PipedWriter)1 Constructor (java.lang.reflect.Constructor)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Locale (java.util.Locale)1