Codota Logo
MethodExecutor
Code IndexAdd Codota to your IDE (free)

How to use
MethodExecutor
in
org.drools.ide.common.server.testscenarios.executors

Best Java code snippets using org.drools.ide.common.server.testscenarios.executors.MethodExecutor (Showing top 14 results out of 315)

  • Common ways to obtain MethodExecutor
private void myMethod () {
MethodExecutor m =
  • Codota IconMap populatedData;new MethodExecutor(populatedData)
  • Smart code suggestions by Codota
}
origin: org.chtijbug.drools/droolsjbpm-ide-common

public TestScenarioWorkingMemoryWrapper(InternalWorkingMemory workingMemory,
                    final TypeResolver resolver,
                    final ClassLoader classLoader,
                    Map<String, Object> populatedData,
                    Map<String, Object> globalData) {
  this.workingMemory = workingMemory;
  this.populatedData = populatedData;
  this.methodExecutor = new MethodExecutor( populatedData );
  this.classLoader = classLoader;
  factVerifier = initFactVerifier( resolver,
                   globalData );
}
origin: org.chtijbug.drools/droolsjbpm-ide-common

public void executeMethod(CallMethod callMethod) {
  methodExecutor.executeMethod( callMethod );
}
origin: org.drools/droolsjbpm-ide-common

public Object executeMethod(CallMethod callMethod) {
  Map<String, Object> vars = initVars(callMethod);
  eval(
      build(callMethod, vars),
      vars);
  return populatedData.get(callMethod.getVariable());
}
origin: org.drools/droolsjbpm-ide-common

@Test
public void testCallMethodNoArgumentOnFact() throws Exception {
  HashMap<String, Object> populatedData = new HashMap<String, Object>();
  MethodExecutor methodExecutor = new MethodExecutor(populatedData);
  Cheesery listChesse = new Cheesery();
  listChesse.setTotalAmount(1000);
  populatedData.put("cheese",
      listChesse);
  CallMethod mCall = new CallMethod();
  mCall.setVariable("cheese");
  mCall.setMethodName("setTotalAmountToZero");
  methodExecutor.executeMethod(mCall);
  assertTrue(listChesse.getTotalAmount() == 0);
}
origin: org.drools/droolsjbpm-ide-common

private String build(CallMethod callMethod, Map<String, Object> vars) {
  StringBuilder methodCallAsSting = new StringBuilder();
  methodCallAsSting.append("__fact__." + callMethod.getMethodName());
  methodCallAsSting.append("(");
  for (int i = 0; i < callMethod.getCallFieldValues().length; i++) {
    CallFieldValue field = callMethod.getCallFieldValues()[i];
    if (field.hasValue()) {
      String variableId = String.format("__val%d__", i);
      vars.put(
          variableId,
          getFieldValue(field));
      methodCallAsSting.append(variableId);
      if (isThisTheLastVariable(callMethod, i)) {
        methodCallAsSting.append(",");
      }
    }
  }
  methodCallAsSting.append(")");
  return methodCallAsSting.toString();
}
origin: org.drools/droolsjbpm-ide-common

private Object getFieldValue(CallFieldValue field) {
  Object val;
  if (isTheValueAPreviouslyDefinedObject(field)) {
    // eval the val into existence
    val = populatedData.get(field.value.substring(1));
  } else {
    val = field.value;
  }
  return val;
}
origin: org.drools/droolsjbpm-ide-common

@Test
public void testCallMethodOnStandardArgumentOnFact() throws Exception {
  HashMap<String, Object> populatedData = new HashMap<String, Object>();
  MethodExecutor methodExecutor = new MethodExecutor(populatedData);
  Cheesery listChesse = new Cheesery();
  listChesse.setTotalAmount(1000);
  populatedData.put("cheese",
      listChesse);
  CallMethod mCall = new CallMethod();
  mCall.setVariable("cheese");
  mCall.setMethodName("addToTotalAmount");
  CallFieldValue field = new CallFieldValue();
  field.value = "5";
  mCall.addFieldValue(field);
  methodExecutor.executeMethod(mCall);
  assertTrue(listChesse.getTotalAmount() == 1005);
}
origin: org.chtijbug.drools/droolsjbpm-ide-common

