use of pcgen.rules.context.ConsolidatedListCommitStrategy in project pcgen by PCGen.
the class DropIntoContextFunctionTest method testBasic.
@Test
public void testBasic() {
VariableLibrary vl = getVariableLibrary();
LegalScope equipScope = getScopeLibrary().getScope("EQUIPMENT");
vl.assertLegalVariableID("LocalVar", equipScope, numberManager);
String formula = "dropIntoContext(\"EQUIPMENT\",\"EquipKey\",LocalVar)";
SimpleNode node = TestUtilities.doParse(formula);
SemanticsVisitor semanticsVisitor = new SemanticsVisitor();
FormulaSemantics semantics = generateFormulaSemantics(getFormulaManager(), getGlobalScope(), null);
semanticsVisitor.visit(node, semantics);
if (!semantics.isValid()) {
TestCase.fail("Expected Valid Formula: " + formula + " but was told: " + semantics.getReport());
}
isStatic(formula, node, false);
Equipment equip = new Equipment();
equip.setName("EquipKey");
ScopeInstance scopeInst = getInstanceFactory().get("EQUIPMENT", equip);
VariableID varID = vl.getVariableID(scopeInst, "LocalVar");
getVariableStore().put(varID, 2);
LoadContext context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
context.getReferenceContext().importObject(equip);
evaluatesTo(formula, node, 2, context);
Object rv = new ReconstructionVisitor().visit(node, new StringBuilder());
assertEquals(rv.toString(), formula);
}
use of pcgen.rules.context.ConsolidatedListCommitStrategy in project pcgen by PCGen.
the class AbstractPCClassLevelTokenTestCase method setUp.
@Override
@Before
public void setUp() throws PersistenceLayerException, URISyntaxException {
if (!classSetUpFired) {
classSetUp();
}
// Yea, this causes warnings...
TokenRegistration.register(getToken());
primaryContext = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
secondaryContext = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
primaryProf = primaryContext.getReferenceContext().constructCDOMObject(PCClass.class, "TestObj");
secondaryProf = secondaryContext.getReferenceContext().constructCDOMObject(PCClass.class, "TestObj");
primaryProf1 = primaryProf.getOriginalClassLevel(1);
primaryProf2 = primaryProf.getOriginalClassLevel(2);
primaryProf3 = primaryProf.getOriginalClassLevel(3);
secondaryProf1 = secondaryProf.getOriginalClassLevel(1);
secondaryProf2 = secondaryProf.getOriginalClassLevel(2);
secondaryProf3 = secondaryProf.getOriginalClassLevel(3);
}
use of pcgen.rules.context.ConsolidatedListCommitStrategy in project pcgen by PCGen.
the class SelectableTokenIntegrationTest method resetContext.
private void resetContext() {
URI testURI = testCampaign.getURI();
context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
context.setSourceURI(testURI);
context.setExtractURI(testURI);
cd = new FactDefinition();
cd.setDisplayName(PROP_1);
cd.setFormatManager(STRING_MGR);
cd.setName(PROP_1);
cd.setFactName(PROP_1);
cd.setUsableLocation(Domain.class);
cd.setVisibility(Visibility.DEFAULT);
}
use of pcgen.rules.context.ConsolidatedListCommitStrategy in project pcgen by PCGen.
the class AbilityListTokenTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
context.getReferenceContext().importObject(AbilityCategory.FEAT);
}
use of pcgen.rules.context.ConsolidatedListCommitStrategy in project pcgen by PCGen.
the class AddedBonusFacetTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
context = new RuntimeLoadContext(new RuntimeReferenceContext(), new ConsolidatedListCommitStrategy());
addBonus(Combat.class);
}
Aggregations