Search in sources :

Example 1 with QrzXmlService

use of uk.m0nom.qrz.QrzXmlService in project adif-processor by urbancamo.

the class AdifReaderTest method testAdifFLE.

@Test
public void testAdifFLE() throws Exception {
    AdiReader reader = new AdiReader();
    BufferedReader inputReader = resourceInput("adif/2021-01-09-Queen-Adelaides-Hill.adi");
    Optional<Adif3> result = reader.read(inputReader);
    // System.out.println(new File("tmp.txt").getAbsolutePath());
    YamlMapping config = Yaml.createYamlInput(new File("adif-processor.yaml")).readYamlMapping();
    if (result.isPresent()) {
        Adif3 log = result.get();
        Qsos qsos = new Qsos(log);
        assertThat(log.getHeader().getProgramId()).isEqualTo("FLE");
        ActivityDatabases summits = new ActivityDatabases();
        summits.loadData();
        QrzXmlService qrzXmlService = new QrzXmlService(null, null);
        if (!qrzXmlService.getSessionKey()) {
            System.err.println("Could not connect to QRZ.COM, continuing...");
        }
        TransformResults results = new TransformResults();
        Adif3RecordTransformer transformer = new CommentParsingAdifRecordTransformer(config, summits, qrzXmlService, control, results);
        int index = 1;
        for (Adif3Record rec : log.getRecords()) {
            transformer.transform(qsos, rec, index++);
        }
        assertThat(log.getRecords()).hasSize(16);
    }
}
Also used : Qsos(uk.m0nom.adif3.contacts.Qsos) TransformResults(uk.m0nom.adif3.transform.TransformResults) AdiReader(org.marsik.ham.adif.AdiReader) Adif3RecordTransformer(uk.m0nom.adif3.transform.Adif3RecordTransformer) Adif3(org.marsik.ham.adif.Adif3) Adif3Record(org.marsik.ham.adif.Adif3Record) BufferedReader(java.io.BufferedReader) YamlMapping(com.amihaiemil.eoyaml.YamlMapping) ActivityDatabases(uk.m0nom.activity.ActivityDatabases) QrzXmlService(uk.m0nom.qrz.QrzXmlService) File(java.io.File) CommentParsingAdifRecordTransformer(uk.m0nom.adif3.transform.CommentParsingAdifRecordTransformer) Test(org.junit.Test)

Aggregations

YamlMapping (com.amihaiemil.eoyaml.YamlMapping)1 BufferedReader (java.io.BufferedReader)1 File (java.io.File)1 Test (org.junit.Test)1 AdiReader (org.marsik.ham.adif.AdiReader)1 Adif3 (org.marsik.ham.adif.Adif3)1 Adif3Record (org.marsik.ham.adif.Adif3Record)1 ActivityDatabases (uk.m0nom.activity.ActivityDatabases)1 Qsos (uk.m0nom.adif3.contacts.Qsos)1 Adif3RecordTransformer (uk.m0nom.adif3.transform.Adif3RecordTransformer)1 CommentParsingAdifRecordTransformer (uk.m0nom.adif3.transform.CommentParsingAdifRecordTransformer)1 TransformResults (uk.m0nom.adif3.transform.TransformResults)1 QrzXmlService (uk.m0nom.qrz.QrzXmlService)1