private String build(CallMethod callMethod, Map<String, Object> vars) {
  StringBuilder methodCallAsSting = new StringBuilder();
  methodCallAsSting.append("__fact__." + callMethod.getMethodName());
  methodCallAsSting.append("(");
  for (int i = 0; i < callMethod.getCallFieldValues().length; i++) {
    CallFieldValue field = callMethod.getCallFieldValues()[i];
    if (field.hasValue()) {
      String variableId = String.format("__val%d__", i);
      vars.put(
          variableId,
          getFieldValue(field));
      methodCallAsSting.append(variableId);
      if (isThisTheLastVariable(callMethod, i)) {
        methodCallAsSting.append(",");
      }
    }
  }
  methodCallAsSting.append(")");
  return methodCallAsSting.toString();
}
origin: org.chtijbug.drools/droolsjbpm-ide-common

private Object getFieldValue(CallFieldValue field) {
  Object val;
  if (isTheValueAPreviouslyDefinedObject(field)) {
    // eval the val into existence
    val = populatedData.get(field.value.substring(1));
  } else {
    val = field.value;
  }
  return val;
}
origin: org.drools/droolsjbpm-ide-common

  @Test
  public void testCallMethodOnClassArgumentAndOnArgumentStandardOnFact() throws Exception {


    HashMap<String, Object> populatedData = new HashMap<String, Object>();
    MethodExecutor methodExecutor = new MethodExecutor(populatedData);

    Cheesery listChesse = new Cheesery();
    listChesse.setTotalAmount(1000);
    populatedData.put("cheese",
        listChesse);
    Cheesery.Maturity m = new Cheesery.Maturity("veryYoung");
    populatedData.put("m",
        m);
    CallMethod mCall = new CallMethod();
    mCall.setVariable("cheese");
    mCall.setMethodName("setAgeToMaturity");
    CallFieldValue field = new CallFieldValue();
    field.value = "=m";
    mCall.addFieldValue(field);
    CallFieldValue field2 = new CallFieldValue();
    field2.value = "veryold";
    mCall.addFieldValue(field2);

    methodExecutor.executeMethod(mCall);
    assertTrue(m.getAge().equals("veryold"));
  }
}
origin: org.chtijbug.drools/droolsjbpm-ide-common

public Object executeMethod(CallMethod callMethod) {
  Map<String, Object> vars = initVars(callMethod);
  eval(
      build(callMethod, vars),
      vars);
  return populatedData.get(callMethod.getVariable());
}
origin: org.drools/droolsjbpm-ide-common

public TestScenarioWorkingMemoryWrapper(InternalWorkingMemory workingMemory,
                    final TypeResolver resolver,
                    final ClassLoader classLoader,
                    Map<String, Object> populatedData,
                    Map<String, Object> globalData) {
  this.workingMemory = workingMemory;
  this.populatedData = populatedData;
  this.methodExecutor = new MethodExecutor( populatedData );
  this.classLoader = classLoader;
  factVerifier = initFactVerifier( resolver,
                   globalData );
}
origin: org.drools/droolsjbpm-ide-common

public void executeMethod(CallMethod callMethod) {
  methodExecutor.executeMethod( callMethod );
}
origin: org.drools/droolsjbpm-ide-common

@Test
public void testCallMethodOnClassArgumentOnFact() throws Exception {
  HashMap<String, Object> populatedData = new HashMap<String, Object>();
  MethodExecutor methodExecutor = new MethodExecutor(populatedData);
  Cheesery listChesse = new Cheesery();
  listChesse.setTotalAmount(1000);
  populatedData.put("cheese",
      listChesse);
  Cheesery.Maturity m = new Cheesery.Maturity();
  populatedData.put("m",
      m);
  CallMethod mCall = new CallMethod();
  mCall.setVariable("cheese");
  mCall.setMethodName("setGoodMaturity");
  CallFieldValue field = new CallFieldValue();
  field.value = "=m";
  mCall.addFieldValue(field);
  methodExecutor.executeMethod(mCall);
  assertTrue(listChesse.getMaturity().equals(m));
  assertTrue(listChesse.getMaturity() == m);
}
org.drools.ide.common.server.testscenarios.executorsMethodExecutor

Most used methods

  • <init>
  • executeMethod
  • build
  • getFieldValue
  • initVars
  • isTheValueAPreviouslyDefinedObject
  • isThisTheLastVariable

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • orElseThrow (Optional)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • Kernel (java.awt.image)
  • String (java.lang)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now