Ejemplo n.º 1
0
  public void optionTablesOfx() throws FileNotFoundException, UtilsConfigurationException {
    Aht sldStyles =
        JaxbUtil.loadJAXB(
            seedUtil.getExtractName(DataSource.ide, DefaultGeoJsfSldStyle.class.getSimpleName()),
            Aht.class);
    Aht sldTypes =
        JaxbUtil.loadJAXB(
            seedUtil.getExtractName(DataSource.ide, DefaultGeoJsfSldType.class.getSimpleName()),
            Aht.class);

    table(
        sldStyles,
        null,
        "geojsf/sld/style",
        "src/main/resources/ofx.geojsf/geojsf/sld/table/style.xml",
        15,
        20,
        30);
    table(
        sldTypes,
        null,
        "geojsf/sld/type",
        "src/main/resources/ofx.geojsf/geojsf/sld/table/type.xml",
        15,
        20,
        30);
  }
Ejemplo n.º 2
0
  private void test(boolean saveReference)
      throws FileNotFoundException, OfxInternalProcessingException {
    logger.debug(fTest.getAbsolutePath());
    String wikiTxt = StringIO.loadTxt(fTest);

    Section section = wikiInline.toOfx(wikiTxt);
    if (saveReference) {
      JaxbUtil.save(fRef, section, true);
    } else {
      Section sectionRef = (Section) JaxbUtil.loadJAXB(fRef.getAbsolutePath(), Section.class);
      Assert.assertEquals(JaxbUtil.toString(sectionRef), JaxbUtil.toString(section));
    }
  }
 @Test
 public void testOfx() throws FileNotFoundException, UtilsConfigurationException {
   Table actual = fOfx.toOfx(xmlStatus);
   saveXml(actual, fXml, false);
   Table expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), Table.class);
   assertJaxbEquals(expected, actual);
 }
Ejemplo n.º 4
0
  public static void main(String[] args)
      throws FileNotFoundException, OfxConfigurationException, OfxInternalProcessingException {
    LoggerInit loggerInit = new LoggerInit("log4j.xml");
    loggerInit.addAltPath("src/test/resources/config");
    loggerInit.init();
    JaxbUtil.setNsPrefixMapper(new OfxNsPrefixMapper());

    boolean saveReference = true;
    int id = -1;
    int index = 0;

    TestWikiInlineProcessor.initCmp();
    for (Object[] o : TestWikiInlineProcessor.initFileNames()) {
      File fTest = (File) o[0];

      TestWikiInlineProcessor test = new TestWikiInlineProcessor(fTest);
      test.init();
      logger.trace(id + " " + index);
      if (id < 0 | id == index) {
        test.test(saveReference);
      }
      test.close();
      index++;
    }
  }
Ejemplo n.º 5
0
  @Override
  protected void setAxis(Axis ofxAxis, AxisOrientation axisOrientation) {
    logger.info("Setting axis");
    JaxbUtil.trace(ofxAxis);
    ValueAxis axis = null;
    switch (OfxChartTypeResolver.getAxisType(ofxAxis.getAxisType())) {
      case Number:
        axis = AxisFactory.createNumberAxis(ofxAxis);
        break;
      case Date:
        axis = AxisFactory.createPeriodAxis(ofxAxis);
        break;
      default:
        logger.warn("You should specify a type, defaulting to number");
        axis = new NumberAxis();
        AxisFactory.labelAxisAxis(axis, ofxAxis);
    }

    if (axis != null) {
      XYPlot plot = (XYPlot) chart.getPlot();
      switch (AxisOrientation.valueOf(ofxAxis.getCode())) {
        case domain:
          plot.setDomainAxis(axis);
          break;
        case range0:
          plot.setRangeAxis(axis);
          break;
        default:
          logger.warn("NYI");
      }
    }
  }
Ejemplo n.º 6
0
  public static Configuration init() {
    AbstractAhtUtilTest.setfTarget(new File("target"));

    LoggerInit loggerInit = new LoggerInit("log4j.xml");
    loggerInit.addAltPath("config.ahtutils-util.test");
    loggerInit.init();

    JaxbUtil.setNsPrefixMapper(new AhtUtilsNsPrefixMapper());

    try {
      String cfn = ExlpCentralConfigPointer.getFile("utils", "util").getAbsolutePath();
      ConfigLoader.add(cfn);
      logger.info("Using additional config in: " + cfn);
    } catch (ExlpConfigurationException e) {
      logger.debug(
          "No additional "
              + ExlpCentralConfigPointer.class.getSimpleName()
              + " because "
              + e.getMessage());
    }

    Configuration config = ConfigLoader.init();

    logger.debug("Config and Logger initialized");
    return config;
  }
