use of org.kie.dmn.model.v1_1.Context in project kie-wb-common by kiegroup.
the class MoveRowsCommandTest method setup.
@Before
public void setup() {
this.context = new Context();
this.uiModel = new DMNGridData();
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiNameColumn).getIndex();
doReturn(2).when(uiExpressionEditorColumn).getIndex();
addContextEntry(II1);
addContextEntry(II2);
addUiModelColumn(uiRowNumberColumn);
addUiModelColumn(uiNameColumn);
addUiModelColumn(uiExpressionEditorColumn);
addUiModelRow(0);
addUiModelRow(1);
}
use of org.kie.dmn.model.v1_1.Context in project liferay-ide by liferay.
the class LiferayTomcatServerBehavior method moveContextToAutoDeployDir.
public IStatus moveContextToAutoDeployDir(IModule module, IPath deployDir, IPath baseDir, IPath autoDeployDir, boolean noPath, boolean serverStopped) {
// $NON-NLS-1$
IPath confDir = baseDir.append("conf");
// $NON-NLS-1$
IPath serverXml = confDir.append("server.xml");
try (InputStream newInputStream = Files.newInputStream(serverXml.toFile().toPath())) {
Factory factory = new Factory();
// $NON-NLS-1$
factory.setPackageName("org.eclipse.jst.server.tomcat.core.internal.xml.server40");
Server publishedServer = (Server) factory.loadDocument(newInputStream);
ServerInstance publishedInstance = new ServerInstance(publishedServer, null, null);
IPath contextPath = null;
if (autoDeployDir.isAbsolute()) {
contextPath = autoDeployDir;
} else {
contextPath = baseDir.append(autoDeployDir);
}
File contextDir = contextPath.toFile();
if (!contextDir.exists()) {
contextDir.mkdirs();
}
Context context = publishedInstance.createContext(-1);
// $NON-NLS-1$
context.setReloadable("true");
final String moduleName = module.getName();
final String requiredSuffix = ProjectUtil.getRequiredSuffix(module.getProject());
String contextName = moduleName;
if (!moduleName.endsWith(requiredSuffix)) {
contextName = moduleName + requiredSuffix;
}
// $NON-NLS-1$
context.setSource("org.eclipse.jst.jee.server:" + contextName);
if (// $NON-NLS-1$
Boolean.valueOf(context.getAttributeValue("antiResourceLocking")).booleanValue()) {
// $NON-NLS-1$ //$NON-NLS-2$
context.setAttributeValue("antiResourceLocking", "false");
}
// $NON-NLS-1$
File contextFile = new File(contextDir, contextName + ".xml");
if (!LiferayTomcatUtil.isExtProjectContext(context)) {
// If requested, remove path attribute
if (noPath) {
// $NON-NLS-1$
context.removeAttribute("path");
}
// need to fix the doc base to contain entire path to help autoDeployer for Liferay
context.setDocBase(deployDir.toOSString());
// context.setAttributeValue("antiJARLocking", "true");
// check to see if we need to move from conf folder
// IPath existingContextPath = confDir.append("Catalina/localhost").append(contextFile.getName());
// if (existingContextPath.toFile().exists()) {
// existingContextPath.toFile().delete();
// }
DocumentBuilder builder = XMLUtil.getDocumentBuilder();
Document contextDoc = builder.newDocument();
contextDoc.appendChild(contextDoc.importNode(context.getElementNode(), true));
XMLUtil.save(contextFile.getAbsolutePath(), contextDoc);
}
} catch (Exception e) {
// confDir.toOSString() + ": " + e.getMessage());
return new Status(IStatus.ERROR, TomcatPlugin.PLUGIN_ID, 0, NLS.bind(Messages.errorPublishConfiguration, new String[] { e.getLocalizedMessage() }), e);
} finally {
// monitor.done();
}
return Status.OK_STATUS;
}
use of org.kie.dmn.model.v1_1.Context in project liferay-ide by liferay.
the class LiferayTomcatUtil method loadContextFile.
public static Context loadContextFile(File contextFile) {
Context context = null;
if (contextFile != null && contextFile.exists()) {
try (InputStream fis = Files.newInputStream(contextFile.toPath())) {
Factory factory = new Factory();
// $NON-NLS-1$
factory.setPackageName("org.eclipse.jst.server.tomcat.core.internal.xml.server40");
context = (Context) factory.loadDocument(fis);
if (context != null) {
String path = context.getPath();
// If path attribute is not set, derive from file name
if (path == null) {
String fileName = contextFile.getName();
// $NON-NLS-1$
path = fileName.substring(0, fileName.length() - ".xml".length());
if (// $NON-NLS-1$
"ROOT".equals(path))
path = StringPool.EMPTY;
context.setPath(StringPool.FORWARD_SLASH + path);
}
}
} catch (Exception e) {
// may be a spurious xml file in the host dir?
}
}
return context;
}
use of org.kie.dmn.model.v1_1.Context in project bmoth by hhu-stups.
the class Issue59Test method testIssue59JustInvariant.
@Test
public void testIssue59JustInvariant() {
Context ctx = new Context();
Solver s = ctx.mkSolver();
String formula = "x**2 = x*x & #x.({x} \\/ {1,2} = {1,2})";
BoolExpr combinedConstraint = translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
use of org.kie.dmn.model.v1_1.Context in project bmoth by hhu-stups.
the class Issue59Test method testIssue59JustInvariant2.
@Test
public void testIssue59JustInvariant2() {
Context ctx = new Context();
Solver s = ctx.mkSolver();
String formula = "x**2 = x*x";
BoolExpr combinedConstraint = translatePredicate(formula, ctx);
s.add(combinedConstraint);
Status check = s.check();
assertEquals(Status.SATISFIABLE, check);
}
Aggregations