@Test public void testWidNoImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-noimports.wid"))); }
@Override public void checkExit(int status) { super.checkExit(status); throw new ShouldHavePrevented("The security policy should have prevented the call to System.exit()"); } }
@Before public void before() { try { String enginePolicy = getResouce("/policy/engine.policy"); String kiePolicy = getResouce("/policy/kie.policy"); System.setProperty("java.security.policy", enginePolicy); System.setProperty("kie.security.policy", kiePolicy); tsm = new TestSecurityManager(); System.setSecurityManager(tsm); } catch (Exception e) { fail("unable to initiate security manager : " + e.getMessage()); } }
List<Map<String, Object>> result = (List<Map<String, Object>>) WidMVELEvaluator.eval(content); for (Map<String, Object> wid: result) { wid.put("path", parentPath + "/" + file);
public DataSource getDataSource() { if (dataSource == null && dataSourceJndiName != null) { dataSource = (DataSource) JndiUtil.lookup(dataSourceJndiName, DataSource.class); } return dataSource; }
/** * Tells whether the given array contains the specified element. * * @param o element whose presence in the array is to be tested. * @return <tt>true</tt> if the array contains the specified element. */ public static boolean contains(Object[] a, Object o) { return indexOf(a, o) != -1; } }
/** * Acquires a permit from this semaphore, blocking until one is available, or the thread is * {@link Thread#interrupt interrupted}. * * @throws InterruptedException if the current thread is interrupted * @see Thread#interrupt */ public void acquire() throws InterruptedException { acquire(1); }
/** * Releases a permit, returning it to the semaphore. */ public void release() { release(1); }
public static Object eval(final String expression) { ExpressionCompiler compiler = new ExpressionCompiler(getRevisedExpression(expression), WID_PARSER_CONTEXT); if(KiePolicyHelper.isPolicyEnabled()) { return AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { return MVEL.executeExpression(compiler.compile(), new HashMap()); } }, KiePolicyHelper.getAccessContext()); } else { return MVEL.executeExpression(compiler.compile(), new HashMap()); } }
@Test public void testWidCustomDataType() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-customdatatype.wid"))); }
protected synchronized Repository getRepository() { if (repository == null) { repository = (Repository) JndiUtil.lookup(jndiName, Repository.class); } return repository; }
/** * Tells whether the given array contains the specified element. * * @param o element whose presence in the array is to be tested. * @return <tt>true</tt> if the array contains the specified element. */ public static boolean contains(Object[] a, Object o) { return indexOf(a, o) != -1; } }
/** * Acquires a permit from this semaphore, blocking until one is available, or the thread is * {@link Thread#interrupt interrupted}. * * @throws InterruptedException if the current thread is interrupted * @see Thread#interrupt */ public void acquire() throws InterruptedException { acquire(1); }
/** * Releases a permit, returning it to the semaphore. */ public void release() { release(1); }
@Test public void testWidBackwardsCompatPkgImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-backwardscompatpkgimport.wid"))); }
protected synchronized Repository getRepository() { if (repository == null) { repository = (Repository) JndiUtil.lookup(jndiName, Repository.class); } return repository; }
@Test public void testWidBackwardsCompatImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-backwardscompat.wid"))); }
public DataSource getDataSource() { if (dataSource == null && dataSourceJndiName != null) { dataSource = (DataSource) JndiUtil.lookup(dataSourceJndiName, DataSource.class); } return dataSource; }
@Test public void testWidBackwardsCompatMixedAndMissingImports() throws Exception { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-backwardscompatmixedandmissingimports.wid"))); }
@Test public void testWidCustomDataTypeNoImport() { try { assertCorrectWids(WidMVELEvaluator.eval(getResouceContent("/wids/test-customdatatypenoimport.wid"))); } catch(Throwable t) { assertTrue(t instanceof CompileException); } }