Search in sources :

Example 1 with SubstitutionScheduleData

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

the class IndiwareDemoTest method setUp.

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

Example 2 with SubstitutionScheduleData

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

the class IphisDemoTest method setUp.

@Before
public void setUp() throws JSONException {
    changes = new JSONArray(readResource("/iphis/changes.json"));
    teachers = new JSONArray(readResource("/iphis/teachers.json"));
    courses = new JSONArray(readResource("/iphis/grades.json"));
    messages = new JSONArray(readResource("/iphis/messages.json"));
    SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    scheduleData.setData(new JSONObject());
    parser = new IphisParser(scheduleData, null);
    DateTimeUtils.setCurrentMillisFixed(new LocalDate(2017, 9, 29).toDateTimeAtStartOfDay().getMillis());
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) LocalDate(org.joda.time.LocalDate) Before(org.junit.Before)

Example 3 with SubstitutionScheduleData

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

the class LoginHandlerTest method getSubstitutionScheduleData.

@NotNull
private static SubstitutionScheduleData getSubstitutionScheduleData(JSONObject login) throws JSONException {
    SubstitutionScheduleData data = new SubstitutionScheduleData();
    JSONObject data1 = new JSONObject();
    data1.put("login", login);
    data.setData(data1);
    return data;
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with SubstitutionScheduleData

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

the class Sample method main.

public static void main(String[] args) throws JSONException, IOException, CredentialInvalidException {
    SubstitutionScheduleData data = new SubstitutionScheduleData();
    data.setType(SubstitutionSchedule.Type.STUDENT);
    data.setApi("untis-monitor");
    data.setAuthenticationData(new NoAuthenticationData());
    data.setData(new JSONObject("{\n" + "         \"classes\": [\n" + "           \"05a\",\"05b\",\"05c\",\"05d\",\"05e\",\"05f\",\"05g\",\n" + "           \"06a\",\"06b\",\"06c\",\"06d\",\"06e\",\"06f\",\"06g\",\n" + "           \"07a\",\"07b\",\"07c\",\"07d\",\"07e\",\"07f\",\"07g\",\n" + "           \"08a\",\"08b\",\"08c\",\"08d\",\"08e\",\"08f\",\"08g\",\n" + "           \"09a\",\"09b\",\"09c\",\"09d\",\"09e\",\"09f\",\"09g\",\n" + "           \"Ea\",\"Eb\",\"Ec\",\"Ed\",\"Ee\",\"Ef\",\n" + "           \"Q1a\",\"Q1b\",\"Q1c\",\"Q1d\",\"Q1e\",\"Q1f\",\"Q1g\",\"Q1h\",\"Q1i\",\"Q1j\",\n" + "           \"Q2a\",\"Q2b\",\"Q2c\",\"Q2d\",\"Q2e\",\"Q2f\",\"Q2g\",\"Q2h\",\"Q2i\",\"Q2j\" \n" + "        ],\n" + "         \"class_in_extra_line\": true,\n" + "         \"website\": \"http://vertretung.lornsenschule.de/schueler/subst_001.htm\",\n" + "         \"stand_links\": true,\n" + "         \"urls\": [\n" + "           {\n" + "             \"following\": false,\n" + "             \"url\": \"http://vertretung.lornsenschule.de/schueler/f1/subst_001.htm\" \n" + "          },\n" + "           {\n" + "             \"following\": false,\n" + "             \"url\": \"http://vertretung.lornsenschule.de/schueler/f2/subst_001.htm\" \n" + "          } \n" + "        ],\n" + "         \"encoding\": \"ISO-8859-1\",\n" + "         \"columns\": [\n" + "           \"lesson\",\"type\",\"subject\",\"previousSubject\",\"room\",\"desc\" \n" + "        ] \n" + "      }"));
    data.getAdditionalInfos().add("winter-sh");
    SubstitutionSchedule schedule = ParserUtil.parseSubstitutionSchedule(data);
    System.out.println(schedule);
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) NoAuthenticationData(me.vertretungsplan.objects.authentication.NoAuthenticationData) SubstitutionSchedule(me.vertretungsplan.objects.SubstitutionSchedule)

Example 5 with SubstitutionScheduleData

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

the class ColorProviderTest method testCustomName.

@Test
public void testCustomName() throws JSONException {
    final SubstitutionScheduleData scheduleData = new SubstitutionScheduleData();
    final JSONObject data = new JSONObject();
    final JSONObject colors = new JSONObject();
    final JSONArray values = new JSONArray();
    values.put("Vertretung");
    colors.put("red", values);
    data.put("colors", colors);
    scheduleData.setData(data);
    final ColorProvider provider = new ColorProvider(scheduleData);
    assertEquals("#F44336", provider.getColor("Vertretung"));
}
Also used : SubstitutionScheduleData(me.vertretungsplan.objects.SubstitutionScheduleData) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) 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