use of pcgen.base.format.StringManager in project pcgen by PCGen.
the class FactLstTest method setUp.
@Override
public void setUp() throws PersistenceLayerException, URISyntaxException {
TokenRegistration.clearTokens();
super.setUp();
FactDefinition fd = new FactDefinition();
fd.setName("DOMAIN.Possibility");
fd.setFactName("Possibility");
fd.setUsableLocation(Domain.class);
fd.setFormatManager(new StringManager());
fd.setVisibility(Visibility.HIDDEN);
primaryContext.getReferenceContext().importObject(fd);
secondaryContext.getReferenceContext().importObject(fd);
SourceFileLoader.processFactDefinitions(primaryContext);
SourceFileLoader.processFactDefinitions(secondaryContext);
}
use of pcgen.base.format.StringManager in project pcgen by PCGen.
the class FactSetLstTest method setUp.
@Override
public void setUp() throws PersistenceLayerException, URISyntaxException {
TokenRegistration.clearTokens();
super.setUp();
FactSetDefinition fd = new FactSetDefinition();
fd.setName("DEITY.Possibility");
fd.setFactSetName("Possibility");
fd.setUsableLocation(Domain.class);
fd.setFormatManager(new StringManager());
fd.setVisibility(Visibility.HIDDEN);
primaryContext.getReferenceContext().importObject(fd);
secondaryContext.getReferenceContext().importObject(fd);
SourceFileLoader.processFactDefinitions(primaryContext);
SourceFileLoader.processFactDefinitions(secondaryContext);
}
use of pcgen.base.format.StringManager in project pcgen by PCGen.
the class TableLoaderTest method testIndependence.
@Test
public void testIndependence() {
try {
loader.loadLstString(context, uri, "STARTTABLE:A\n\n,,,\n" + "Name,Value,\n\n,,,\n" + "STRING,NUMBER,,\n\n,,,\n\n" + "This,1\n\n" + "\"That\",\"2\"\n" + "ENDTABLE:A\n" + "#What comments?\n,,,\n" + "STARTTABLE:B\n\n,,,\n" + "Name,Value,\n\n,,,\n" + "STRING,NUMBER,,\n\n,,,\n\n" + "\"The \"\"Other\"\"\",\"3\"\n,,,\n\n" + "ENDTABLE:B\n");
DataTable a = context.getReferenceContext().silentlyGetConstructedCDOMObject(DataTable.class, "A");
DataTable b = context.getReferenceContext().silentlyGetConstructedCDOMObject(DataTable.class, "B");
assertEquals(2, a.getColumnCount());
assertEquals(new StringManager(), a.getFormat(0));
assertEquals(new NumberManager(), a.getFormat(1));
assertEquals("This", a.get("Name", 0));
assertEquals("That", a.get("Name", 1));
assertEquals("The \"Other\"", b.get("Name", 0));
assertEquals(1, a.get("Value", 0));
assertEquals(2, a.get("Value", 1));
assertEquals(3, b.get("Value", 0));
} catch (PersistenceLayerException e) {
fail("Did not Expect Failure: " + e.getLocalizedMessage());
}
}
use of pcgen.base.format.StringManager in project pcgen by PCGen.
the class TableLoaderTest method testDuplicateIndependence.
@Test
public void testDuplicateIndependence() {
try {
loader.loadLstString(context, uri, "STARTTABLE:A\n\n,,,\n" + "Name,Value,\n\n,,,\n" + "STRING,NUMBER,,\n\n,,,\n\n" + "This,1\n\n" + "\"That\",\"2\"\n" + "ENDTABLE:A\n" + "#What comments?\n,,,\n" + "STARTTABLE:A\n\n,,,\n" + "Name,Value,\n\n,,,\n" + "STRING,NUMBER,,\n\n,,,\n\n" + "\"The \"\"Other\"\"\",\"3\"\n,,,\n\n" + "ENDTABLE:A\n");
DataTable a = context.getReferenceContext().silentlyGetConstructedCDOMObject(DataTable.class, "A");
assertEquals(2, a.getColumnCount());
assertEquals(new StringManager(), a.getFormat(0));
assertEquals(new NumberManager(), a.getFormat(1));
assertEquals("This", a.get("Name", 0));
assertEquals("That", a.get("Name", 1));
assertEquals(1, a.get("Value", 0));
assertEquals(2, a.get("Value", 1));
context.getReferenceContext().forget(a);
DataTable b = context.getReferenceContext().silentlyGetConstructedCDOMObject(DataTable.class, "A");
assertEquals("The \"Other\"", b.get("Name", 0));
assertEquals(3, b.get("Value", 0));
} catch (PersistenceLayerException e) {
fail("Did not Expect Failure: " + e.getLocalizedMessage());
}
}
Aggregations