use of org.kie.workbench.common.dmn.api.definition.v1_1.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)));
}
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.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));
}
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.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)));
}
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.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;
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Context in project webtools.servertools by eclipse.
the class Tomcat85Configuration method addWebModule.
/**
* @see ITomcatConfigurationWorkingCopy#addWebModule(int, ITomcatWebModule)
*/
public void addWebModule(int index, ITomcatWebModule module) {
try {
Context context = serverInstance.createContext(index);
if (context != null) {
context.setDocBase(module.getDocumentBase());
context.setPath(module.getPath());
context.setReloadable(module.isReloadable() ? "true" : "false");
if (module.getMemento() != null && module.getMemento().length() > 0)
context.setSource(module.getMemento());
isServerDirty = true;
firePropertyChangeEvent(ADD_WEB_MODULE_PROPERTY, null, module);
}
} catch (Exception e) {
Trace.trace(Trace.SEVERE, "Error adding web module " + module.getPath(), e);
}
}
Aggregations