Ejemplo n.º 7
0
  public static void main(String args[]) throws Exception {
    Configuration config = GeoJsfDocTestBootstrap.init();

    config.setProperty(UtilsDocumentation.keyTranslationFile, "msg.geojsf/doc/ofx.xml");
    config.setProperty(UtilsDocumentation.keyBaseLatexDir, "src/main/latex/common");
    config.setProperty(UtilsDocumentation.keyBaseOfxDir, "src/main/resources/ofx.geojsf");

    String dbSeedFile = config.getString("db.seed");
    logger.debug("Using seed: " + dbSeedFile);
    Db dbSeed = JaxbUtil.loadJAXB(dbSeedFile, Db.class);

    Translations translations =
        JaxbUtil.loadJAXB(
            config.getString(UtilsDocumentation.keyTranslationFile), Translations.class);

    GeoJsfOfxDocumentation ofxDocumentan = new GeoJsfOfxDocumentation(config, dbSeed, translations);
    ofxDocumentan.optionTablesOfx();
  }
  @BeforeClass
  public static void initFiles() throws FileNotFoundException, ConfigurationException {
    fXml = new File(rootDir, "tableStatus.xml");
    fTxt = new File(rootDir, "tableStatus.tex");

    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
    config = builder.getConfiguration(false);
    config.setProperty(UtilsDocumentation.keyBaseLatexDir, "target");

    translations = JaxbUtil.loadJAXB("data/xml/dummyTranslations.xml", Translations.class);
  }
Ejemplo n.º 9
0
  private void table(Aht athStatus, Aht ahtParents, String srcXml, String dstXml, int... colWidths)
      throws UtilsConfigurationException {
    try {
      logger.info(srcXml);
      OfxStatusTableFactory fOfx = new OfxStatusTableFactory(config, langs, translations);
      fOfx.setColWidths(colWidths);

      if (ahtParents != null) {
        fOfx.activateParents(ahtParents);
      }
      //			fOfx.renderColumn(Code.icon, withIcon);

      Table table = fOfx.buildLatexTable(srcXml.replaceAll("/", "."), athStatus);
      JaxbUtil.save(new File(dstXml), table, true);
    } catch (OfxAuthoringException e) {
      throw new UtilsConfigurationException(e.getMessage());
    }
  }
Ejemplo n.º 10
0
  public static void main(String args[]) throws Exception {
    JaxbUtil.setNsPrefixMapper(new OtrCastNsPrefixMapper());

    UtilsCliOption uOption =
        new UtilsCliOption(
            de.kisner.otrcast.api.Version.class.getPackage().getImplementationVersion());
    uOption.setLog4jPaths("otrcast-app/config");

    OtrCastClient otrMc = new OtrCastClient(uOption);
    try {
      otrMc.parseArguments(args);
    } catch (ParseException e) {
      logger.error(e.getMessage());
      uOption.help();
    } catch (OtrConfigurationException e) {
      logger.error(e.getMessage());
      uOption.help();
    } catch (UtilsProcessingException e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 11
0
  public static Configuration init(String configFile) {
    LoggerInit loggerInit = new LoggerInit("log4j.xml");
    loggerInit.addAltPath("config.ofx-util.test");
    loggerInit.init();
    JaxbUtil.setNsPrefixMapper(new OfxNsPrefixMapper());

    try {
      String cfn = ExlpCentralConfigPointer.getFile("ofx", "core").getAbsolutePath();
      ConfigLoader.add(cfn);
      logger.info("Using additional config in: " + cfn);
    } catch (ExlpConfigurationException e) {
      logger.warn(
          "No additional "
              + ExlpCentralConfigPointer.class.getSimpleName()
              + ": "
              + e.getMessage());
    }
    ConfigLoader.add(configFile);
    Configuration config = ConfigLoader.init();
    logger.debug("Config and Logger initialized");

    return config;
  }
Ejemplo n.º 12
0
 @Test
 public void xml() throws FileNotFoundException {
   Width actual = create(true);
   Width expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), Width.class);
   assertJaxbEquals(expected, actual);
 }
Ejemplo n.º 13
0
 @Test
 public void xmlTest() throws FileNotFoundException {
   Peer actual = create(true);
   Peer expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), Peer.class);
   assertJaxbEquals(expected, actual);
 }
Ejemplo n.º 14
0
 @Test
 public void testXml() throws FileNotFoundException {
   Type actual = create(true);
   Type expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), Type.class);
   assertJaxbEquals(expected, actual);
 }
Ejemplo n.º 15
0
 @Test
 public void testAclContainer() throws FileNotFoundException {
   Piece actual = create(true);
   Piece expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), Piece.class);
   assertJaxbEquals(expected, actual);
 }
Ejemplo n.º 16
0
 @Test
 public void testXml() throws FileNotFoundException {
   Capabilities actual = create(true);
   Capabilities expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), Capabilities.class);
   assertJaxbEquals(expected, actual);
 }
Ejemplo n.º 17
0
 @Test
 public void testAuth() throws FileNotFoundException {
   Paragraph actual = create();
   Paragraph expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), Paragraph.class);
   assertJaxbEquals(expected, actual);
 }
Ejemplo n.º 18
0
 @Test
 public void xml() throws FileNotFoundException {
   PubDate actual = create();
   PubDate expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), PubDate.class);
   assertJaxbEquals(expected, actual);
 }
 @BeforeClass
 public static void initPrefixMapper() {
   JaxbUtil.setNsPrefixMapper(new AhtUtilsNsPrefixMapper());
 }
Ejemplo n.º 20
0
 @BeforeClass
 public static void initCmp() throws FileNotFoundException {
   String fNameCmp = "src/test/resources/config/cmp/wiki.xml";
   cmp = (Cmp) JaxbUtil.loadJAXB(fNameCmp, Cmp.class);
 }
Ejemplo n.º 21
0
 @Test
 public void testAclContainer() throws FileNotFoundException {
   View actual = create();
   View expected = JaxbUtil.loadJAXB(fXml.getAbsolutePath(), View.class);
   assertJaxbEquals(expected, actual);
 }