Search in sources :

Example 91 with Context

use of com.microsoft.z3.Context in project drools by kiegroup.

the class ValidatorContextTest method testCONTEXT_DUP_ENTRY_ReaderInput.

@Test
public void testCONTEXT_DUP_ENTRY_ReaderInput() throws IOException {
    try (final Reader reader = getReader("context/CONTEXT_DUP_ENTRY.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(2));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.DUPLICATE_NAME)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) Context(org.kie.dmn.model.v1_1.Context) List(java.util.List) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) Assert(org.junit.Assert) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Example 92 with Context

use of com.microsoft.z3.Context in project drools by kiegroup.

the class ValidatorContextTest method testCONTEXT_MISSING_EXPR_ReaderInput.

@Test
public void testCONTEXT_MISSING_EXPR_ReaderInput() throws IOException {
    try (final Reader reader = getReader("context/CONTEXT_MISSING_EXPR.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(2));
        // this is schema validation
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.FAILED_XML_VALIDATION)));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.MISSING_EXPRESSION)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) Context(org.kie.dmn.model.v1_1.Context) List(java.util.List) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) Assert(org.junit.Assert) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Example 93 with Context

use of com.microsoft.z3.Context in project drools by kiegroup.

the class ValidatorContextTest method testCONTEXT_ENTRY_MISSING_VARIABLE_ReaderInput.

@Test
public void testCONTEXT_ENTRY_MISSING_VARIABLE_ReaderInput() throws IOException {
    try (final Reader reader = getReader("context/CONTEXT_ENTRY_MISSING_VARIABLE.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(1));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.MISSING_VARIABLE)));
        // check that it reports and error for the second context entry, but not for the last one
        final ContextEntry ce = (ContextEntry) validate.get(0).getSourceReference();
        assertThat(((Context) ce.getParent()).getContextEntry().indexOf(ce), is(1));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) Context(org.kie.dmn.model.v1_1.Context) List(java.util.List) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) Assert(org.junit.Assert) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) Context(org.kie.dmn.model.v1_1.Context) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry) Test(org.junit.Test)

Example 94 with Context

use of com.microsoft.z3.Context in project drools by kiegroup.

the class ValidatorContextTest method testCONTEXT_MISSING_ENTRIES_ReaderInput.

@Test
public void testCONTEXT_MISSING_ENTRIES_ReaderInput() throws IOException {
    try (final Reader reader = getReader("context/CONTEXT_MISSING_ENTRIES.dmn")) {
        final List<DMNMessage> validate = validator.validate(reader, VALIDATE_SCHEMA, VALIDATE_MODEL, VALIDATE_COMPILATION);
        assertThat(ValidatorUtil.formatMessages(validate), validate.size(), is(1));
        assertTrue(validate.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.MISSING_EXPRESSION)));
    }
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) DMNMessage(org.kie.dmn.api.core.DMNMessage) VALIDATE_COMPILATION(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION) DMNMessageType(org.kie.dmn.api.core.DMNMessageType) ContextEntry(org.kie.dmn.model.v1_1.ContextEntry) IOException(java.io.IOException) Test(org.junit.Test) Reader(java.io.Reader) Context(org.kie.dmn.model.v1_1.Context) List(java.util.List) VALIDATE_SCHEMA(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_SCHEMA) Assert(org.junit.Assert) VALIDATE_MODEL(org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_MODEL) DMNMessage(org.kie.dmn.api.core.DMNMessage) Reader(java.io.Reader) Test(org.junit.Test)

Example 95 with Context

use of com.microsoft.z3.Context in project webtools.servertools by eclipse.

the class Tomcat85Configuration method getWebModules.

/**
 * Return a list of the web modules in this server.
 * @return java.util.List
 */
public List getWebModules() {
    List<WebModule> list = new ArrayList<WebModule>();
    try {
        Context[] contexts = serverInstance.getContexts();
        if (contexts != null) {
            for (int i = 0; i < contexts.length; i++) {
                Context context = contexts[i];
                String reload = context.getReloadable();
                if (reload == null)
                    reload = "false";
                WebModule module = new WebModule(context.getPath(), context.getDocBase(), context.getSource(), reload.equalsIgnoreCase("true") ? true : false);
                list.add(module);
            }
        }
    } catch (Exception e) {
        Trace.trace(Trace.SEVERE, "Error getting project refs", e);
    }
    return list;
}
Also used : Context(org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context) ArrayList(java.util.ArrayList) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

Context (org.eclipse.jst.server.tomcat.core.internal.xml.server40.Context)58 Context (com.microsoft.z3.Context)36 CoreException (org.eclipse.core.runtime.CoreException)34 BoolExpr (com.microsoft.z3.BoolExpr)31 Test (org.junit.Test)24 List (java.util.List)21 Event (dartagnan.program.Event)19 MemEvent (dartagnan.program.MemEvent)19 Program (dartagnan.program.Program)19 IOException (java.io.IOException)19 Set (java.util.Set)19 Collectors (java.util.stream.Collectors)19 ServerInstance (org.eclipse.jst.server.tomcat.core.internal.xml.server40.ServerInstance)17 Context (org.kie.workbench.common.dmn.api.definition.v1_1.Context)17 Local (dartagnan.program.Local)16 HashMap (java.util.HashMap)16 Map (java.util.Map)15 Solver (com.microsoft.z3.Solver)14 Init (dartagnan.program.Init)14 File (java.io.File)14