Search in sources :

Example 6 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class ColorProviderTest method testPreconfigured.

@Test
public void testPreconfigured() {
    final SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    scheduleData.setData(new JSONObject());
    final ColorProvider provider = new ColorProvider(scheduleData);
    assertEquals("#2196F3", provider.getColor("Vertretung"));
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) Test(org.junit.Test)

Example 7 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class DaVinciDemoTest method setUp.

@Before
public void setUp() throws JSONException {
    htmlSingle = readResource("/davinci/single.html");
    htmlSingleDaVinci5 = readResource("/davinci/single_5.html");
    htmlDayIndex = readResource("/davinci/dayIndex.html");
    htmlMonth = readResource("/davinci/month.html");
    htmlClasses = readResource("/davinci/classes.html");
    SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    scheduleData.setData(new JSONObject());
    parser = new DaVinciParser(scheduleData, null);
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) Before(org.junit.Before)

Example 8 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class ESchoolDemoTest method setUp.

@Before
public void setUp() throws JSONException {
    html = readResource("/eschool/eschool.html");
    SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    scheduleData.setData(new JSONObject());
    parser = new ESchoolParser(scheduleData, null);
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) Before(org.junit.Before)

Example 9 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class IndiwareDemoTest method testHTMLEmbeddedContentSelector.

@Test
public void testHTMLEmbeddedContentSelector() throws JSONException, IOException {
    String html = readResource("/indiware/indiware_embedded.html");
    SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    final JSONObject data = new JSONObject();
    data.put("embeddedContentSelector", ".items-leading .dd-article > table > tbody > tr > td");
    scheduleData.setData(data);
    IndiwareParser parser = new IndiwareParser(scheduleData, null);
    SubstitutionSchedule schedule = new SubstitutionSchedule();
    parser.parseIndiwarePage(schedule, html);
    assertEquals(2, schedule.getDays().size());
    assertEquals(new LocalDate(2017, 3, 10), schedule.getDays().get(0).getDate());
    assertEquals(new LocalDate(2017, 3, 13), schedule.getDays().get(1).getDate());
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) SubstitutionSchedule(me.vertretungsplan.objects.SubstitutionSchedule) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 10 with SubstitutionScheduleData

use of me.vertretungsplan.objects.SubstitutionScheduleData in project substitution-schedule-parser by vertretungsplanme.

the class IndiwareMobileDemoTest method demoTest.

@Test
public void demoTest() throws IOException, JSONException {
    Document doc = Jsoup.parse(readResource("/indiware-mobile/indiware-mobile.xml"), "", Parser.xmlParser());
    SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    scheduleData.setType(SubstitutionSchedule.Type.STUDENT);
    SubstitutionScheduleDay day = IndiwareMobileParser.parseDay(doc, new ColorProvider(), scheduleData);
    assertEquals(new LocalDate(2017, 6, 21), day.getDate());
    assertEquals(new LocalDateTime(2017, 6, 20, 10, 28), day.getLastChange());
    assertEquals(192, day.getSubstitutions().size());
}
Also used : LocalDateTime(org.joda.time.LocalDateTime) SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) SubstitutionScheduleDay(me.vertretungsplan.objects.SubstitutionScheduleDay) Document(org.jsoup.nodes.Document) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Aggregations

SubstitutionScheduleData (me.vertretungsplan.objects.SubstitutionScheduleData)16 JSONObject (org.json.JSONObject)15 Before (org.junit.Before)9 JSONArray (org.json.JSONArray)6 Test (org.junit.Test)5 LocalDate (org.joda.time.LocalDate)4 SubstitutionSchedule (me.vertretungsplan.objects.SubstitutionSchedule)2 SubstitutionScheduleDay (me.vertretungsplan.objects.SubstitutionScheduleDay)1 NoAuthenticationData (me.vertretungsplan.objects.authentication.NoAuthenticationData)1 NotNull (org.jetbrains.annotations.NotNull)1 LocalDateTime (org.joda.time.LocalDateTime)1 Document (org.jsoup.nodes.Document)1