mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 14:38:21 +01:00
API facade (#27)
*Create API facade * Refactor API tests * Implementation of the facade API and add tests for synchronization
This commit is contained in:
parent
c876d114e3
commit
1f5a03fba7
@ -56,6 +56,8 @@ dependencies {
|
|||||||
debugCompile 'com.amitshekhar.android:debug-db:1.0.1'
|
debugCompile 'com.amitshekhar.android:debug-db:1.0.1'
|
||||||
debugCompile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
|
debugCompile 'net.zetetic:android-database-sqlcipher:3.5.7@aar'
|
||||||
|
|
||||||
|
androidTestCompile 'org.mockito:mockito-android:2.10.0'
|
||||||
|
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
testCompile 'org.mockito:mockito-core:2.10.0'
|
testCompile 'org.mockito:mockito-core:2.10.0'
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package io.github.wulkanowy.services;
|
||||||
|
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class VulcanSynchronizationTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void syncNoLoginSessionSubjectTest() {
|
||||||
|
VulcanSynchronization vulcanSynchronization = new VulcanSynchronization(new LoginSession());
|
||||||
|
Assert.assertFalse(vulcanSynchronization.syncSubjectsAndGrades());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void syncNoLoginSessionGradeTest() {
|
||||||
|
VulcanSynchronization vulcanSynchronization = new VulcanSynchronization(new LoginSession());
|
||||||
|
Assert.assertFalse(vulcanSynchronization.syncGrades());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
package io.github.wulkanowy.services.synchronization;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
import io.github.wulkanowy.api.user.BasicInformation;
|
||||||
|
import io.github.wulkanowy.api.user.PersonalData;
|
||||||
|
import io.github.wulkanowy.dao.entities.Account;
|
||||||
|
import io.github.wulkanowy.dao.entities.AccountDao;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoMaster;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
|
import io.github.wulkanowy.security.CryptoException;
|
||||||
|
import io.github.wulkanowy.security.Safety;
|
||||||
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
|
import io.github.wulkanowy.services.synchronisation.AccountSynchronisation;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class AccountSynchronizationTest {
|
||||||
|
|
||||||
|
private static DaoSession daoSession;
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
private Context targetContext;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUpClass() {
|
||||||
|
|
||||||
|
DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(InstrumentationRegistry.getTargetContext(), "wulkanowyTest-database");
|
||||||
|
Database database = devOpenHelper.getWritableDb();
|
||||||
|
|
||||||
|
daoSession = new DaoMaster(database).newSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
context = InstrumentationRegistry.getContext();
|
||||||
|
targetContext = InstrumentationRegistry.getTargetContext();
|
||||||
|
|
||||||
|
daoSession.getAccountDao().deleteAll();
|
||||||
|
daoSession.clear();
|
||||||
|
|
||||||
|
setUserIdSharePreferences(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = IOException.class)
|
||||||
|
public void emptyUserIdTest() throws CryptoException, BadCredentialsException,
|
||||||
|
AccountPermissionException, IOException, LoginErrorException {
|
||||||
|
|
||||||
|
AccountSynchronisation accountSynchronisation = new AccountSynchronisation();
|
||||||
|
accountSynchronisation.loginCurrentUser(context, daoSession, new Vulcan());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loginCurrentUserTest() throws Exception {
|
||||||
|
AccountDao accountDao = daoSession.getAccountDao();
|
||||||
|
|
||||||
|
Safety safety = new Safety(context);
|
||||||
|
|
||||||
|
Long userId = accountDao.insert(new Account()
|
||||||
|
.setEmail("TEST@TEST")
|
||||||
|
.setPassword(safety.encrypt("TEST@TEST", "TEST"))
|
||||||
|
.setSymbol(""));
|
||||||
|
|
||||||
|
setUserIdSharePreferences(userId);
|
||||||
|
|
||||||
|
Vulcan vulcan = Mockito.mock(Vulcan.class);
|
||||||
|
Mockito.doNothing().when(vulcan).login("TEST@TEST", "TEST", "");
|
||||||
|
|
||||||
|
AccountSynchronisation accountSynchronisation = new AccountSynchronisation();
|
||||||
|
LoginSession loginSession = accountSynchronisation.loginCurrentUser(targetContext, daoSession, vulcan);
|
||||||
|
|
||||||
|
Assert.assertNotNull(loginSession);
|
||||||
|
Assert.assertEquals(loginSession.getUserId(), userId);
|
||||||
|
Assert.assertNotNull(loginSession.getDaoSession());
|
||||||
|
Assert.assertEquals(loginSession.getVulcan(), vulcan);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void loginNewUserTest() throws Exception {
|
||||||
|
PersonalData personalData = Mockito.mock(PersonalData.class);
|
||||||
|
Mockito.doReturn("NAME-TEST").when(personalData).getFirstAndLastName();
|
||||||
|
|
||||||
|
BasicInformation basicInformation = Mockito.mock(BasicInformation.class);
|
||||||
|
Mockito.doReturn(personalData).when(basicInformation).getPersonalData();
|
||||||
|
|
||||||
|
Vulcan vulcan = Mockito.mock(Vulcan.class);
|
||||||
|
Mockito.doNothing().when(vulcan).login("TEST@TEST", "TEST", "");
|
||||||
|
Mockito.doReturn(basicInformation).when(vulcan).getBasicInformation();
|
||||||
|
|
||||||
|
AccountSynchronisation accountSynchronisation = new AccountSynchronisation();
|
||||||
|
LoginSession loginSession = accountSynchronisation
|
||||||
|
.loginNewUser("TEST@TEST", "TEST", "", targetContext, daoSession, vulcan);
|
||||||
|
|
||||||
|
Long userId = targetContext.getSharedPreferences("LoginData", Context.MODE_PRIVATE).getLong("userId", 0);
|
||||||
|
|
||||||
|
Assert.assertNotNull(loginSession);
|
||||||
|
Assert.assertNotEquals(0, userId.longValue());
|
||||||
|
Assert.assertEquals(loginSession.getUserId(), userId);
|
||||||
|
Assert.assertNotNull(loginSession.getDaoSession());
|
||||||
|
Assert.assertEquals(loginSession.getVulcan(), vulcan);
|
||||||
|
|
||||||
|
Safety safety = new Safety(context);
|
||||||
|
Account account = daoSession.getAccountDao().load(userId);
|
||||||
|
|
||||||
|
Assert.assertNotNull(account);
|
||||||
|
Assert.assertEquals("TEST@TEST", account.getEmail());
|
||||||
|
Assert.assertEquals("NAME-TEST", account.getName());
|
||||||
|
Assert.assertEquals("TEST", safety.decrypt("TEST@TEST", account.getPassword()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void cleanUp() {
|
||||||
|
daoSession.getAccountDao().deleteAll();
|
||||||
|
daoSession.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUserIdSharePreferences(long id) {
|
||||||
|
SharedPreferences sharedPreferences = targetContext.getSharedPreferences("LoginData", Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putLong("userId", id);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package io.github.wulkanowy.services.synchronization;
|
||||||
|
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
|
import io.github.wulkanowy.api.grades.Grade;
|
||||||
|
import io.github.wulkanowy.api.grades.GradesList;
|
||||||
|
import io.github.wulkanowy.dao.entities.Account;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoMaster;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
|
import io.github.wulkanowy.dao.entities.Subject;
|
||||||
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
|
import io.github.wulkanowy.services.synchronisation.GradesSynchronisation;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class GradeSynchronizationTest {
|
||||||
|
|
||||||
|
private static DaoSession daoSession;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUpClass() {
|
||||||
|
DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(InstrumentationRegistry.getTargetContext(), "wulkanowyTest-database");
|
||||||
|
Database database = devOpenHelper.getWritableDb();
|
||||||
|
|
||||||
|
daoSession = new DaoMaster(database).newSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
daoSession.getAccountDao().deleteAll();
|
||||||
|
daoSession.getGradeDao().deleteAll();
|
||||||
|
daoSession.getSubjectDao().deleteAll();
|
||||||
|
daoSession.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void syncGradesEmptyBaseTest() throws Exception {
|
||||||
|
Long userId = daoSession.getAccountDao().insert(new Account().setEmail("TEST@TEST"));
|
||||||
|
Long subjectId = daoSession.getSubjectDao().insert(new Subject().setName("Matematyka").setUserId(userId));
|
||||||
|
|
||||||
|
List<Grade> gradeList = new ArrayList<>();
|
||||||
|
gradeList.add(new Grade().setSubject("Matematyka").setValue("5"));
|
||||||
|
|
||||||
|
GradesList gradesListApi = Mockito.mock(GradesList.class);
|
||||||
|
Mockito.doReturn(gradeList).when(gradesListApi).getAll();
|
||||||
|
|
||||||
|
Vulcan vulcan = Mockito.mock(Vulcan.class);
|
||||||
|
Mockito.doReturn(gradesListApi).when(vulcan).getGradesList();
|
||||||
|
|
||||||
|
LoginSession loginSession = Mockito.mock(LoginSession.class);
|
||||||
|
Mockito.doReturn(vulcan).when(loginSession).getVulcan();
|
||||||
|
Mockito.doReturn(daoSession).when(loginSession).getDaoSession();
|
||||||
|
Mockito.doReturn(userId).when(loginSession).getUserId();
|
||||||
|
|
||||||
|
GradesSynchronisation gradesSynchronisation = new GradesSynchronisation();
|
||||||
|
gradesSynchronisation.sync(loginSession);
|
||||||
|
|
||||||
|
io.github.wulkanowy.dao.entities.Grade grade = daoSession.getGradeDao().load(1L);
|
||||||
|
|
||||||
|
Assert.assertNotNull(grade);
|
||||||
|
Assert.assertEquals(userId, grade.getUserId());
|
||||||
|
Assert.assertEquals(subjectId, grade.getSubjectId());
|
||||||
|
Assert.assertEquals("Matematyka", grade.getSubject());
|
||||||
|
Assert.assertEquals("5", grade.getValue());
|
||||||
|
Assert.assertTrue(grade.getIsNew());
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void cleanUp() {
|
||||||
|
daoSession.getAccountDao().deleteAll();
|
||||||
|
daoSession.getGradeDao().deleteAll();
|
||||||
|
daoSession.getSubjectDao().deleteAll();
|
||||||
|
daoSession.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,82 @@
|
|||||||
|
package io.github.wulkanowy.services.synchronization;
|
||||||
|
|
||||||
|
import android.support.test.InstrumentationRegistry;
|
||||||
|
import android.support.test.runner.AndroidJUnit4;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
|
import io.github.wulkanowy.api.grades.SubjectsList;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoMaster;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
|
import io.github.wulkanowy.dao.entities.Subject;
|
||||||
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
|
import io.github.wulkanowy.services.synchronisation.SubjectsSynchronisation;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
public class SubjectSynchronizationTest {
|
||||||
|
|
||||||
|
private static DaoSession daoSession;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUpClass() {
|
||||||
|
DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(InstrumentationRegistry.getTargetContext(), "wulkanowyTest-database");
|
||||||
|
Database database = devOpenHelper.getWritableDb();
|
||||||
|
|
||||||
|
daoSession = new DaoMaster(database).newSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
daoSession.getSubjectDao().deleteAll();
|
||||||
|
daoSession.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void syncSubjectTest() throws Exception {
|
||||||
|
List<io.github.wulkanowy.api.grades.Subject> subjectList = new ArrayList<>();
|
||||||
|
subjectList.add(new io.github.wulkanowy.api.grades.Subject()
|
||||||
|
.setName("Matematyka")
|
||||||
|
.setFinalRating("5")
|
||||||
|
.setPredictedRating("4"));
|
||||||
|
|
||||||
|
SubjectsList subjectsListApi = Mockito.mock(SubjectsList.class);
|
||||||
|
Mockito.doReturn(subjectList).when(subjectsListApi).getAll();
|
||||||
|
|
||||||
|
Vulcan vulcan = Mockito.mock(Vulcan.class);
|
||||||
|
Mockito.doReturn(subjectsListApi).when(vulcan).getSubjectsList();
|
||||||
|
|
||||||
|
LoginSession loginSession = Mockito.mock(LoginSession.class);
|
||||||
|
Mockito.doReturn(vulcan).when(loginSession).getVulcan();
|
||||||
|
Mockito.doReturn(2L).when(loginSession).getUserId();
|
||||||
|
Mockito.doReturn(daoSession).when(loginSession).getDaoSession();
|
||||||
|
|
||||||
|
SubjectsSynchronisation subjectsSynchronisation = new SubjectsSynchronisation();
|
||||||
|
subjectsSynchronisation.sync(loginSession);
|
||||||
|
|
||||||
|
Subject subject = daoSession.getSubjectDao().load(1L);
|
||||||
|
|
||||||
|
Assert.assertNotNull(subject);
|
||||||
|
Assert.assertEquals(2, subject.getUserId().longValue());
|
||||||
|
Assert.assertEquals("Matematyka", subject.getName());
|
||||||
|
Assert.assertEquals("5", subject.getFinalRating());
|
||||||
|
Assert.assertEquals("4", subject.getPredictedRating());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void cleanUp() {
|
||||||
|
daoSession.getSubjectDao().deleteAll();
|
||||||
|
daoSession.clear();
|
||||||
|
}
|
||||||
|
}
|
@ -9,14 +9,17 @@ import android.widget.Toast;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.github.wulkanowy.R;
|
import io.github.wulkanowy.R;
|
||||||
|
import io.github.wulkanowy.activity.WulkanowyApp;
|
||||||
import io.github.wulkanowy.activity.dashboard.DashboardActivity;
|
import io.github.wulkanowy.activity.dashboard.DashboardActivity;
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
import io.github.wulkanowy.api.login.AccountPermissionException;
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
import io.github.wulkanowy.api.login.BadCredentialsException;
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
import io.github.wulkanowy.security.CryptoException;
|
import io.github.wulkanowy.security.CryptoException;
|
||||||
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
|
import io.github.wulkanowy.services.VulcanSynchronization;
|
||||||
import io.github.wulkanowy.services.jobs.GradesSync;
|
import io.github.wulkanowy.services.jobs.GradesSync;
|
||||||
import io.github.wulkanowy.services.synchronisation.DataSynchronisation;
|
|
||||||
import io.github.wulkanowy.services.synchronisation.VulcanSynchronisation;
|
|
||||||
import io.github.wulkanowy.utilities.ConnectionUtilities;
|
import io.github.wulkanowy.utilities.ConnectionUtilities;
|
||||||
|
|
||||||
public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
||||||
@ -44,21 +47,22 @@ public class LoginTask extends AsyncTask<String, Integer, Integer> {
|
|||||||
protected Integer doInBackground(String... credentials) {
|
protected Integer doInBackground(String... credentials) {
|
||||||
|
|
||||||
if (ConnectionUtilities.isOnline(activity)) {
|
if (ConnectionUtilities.isOnline(activity)) {
|
||||||
VulcanSynchronisation vulcanSynchronisation = new VulcanSynchronisation();
|
VulcanSynchronization vulcanSynchronization = new VulcanSynchronization(new LoginSession());
|
||||||
|
DaoSession daoSession = ((WulkanowyApp) activity.getApplication()).getDaoSession();
|
||||||
try {
|
try {
|
||||||
vulcanSynchronisation.loginNewUser(credentials[0], credentials[1], credentials[2], activity);
|
vulcanSynchronization
|
||||||
|
.loginNewUser(credentials[0], credentials[1], credentials[2], activity, daoSession, new Vulcan());
|
||||||
} catch (BadCredentialsException e) {
|
} catch (BadCredentialsException e) {
|
||||||
return R.string.login_bad_credentials_text;
|
return R.string.login_bad_credentials_text;
|
||||||
} catch (AccountPermissionException e) {
|
} catch (AccountPermissionException e) {
|
||||||
return R.string.login_bad_account_permission_text;
|
return R.string.login_bad_account_permission_text;
|
||||||
} catch (CryptoException e) {
|
} catch (CryptoException e) {
|
||||||
return R.string.encrypt_failed_text;
|
return R.string.encrypt_failed_text;
|
||||||
} catch (LoginErrorException | IOException e) {
|
} catch (NotLoggedInErrorException | IOException e) {
|
||||||
return R.string.login_denied_text;
|
return R.string.login_denied_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataSynchronisation dataSynchronisation = new DataSynchronisation(activity);
|
vulcanSynchronization.syncSubjectsAndGrades();
|
||||||
dataSynchronisation.syncSubjectsAndGrades(vulcanSynchronisation);
|
|
||||||
|
|
||||||
return R.string.login_accepted_text;
|
return R.string.login_accepted_text;
|
||||||
|
|
||||||
|
37
app/src/main/java/io/github/wulkanowy/api/Api.java
Normal file
37
app/src/main/java/io/github/wulkanowy/api/Api.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package io.github.wulkanowy.api;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public abstract class Api {
|
||||||
|
|
||||||
|
protected Cookies cookies;
|
||||||
|
|
||||||
|
public Cookies getCookiesObject() {
|
||||||
|
return cookies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getCookies() {
|
||||||
|
return cookies.getItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cookies setCookies(Map<String, String> cookies) {
|
||||||
|
this.cookies.setItems(cookies);
|
||||||
|
return this.cookies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cookies addCookies(Map<String, String> cookies) {
|
||||||
|
this.cookies.addItems(cookies);
|
||||||
|
return this.cookies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Document getPageByUrl(String url) throws IOException {
|
||||||
|
return Jsoup.connect(url)
|
||||||
|
.followRedirects(true)
|
||||||
|
.cookies(getCookies())
|
||||||
|
.get();
|
||||||
|
}
|
||||||
|
}
|
@ -10,9 +10,9 @@ import java.io.IOException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
|
|
||||||
public class StudentAndParent extends Vulcan {
|
public class StudentAndParent extends Api {
|
||||||
|
|
||||||
private String startPageUrl = "https://uonetplus.vulcan.net.pl/{symbol}/Start.mvc/Index";
|
private String startPageUrl = "https://uonetplus.vulcan.net.pl/{symbol}/Start.mvc/Index";
|
||||||
|
|
||||||
@ -20,37 +20,32 @@ public class StudentAndParent extends Vulcan {
|
|||||||
|
|
||||||
private String gradesPageUrl = baseUrl + "Oceny/Wszystkie";
|
private String gradesPageUrl = baseUrl + "Oceny/Wszystkie";
|
||||||
|
|
||||||
private String symbol = "";
|
private String symbol;
|
||||||
|
|
||||||
private String id = "";
|
private String id;
|
||||||
|
|
||||||
public StudentAndParent(Cookies cookies, String locID) throws IOException, LoginErrorException {
|
public StudentAndParent(Cookies cookies, String symbol) {
|
||||||
this.cookies = cookies;
|
this.cookies = cookies;
|
||||||
this.symbol = locID;
|
this.symbol = symbol;
|
||||||
|
}
|
||||||
|
|
||||||
// get link to uonetplus-opiekun.vulcan.net.pl module
|
public StudentAndParent(Cookies cookies, String symbol, String id) {
|
||||||
Document startPage = getPageByUrl(startPageUrl.replace("{symbol}", symbol));
|
this(cookies, symbol);
|
||||||
Element studentTileLink = startPage.select(".panel.linkownia.pracownik.klient > a").first();
|
this.id = id;
|
||||||
String uonetPlusOpiekunUrl = studentTileLink.attr("href");
|
|
||||||
|
|
||||||
//get context module cookie
|
|
||||||
Connection.Response res = Jsoup.connect(uonetPlusOpiekunUrl)
|
|
||||||
.followRedirects(true)
|
|
||||||
.cookies(getCookies())
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
cookies.addItems(res.cookies());
|
|
||||||
|
|
||||||
this.id = getCalculatedID(uonetPlusOpiekunUrl);
|
|
||||||
this.baseUrl = baseUrl
|
|
||||||
.replace("{symbol}", getSymbol())
|
|
||||||
.replace("{ID}", getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getGradesPageUrl() {
|
public String getGradesPageUrl() {
|
||||||
return gradesPageUrl;
|
return gradesPageUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBaseUrl() {
|
||||||
|
return baseUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStartPageUrl() {
|
||||||
|
return startPageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSymbol() {
|
public String getSymbol() {
|
||||||
return symbol;
|
return symbol;
|
||||||
}
|
}
|
||||||
@ -59,11 +54,41 @@ public class StudentAndParent extends Vulcan {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCalculatedID(String uonetPlusOpiekunUrl) throws LoginErrorException {
|
public void storeContextCookies() throws IOException, NotLoggedInErrorException {
|
||||||
String[] path = uonetPlusOpiekunUrl.split("vulcan.net.pl/")[1].split("/");
|
//get context cookie
|
||||||
|
Connection.Response res = Jsoup.connect(getSnpPageUrl())
|
||||||
|
.followRedirects(true)
|
||||||
|
.cookies(getCookies())
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
cookies.addItems(res.cookies());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSnpPageUrl() throws IOException, NotLoggedInErrorException {
|
||||||
|
if (null != getId()) {
|
||||||
|
return getBaseUrl().replace("{symbol}", getSymbol()).replace("{ID}", getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
// get url to uonetplus-opiekun.vulcan.net.pl
|
||||||
|
Document startPage = getPageByUrl(getStartPageUrl().replace("{symbol}", getSymbol()));
|
||||||
|
Element studentTileLink = startPage.select(".panel.linkownia.pracownik.klient > a").first();
|
||||||
|
|
||||||
|
if (null == studentTileLink) {
|
||||||
|
throw new NotLoggedInErrorException();
|
||||||
|
}
|
||||||
|
|
||||||
|
String snpPageUrl = studentTileLink.attr("href");
|
||||||
|
|
||||||
|
this.id = getExtractedIdFromUrl(snpPageUrl);
|
||||||
|
|
||||||
|
return snpPageUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtractedIdFromUrl(String snpPageUrl) throws NotLoggedInErrorException {
|
||||||
|
String[] path = snpPageUrl.split("vulcan.net.pl/")[1].split("/");
|
||||||
|
|
||||||
if (4 != path.length) {
|
if (4 != path.length) {
|
||||||
throw new LoginErrorException();
|
throw new NotLoggedInErrorException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return path[1];
|
return path[1];
|
||||||
@ -74,7 +99,9 @@ public class StudentAndParent extends Vulcan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Document getSnPPageDocument(String url) throws IOException {
|
public Document getSnPPageDocument(String url) throws IOException {
|
||||||
return getPageByUrl(baseUrl + url);
|
return getPageByUrl(getBaseUrl()
|
||||||
|
.replace("{symbol}", getSymbol())
|
||||||
|
.replace("{ID}", getId()) + url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Semester> getSemesters() throws IOException {
|
public List<Semester> getSemesters() throws IOException {
|
||||||
|
@ -1,37 +1,111 @@
|
|||||||
package io.github.wulkanowy.api;
|
package io.github.wulkanowy.api;
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public abstract class Vulcan {
|
import io.github.wulkanowy.api.attendance.AttendanceStatistics;
|
||||||
|
import io.github.wulkanowy.api.attendance.AttendanceTable;
|
||||||
|
import io.github.wulkanowy.api.grades.GradesList;
|
||||||
|
import io.github.wulkanowy.api.grades.SubjectsList;
|
||||||
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
|
import io.github.wulkanowy.api.login.Login;
|
||||||
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
|
import io.github.wulkanowy.api.notes.AchievementsList;
|
||||||
|
import io.github.wulkanowy.api.notes.NotesList;
|
||||||
|
import io.github.wulkanowy.api.school.SchoolInfo;
|
||||||
|
import io.github.wulkanowy.api.school.TeachersInfo;
|
||||||
|
import io.github.wulkanowy.api.timetable.Timetable;
|
||||||
|
import io.github.wulkanowy.api.user.BasicInformation;
|
||||||
|
import io.github.wulkanowy.api.user.FamilyInformation;
|
||||||
|
|
||||||
protected Cookies cookies;
|
public class Vulcan extends Api {
|
||||||
|
|
||||||
public Cookies getCookiesObject() {
|
private String id;
|
||||||
return cookies;
|
|
||||||
|
private String symbol;
|
||||||
|
|
||||||
|
private StudentAndParent snp;
|
||||||
|
|
||||||
|
public void login(String email, String password, String symbol)
|
||||||
|
throws BadCredentialsException, AccountPermissionException, LoginErrorException {
|
||||||
|
Login login = new Login(new Cookies());
|
||||||
|
login.login(email, password, symbol);
|
||||||
|
|
||||||
|
this.symbol = symbol;
|
||||||
|
this.cookies = login.getCookiesObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, String> getCookies() {
|
public void login(String email, String password, String symbol, String id)
|
||||||
return cookies.getItems();
|
throws BadCredentialsException, AccountPermissionException, LoginErrorException {
|
||||||
|
login(email, password, symbol);
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cookies setCookies(Map<String, String> cookies) {
|
public StudentAndParent getStudentAndParent() throws IOException, NotLoggedInErrorException {
|
||||||
this.cookies.setItems(cookies);
|
if (null == getCookiesObject()) {
|
||||||
return this.cookies;
|
throw new NotLoggedInErrorException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != snp) {
|
||||||
|
return snp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == id) {
|
||||||
|
snp = new StudentAndParent(cookies, symbol);
|
||||||
|
} else {
|
||||||
|
snp = new StudentAndParent(cookies, symbol, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
snp.storeContextCookies();
|
||||||
|
|
||||||
|
this.cookies = snp.getCookiesObject();
|
||||||
|
|
||||||
|
return snp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cookies addCookies(Map<String, String> cookies) {
|
public AttendanceStatistics getAttendanceStatistics() throws IOException, NotLoggedInErrorException {
|
||||||
this.cookies.addItems(cookies);
|
return new AttendanceStatistics(getStudentAndParent());
|
||||||
return this.cookies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Document getPageByUrl(String url) throws IOException {
|
public AttendanceTable getAttendanceTable() throws IOException, NotLoggedInErrorException {
|
||||||
return Jsoup.connect(url)
|
return new AttendanceTable(getStudentAndParent());
|
||||||
.followRedirects(true)
|
}
|
||||||
.cookies(getCookies())
|
|
||||||
.get();
|
public GradesList getGradesList() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new GradesList(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubjectsList getSubjectsList() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new SubjectsList(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public AchievementsList getAchievementsList() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new AchievementsList(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public NotesList getNotesList() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new NotesList(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public SchoolInfo getSchoolInfo() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new SchoolInfo(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public TeachersInfo getTeachersInfo() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new TeachersInfo(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Timetable getTimetable() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new Timetable(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasicInformation getBasicInformation() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new BasicInformation(getStudentAndParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public FamilyInformation getFamilyInformation() throws IOException, NotLoggedInErrorException {
|
||||||
|
return new FamilyInformation(getStudentAndParent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
|
|
||||||
public class Statistics {
|
public class AttendanceStatistics {
|
||||||
|
|
||||||
private StudentAndParent snp;
|
private StudentAndParent snp;
|
||||||
|
|
||||||
private String attendancePageUrl = "Frekwencja.mvc";
|
private String attendancePageUrl = "Frekwencja.mvc";
|
||||||
|
|
||||||
public Statistics(StudentAndParent snp) {
|
public AttendanceStatistics(StudentAndParent snp) {
|
||||||
this.snp = snp;
|
this.snp = snp;
|
||||||
}
|
}
|
||||||
|
|
@ -9,13 +9,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
|
|
||||||
public class Table {
|
public class AttendanceTable {
|
||||||
|
|
||||||
private StudentAndParent snp;
|
private StudentAndParent snp;
|
||||||
|
|
||||||
private String attendancePageUrl = "Frekwencja.mvc?data=";
|
private String attendancePageUrl = "Frekwencja.mvc?data=";
|
||||||
|
|
||||||
public Table(StudentAndParent snp) {
|
public AttendanceTable(StudentAndParent snp) {
|
||||||
this.snp = snp;
|
this.snp = snp;
|
||||||
}
|
}
|
||||||
|
|
@ -2,10 +2,10 @@ package io.github.wulkanowy.api.grades;
|
|||||||
|
|
||||||
public class Grade {
|
public class Grade {
|
||||||
|
|
||||||
private String subject = "";
|
|
||||||
|
|
||||||
protected String value = "";
|
protected String value = "";
|
||||||
|
|
||||||
|
private String subject = "";
|
||||||
|
|
||||||
private String color = "";
|
private String color = "";
|
||||||
|
|
||||||
private String symbol = "";
|
private String symbol = "";
|
||||||
|
@ -16,10 +16,9 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import io.github.wulkanowy.api.Semester;
|
import io.github.wulkanowy.api.Semester;
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
import io.github.wulkanowy.api.Vulcan;
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
|
||||||
public class GradesList extends Vulcan {
|
public class GradesList {
|
||||||
|
|
||||||
private StudentAndParent snp = null;
|
private StudentAndParent snp = null;
|
||||||
|
|
||||||
|
@ -9,10 +9,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
import io.github.wulkanowy.api.Vulcan;
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
|
||||||
public class SubjectsList extends Vulcan {
|
public class SubjectsList {
|
||||||
|
|
||||||
private StudentAndParent snp = null;
|
private StudentAndParent snp = null;
|
||||||
|
|
||||||
|
@ -6,17 +6,17 @@ import org.jsoup.nodes.Document;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.Api;
|
||||||
import io.github.wulkanowy.api.Cookies;
|
import io.github.wulkanowy.api.Cookies;
|
||||||
import io.github.wulkanowy.api.Vulcan;
|
|
||||||
|
|
||||||
public class Login extends Vulcan {
|
public class Login extends Api {
|
||||||
|
|
||||||
private String loginPageUrl = "https://cufs.vulcan.net.pl/{symbol}/Account/LogOn";
|
private String loginPageUrl = "https://cufs.vulcan.net.pl/{symbol}/Account/LogOn";
|
||||||
|
|
||||||
private String certificatePageUrl = "https://cufs.vulcan.net.pl/{symbol}"
|
private String certificatePageUrl = "https://cufs.vulcan.net.pl/{symbol}"
|
||||||
+ "/FS/LS?wa=wsignin1.0&wtrealm=https://uonetplus.vulcan.net.pl/{symbol}"
|
+ "/FS/LS?wa=wsignin1.0&wtrealm=https://uonetplus.vulcan.net.pl/{symbol}"
|
||||||
+ "/LoginEndpoint.aspx&wctx=https://uonetplus.vulcan.net.pl/{symbol}"
|
+ "/LoginEndpoint.aspx&wctx=https://uonetplus.vulcan.net.pl/{symbol}"
|
||||||
+ "/LoginEndpoint.aspx";
|
+ "/LoginEndpoint.aspx";
|
||||||
|
|
||||||
private String loginEndpointPageUrl =
|
private String loginEndpointPageUrl =
|
||||||
"https://uonetplus.vulcan.net.pl/{symbol}/LoginEndpoint.aspx";
|
"https://uonetplus.vulcan.net.pl/{symbol}/LoginEndpoint.aspx";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.wulkanowy.api.login;
|
package io.github.wulkanowy.api.login;
|
||||||
|
|
||||||
public class LoginErrorException extends Exception {
|
public class LoginErrorException extends NotLoggedInErrorException {
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package io.github.wulkanowy.api.login;
|
||||||
|
|
||||||
|
|
||||||
|
public class NotLoggedInErrorException extends Exception {
|
||||||
|
}
|
@ -5,10 +5,9 @@ import org.jsoup.nodes.Element;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
import io.github.wulkanowy.api.Vulcan;
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
|
||||||
public class SchoolInfo extends Vulcan {
|
public class SchoolInfo {
|
||||||
|
|
||||||
private StudentAndParent snp = null;
|
private StudentAndParent snp = null;
|
||||||
|
|
||||||
|
@ -9,10 +9,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
import io.github.wulkanowy.api.Vulcan;
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
|
||||||
public class TeachersInfo extends Vulcan {
|
public class TeachersInfo {
|
||||||
|
|
||||||
private StudentAndParent snp = null;
|
private StudentAndParent snp = null;
|
||||||
|
|
||||||
|
@ -9,16 +9,15 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
import io.github.wulkanowy.api.Vulcan;
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
|
||||||
public class Table extends Vulcan {
|
public class Timetable {
|
||||||
|
|
||||||
private StudentAndParent snp;
|
private StudentAndParent snp;
|
||||||
|
|
||||||
private String timetablePageurl = "Lekcja.mvc/PlanLekcji?data=";
|
private String timetablePageUrl = "Lekcja.mvc/PlanLekcji?data=";
|
||||||
|
|
||||||
public Table(StudentAndParent snp) {
|
public Timetable(StudentAndParent snp) {
|
||||||
this.snp = snp;
|
this.snp = snp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +26,7 @@ public class Table extends Vulcan {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Week getWeekTable(String tick) throws IOException, LoginErrorException {
|
public Week getWeekTable(String tick) throws IOException, LoginErrorException {
|
||||||
Element table = snp.getSnPPageDocument(timetablePageurl + tick)
|
Element table = snp.getSnPPageDocument(timetablePageUrl + tick)
|
||||||
.select(".mainContainer .presentData").first();
|
.select(".mainContainer .presentData").first();
|
||||||
|
|
||||||
Elements tableHeaderCells = table.select("thead th");
|
Elements tableHeaderCells = table.select("thead th");
|
||||||
@ -95,6 +94,12 @@ public class Table extends Vulcan {
|
|||||||
lesson.setTeacher(spans.get(1).text());
|
lesson.setTeacher(spans.get(1).text());
|
||||||
lesson.setRoom(spans.get(2).text());
|
lesson.setRoom(spans.get(2).text());
|
||||||
|
|
||||||
|
// okienko dla uczniów
|
||||||
|
if (5 == spans.size()) {
|
||||||
|
lesson.setTeacher(spans.get(2).text());
|
||||||
|
lesson.setRoom(spans.get(3).text());
|
||||||
|
}
|
||||||
|
|
||||||
lesson = getLessonGroupDivisionInfo(lesson, spans);
|
lesson = getLessonGroupDivisionInfo(lesson, spans);
|
||||||
lesson = getLessonTypeInfo(lesson, spans);
|
lesson = getLessonTypeInfo(lesson, spans);
|
||||||
lesson = getLessonDescriptionInfo(lesson, spans);
|
lesson = getLessonDescriptionInfo(lesson, spans);
|
@ -8,10 +8,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
import io.github.wulkanowy.api.StudentAndParent;
|
||||||
import io.github.wulkanowy.api.Vulcan;
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
|
||||||
public class FamilyInformation extends Vulcan {
|
public class FamilyInformation {
|
||||||
|
|
||||||
private StudentAndParent snp;
|
private StudentAndParent snp;
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class EntitiesCompare {
|
|||||||
.removeAll(newList, addedOrUpdatedGradeList));
|
.removeAll(newList, addedOrUpdatedGradeList));
|
||||||
|
|
||||||
for (Grade grade : addedOrUpdatedGradeList) {
|
for (Grade grade : addedOrUpdatedGradeList) {
|
||||||
grade.setNew(true);
|
grade.setIsNew(true);
|
||||||
updatedList.add(grade);
|
updatedList.add(grade);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,15 +280,6 @@ public class Grade implements Parcelable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNew() {
|
|
||||||
return isNew;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Grade setNew(boolean aNew) {
|
|
||||||
isNew = aNew;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getIsNew() {
|
public boolean getIsNew() {
|
||||||
return this.isNew;
|
return this.isNew;
|
||||||
}
|
}
|
||||||
|
@ -29,19 +29,19 @@ import javax.security.auth.x500.X500Principal;
|
|||||||
|
|
||||||
public class Scrambler {
|
public class Scrambler {
|
||||||
|
|
||||||
private KeyStore keyStore;
|
public final static String DEBUG_TAG = "WulkanowySecurity";
|
||||||
|
|
||||||
private static final String ANDROID_KEYSTORE = "AndroidKeyStore";
|
private static final String ANDROID_KEYSTORE = "AndroidKeyStore";
|
||||||
|
|
||||||
public final static String DEBUG_TAG = "WulkanowySecurity";
|
protected Context context;
|
||||||
|
|
||||||
public Context context;
|
private KeyStore keyStore;
|
||||||
|
|
||||||
public Scrambler(Context context) {
|
protected Scrambler(Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadKeyStore() throws CryptoException {
|
protected void loadKeyStore() throws CryptoException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
keyStore = KeyStore.getInstance(ANDROID_KEYSTORE);
|
keyStore = KeyStore.getInstance(ANDROID_KEYSTORE);
|
||||||
@ -54,7 +54,7 @@ public class Scrambler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(18)
|
@TargetApi(18)
|
||||||
public void generateNewKey(String alias) throws CryptoException {
|
protected void generateNewKey(String alias) throws CryptoException {
|
||||||
|
|
||||||
Calendar start = Calendar.getInstance();
|
Calendar start = Calendar.getInstance();
|
||||||
Calendar end = Calendar.getInstance();
|
Calendar end = Calendar.getInstance();
|
||||||
@ -105,7 +105,7 @@ public class Scrambler {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String encryptString(String alias, String text) throws CryptoException {
|
protected String encryptString(String alias, String text) throws CryptoException {
|
||||||
|
|
||||||
if (!alias.isEmpty() && !text.isEmpty()) {
|
if (!alias.isEmpty() && !text.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
@ -135,7 +135,7 @@ public class Scrambler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String decryptString(String alias, String text) throws CryptoException {
|
protected String decryptString(String alias, String text) throws CryptoException {
|
||||||
|
|
||||||
if (!alias.isEmpty() && !text.isEmpty()) {
|
if (!alias.isEmpty() && !text.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package io.github.wulkanowy.services;
|
||||||
|
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
|
|
||||||
|
public class LoginSession {
|
||||||
|
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
private Vulcan vulcan;
|
||||||
|
|
||||||
|
private DaoSession daoSession;
|
||||||
|
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginSession setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vulcan getVulcan() {
|
||||||
|
return vulcan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginSession setVulcan(Vulcan vulcan) {
|
||||||
|
this.vulcan = vulcan;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DaoSession getDaoSession() {
|
||||||
|
return daoSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginSession setDaoSession(DaoSession daoSession) {
|
||||||
|
this.daoSession = daoSession;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package io.github.wulkanowy.services;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
|
import io.github.wulkanowy.security.CryptoException;
|
||||||
|
import io.github.wulkanowy.services.jobs.VulcanSync;
|
||||||
|
import io.github.wulkanowy.services.synchronisation.AccountSynchronisation;
|
||||||
|
import io.github.wulkanowy.services.synchronisation.GradesSynchronisation;
|
||||||
|
import io.github.wulkanowy.services.synchronisation.SubjectsSynchronisation;
|
||||||
|
|
||||||
|
public class VulcanSynchronization {
|
||||||
|
|
||||||
|
private LoginSession loginSession;
|
||||||
|
|
||||||
|
public VulcanSynchronization(LoginSession loginSession) {
|
||||||
|
this.loginSession = loginSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loginCurrentUser(Context context, DaoSession daoSession, Vulcan vulcan)
|
||||||
|
throws CryptoException, BadCredentialsException, AccountPermissionException, IOException, LoginErrorException {
|
||||||
|
|
||||||
|
AccountSynchronisation accountSynchronisation = new AccountSynchronisation();
|
||||||
|
loginSession = accountSynchronisation.loginCurrentUser(context, daoSession, vulcan);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loginNewUser(String email, String password, String symbol,
|
||||||
|
Context context, DaoSession daoSession, Vulcan vulcan)
|
||||||
|
throws BadCredentialsException, NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException {
|
||||||
|
|
||||||
|
AccountSynchronisation accountSynchronisation = new AccountSynchronisation();
|
||||||
|
loginSession = accountSynchronisation.loginNewUser(email, password, symbol, context, daoSession, vulcan);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean syncGrades() {
|
||||||
|
GradesSynchronisation gradesSynchronisation = new GradesSynchronisation();
|
||||||
|
|
||||||
|
try {
|
||||||
|
gradesSynchronisation.sync(loginSession);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(VulcanSync.DEBUG_TAG, "Synchronisation of grades failed", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean syncSubjectsAndGrades() {
|
||||||
|
SubjectsSynchronisation subjectsSynchronisation = new SubjectsSynchronisation();
|
||||||
|
|
||||||
|
try {
|
||||||
|
subjectsSynchronisation.sync(loginSession);
|
||||||
|
syncGrades();
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(VulcanSync.DEBUG_TAG, "Synchronisation of subjects failed", e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,13 +10,14 @@ import com.firebase.jobdispatcher.Trigger;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.github.wulkanowy.activity.WulkanowyApp;
|
import io.github.wulkanowy.activity.WulkanowyApp;
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
import io.github.wulkanowy.api.login.AccountPermissionException;
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
import io.github.wulkanowy.api.login.BadCredentialsException;
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
import io.github.wulkanowy.dao.entities.DaoSession;
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
import io.github.wulkanowy.security.CryptoException;
|
import io.github.wulkanowy.security.CryptoException;
|
||||||
import io.github.wulkanowy.services.synchronisation.DataSynchronisation;
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
import io.github.wulkanowy.services.synchronisation.VulcanSynchronisation;
|
import io.github.wulkanowy.services.VulcanSynchronization;
|
||||||
|
|
||||||
public class GradesSync extends VulcanSync {
|
public class GradesSync extends VulcanSync {
|
||||||
|
|
||||||
@ -44,14 +45,13 @@ public class GradesSync extends VulcanSync {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void workToBePerformed() throws CryptoException, BadCredentialsException,
|
public void workToBePerformed() throws CryptoException, BadCredentialsException,
|
||||||
LoginErrorException, AccountPermissionException, IOException {
|
NotLoggedInErrorException, AccountPermissionException, IOException {
|
||||||
|
|
||||||
DaoSession daoSession = ((WulkanowyApp) getApplication()).getDaoSession();
|
DaoSession daoSession = ((WulkanowyApp) getApplication()).getDaoSession();
|
||||||
|
|
||||||
VulcanSynchronisation vulcanSynchronisation = new VulcanSynchronisation();
|
VulcanSynchronization vulcanSynchronization = new VulcanSynchronization(new LoginSession());
|
||||||
DataSynchronisation dataSynchronisation = new DataSynchronisation(daoSession);
|
vulcanSynchronization.loginCurrentUser(getApplicationContext(), daoSession, new Vulcan());
|
||||||
vulcanSynchronisation.loginCurrentUser(getApplicationContext(), daoSession);
|
vulcanSynchronization.syncGrades();
|
||||||
dataSynchronisation.syncGrades(vulcanSynchronisation);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,14 @@ import com.firebase.jobdispatcher.Trigger;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import io.github.wulkanowy.activity.WulkanowyApp;
|
import io.github.wulkanowy.activity.WulkanowyApp;
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
import io.github.wulkanowy.api.login.AccountPermissionException;
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
import io.github.wulkanowy.api.login.BadCredentialsException;
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
import io.github.wulkanowy.dao.entities.DaoSession;
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
import io.github.wulkanowy.security.CryptoException;
|
import io.github.wulkanowy.security.CryptoException;
|
||||||
import io.github.wulkanowy.services.synchronisation.DataSynchronisation;
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
import io.github.wulkanowy.services.synchronisation.VulcanSynchronisation;
|
import io.github.wulkanowy.services.VulcanSynchronization;
|
||||||
|
|
||||||
public class SubjectsSync extends VulcanSync {
|
public class SubjectsSync extends VulcanSync {
|
||||||
|
|
||||||
@ -44,14 +45,13 @@ public class SubjectsSync extends VulcanSync {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void workToBePerformed() throws CryptoException, BadCredentialsException,
|
public void workToBePerformed() throws CryptoException, BadCredentialsException,
|
||||||
LoginErrorException, AccountPermissionException, IOException {
|
NotLoggedInErrorException, AccountPermissionException, IOException {
|
||||||
|
|
||||||
DaoSession daoSession = ((WulkanowyApp) getApplication()).getDaoSession();
|
DaoSession daoSession = ((WulkanowyApp) getApplication()).getDaoSession();
|
||||||
|
|
||||||
VulcanSynchronisation vulcanSynchronisation = new VulcanSynchronisation();
|
VulcanSynchronization vulcanSynchronization = new VulcanSynchronization(new LoginSession());
|
||||||
DataSynchronisation dataSynchronisation = new DataSynchronisation(daoSession);
|
vulcanSynchronization.loginCurrentUser(getApplicationContext(), daoSession, new Vulcan());
|
||||||
vulcanSynchronisation.loginCurrentUser(getApplicationContext(), daoSession);
|
vulcanSynchronization.syncSubjectsAndGrades();
|
||||||
dataSynchronisation.syncSubjectsAndGrades(vulcanSynchronisation);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
import io.github.wulkanowy.api.login.AccountPermissionException;
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
import io.github.wulkanowy.api.login.BadCredentialsException;
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
import io.github.wulkanowy.security.CryptoException;
|
import io.github.wulkanowy.security.CryptoException;
|
||||||
|
|
||||||
public abstract class VulcanJob extends JobService {
|
public abstract class VulcanJob extends JobService {
|
||||||
@ -32,7 +32,7 @@ public abstract class VulcanJob extends JobService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract void workToBePerformed() throws CryptoException, BadCredentialsException,
|
public abstract void workToBePerformed() throws CryptoException, BadCredentialsException,
|
||||||
LoginErrorException, AccountPermissionException, IOException;
|
NotLoggedInErrorException, AccountPermissionException, IOException;
|
||||||
|
|
||||||
private class SyncTask extends AsyncTask<JobParameters, Void, Void> {
|
private class SyncTask extends AsyncTask<JobParameters, Void, Void> {
|
||||||
|
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
package io.github.wulkanowy.services.synchronisation;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.Vulcan;
|
||||||
|
import io.github.wulkanowy.api.login.AccountPermissionException;
|
||||||
|
import io.github.wulkanowy.api.login.BadCredentialsException;
|
||||||
|
import io.github.wulkanowy.api.login.LoginErrorException;
|
||||||
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
|
import io.github.wulkanowy.api.user.PersonalData;
|
||||||
|
import io.github.wulkanowy.dao.entities.Account;
|
||||||
|
import io.github.wulkanowy.dao.entities.AccountDao;
|
||||||
|
import io.github.wulkanowy.dao.entities.DaoSession;
|
||||||
|
import io.github.wulkanowy.security.CryptoException;
|
||||||
|
import io.github.wulkanowy.security.Safety;
|
||||||
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
|
import io.github.wulkanowy.services.jobs.VulcanSync;
|
||||||
|
|
||||||
|
public class AccountSynchronisation {
|
||||||
|
|
||||||
|
public LoginSession loginCurrentUser(Context context, DaoSession daoSession, Vulcan vulcan) throws CryptoException,
|
||||||
|
BadCredentialsException, AccountPermissionException, IOException, LoginErrorException {
|
||||||
|
|
||||||
|
AccountDao accountDao = daoSession.getAccountDao();
|
||||||
|
|
||||||
|
long userId = context.getSharedPreferences("LoginData", Context.MODE_PRIVATE).getLong("userId", 0);
|
||||||
|
|
||||||
|
if (userId != 0) {
|
||||||
|
|
||||||
|
Log.d(VulcanSync.DEBUG_TAG, "Login current user id=" + String.valueOf(userId));
|
||||||
|
|
||||||
|
Safety safety = new Safety(context);
|
||||||
|
Account account = accountDao.load(userId);
|
||||||
|
vulcan.login(
|
||||||
|
account.getEmail(),
|
||||||
|
safety.decrypt(account.getEmail(), account.getPassword()),
|
||||||
|
account.getSymbol()
|
||||||
|
);
|
||||||
|
|
||||||
|
return new LoginSession()
|
||||||
|
.setDaoSession(daoSession)
|
||||||
|
.setUserId(userId)
|
||||||
|
.setVulcan(vulcan);
|
||||||
|
} else {
|
||||||
|
Log.wtf(VulcanSync.DEBUG_TAG, "loginCurrentUser - USERID IS EMPTY");
|
||||||
|
throw new IOException("Can't find user with index 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoginSession loginNewUser(String email, String password, String symbol, Context context, DaoSession daoSession, Vulcan vulcan)
|
||||||
|
throws BadCredentialsException, NotLoggedInErrorException, AccountPermissionException, IOException, CryptoException {
|
||||||
|
|
||||||
|
long userId;
|
||||||
|
|
||||||
|
vulcan.login(email, password, symbol);
|
||||||
|
|
||||||
|
PersonalData personalData = vulcan.getBasicInformation().getPersonalData();
|
||||||
|
AccountDao accountDao = daoSession.getAccountDao();
|
||||||
|
Safety safety = new Safety(context);
|
||||||
|
|
||||||
|
Account account = new Account()
|
||||||
|
.setName(personalData.getFirstAndLastName())
|
||||||
|
.setEmail(email)
|
||||||
|
.setPassword(safety.encrypt(email, password))
|
||||||
|
.setSymbol(symbol);
|
||||||
|
|
||||||
|
userId = accountDao.insert(account);
|
||||||
|
|
||||||
|
Log.d(VulcanSync.DEBUG_TAG, "Login and save new user id=" + String.valueOf(userId));
|
||||||
|
|
||||||
|
SharedPreferences sharedPreferences = context.getSharedPreferences("LoginData", Context.MODE_PRIVATE);
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putLong("userId", userId);
|
||||||
|
editor.apply();
|
||||||
|
|
||||||
|
return new LoginSession()
|
||||||
|
.setVulcan(vulcan)
|
||||||
|
.setUserId(userId)
|
||||||
|
.setDaoSession(daoSession);
|
||||||
|
}
|
||||||
|
}
|
@ -1,42 +0,0 @@
|
|||||||
package io.github.wulkanowy.services.synchronisation;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import io.github.wulkanowy.activity.WulkanowyApp;
|
|
||||||
import io.github.wulkanowy.dao.entities.DaoSession;
|
|
||||||
import io.github.wulkanowy.services.jobs.VulcanSync;
|
|
||||||
|
|
||||||
public class DataSynchronisation {
|
|
||||||
|
|
||||||
private DaoSession daoSession;
|
|
||||||
|
|
||||||
public DataSynchronisation(DaoSession daoSession) {
|
|
||||||
this.daoSession = daoSession;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataSynchronisation(Activity activity) {
|
|
||||||
daoSession = ((WulkanowyApp) activity.getApplication()).getDaoSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void syncGrades(VulcanSynchronisation vulcanSynchronisation) {
|
|
||||||
GradesSynchronisation gradesSynchronisation = new GradesSynchronisation();
|
|
||||||
|
|
||||||
try {
|
|
||||||
gradesSynchronisation.sync(vulcanSynchronisation, daoSession);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(VulcanSync.DEBUG_TAG, "Synchronisation of grades failed", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void syncSubjectsAndGrades(VulcanSynchronisation vulcanSynchronisation) {
|
|
||||||
SubjectsSynchronisation subjectsSynchronisation = new SubjectsSynchronisation();
|
|
||||||
|
|
||||||
try {
|
|
||||||
subjectsSynchronisation.sync(vulcanSynchronisation, daoSession);
|
|
||||||
syncGrades(vulcanSynchronisation);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(VulcanSync.DEBUG_TAG, "Synchronisation of subjects failed", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,30 +10,30 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.grades.GradesList;
|
import io.github.wulkanowy.api.grades.GradesList;
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
import io.github.wulkanowy.dao.EntitiesCompare;
|
import io.github.wulkanowy.dao.EntitiesCompare;
|
||||||
import io.github.wulkanowy.dao.entities.Account;
|
import io.github.wulkanowy.dao.entities.Account;
|
||||||
import io.github.wulkanowy.dao.entities.AccountDao;
|
import io.github.wulkanowy.dao.entities.AccountDao;
|
||||||
import io.github.wulkanowy.dao.entities.DaoSession;
|
|
||||||
import io.github.wulkanowy.dao.entities.Grade;
|
import io.github.wulkanowy.dao.entities.Grade;
|
||||||
import io.github.wulkanowy.dao.entities.GradeDao;
|
import io.github.wulkanowy.dao.entities.GradeDao;
|
||||||
import io.github.wulkanowy.dao.entities.Subject;
|
import io.github.wulkanowy.dao.entities.Subject;
|
||||||
import io.github.wulkanowy.dao.entities.SubjectDao;
|
import io.github.wulkanowy.dao.entities.SubjectDao;
|
||||||
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
import io.github.wulkanowy.services.jobs.VulcanSync;
|
import io.github.wulkanowy.services.jobs.VulcanSync;
|
||||||
import io.github.wulkanowy.utilities.ConversionVulcanObject;
|
import io.github.wulkanowy.utilities.ConversionVulcanObject;
|
||||||
|
|
||||||
public class GradesSynchronisation {
|
public class GradesSynchronisation {
|
||||||
|
|
||||||
public void sync(VulcanSynchronisation vulcanSynchronisation, DaoSession daoSession) throws IOException,
|
public void sync(LoginSession loginSession) throws IOException,
|
||||||
ParseException, LoginErrorException {
|
ParseException, NotLoggedInErrorException {
|
||||||
|
|
||||||
GradesList gradesList = new GradesList(vulcanSynchronisation.getStudentAndParent());
|
GradesList gradesList = loginSession.getVulcan().getGradesList();
|
||||||
|
|
||||||
GradeDao gradeDao = daoSession.getGradeDao();
|
GradeDao gradeDao = loginSession.getDaoSession().getGradeDao();
|
||||||
AccountDao accountDao = daoSession.getAccountDao();
|
AccountDao accountDao = loginSession.getDaoSession().getAccountDao();
|
||||||
SubjectDao subjectDao = daoSession.getSubjectDao();
|
SubjectDao subjectDao = loginSession.getDaoSession().getSubjectDao();
|
||||||
|
|
||||||
Account account = accountDao.load(vulcanSynchronisation.getUserId());
|
Account account = accountDao.load(loginSession.getUserId());
|
||||||
|
|
||||||
List<Grade> gradesFromDb = account.getGradeList();
|
List<Grade> gradesFromDb = account.getGradeList();
|
||||||
List<Grade> gradeEntitiesList = ConversionVulcanObject.gradesToGradeEntities(gradesList.getAll());
|
List<Grade> gradeEntitiesList = ConversionVulcanObject.gradesToGradeEntities(gradesList.getAll());
|
||||||
@ -49,7 +49,7 @@ public class GradesSynchronisation {
|
|||||||
.where(SubjectDao.Properties.Name.eq(grade.getSubject()))
|
.where(SubjectDao.Properties.Name.eq(grade.getSubject()))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
grade.setUserId(vulcanSynchronisation.getUserId());
|
grade.setUserId(loginSession.getUserId());
|
||||||
grade.setSubjectId((subjectQuery.uniqueOrThrow()).getId());
|
grade.setSubjectId((subjectQuery.uniqueOrThrow()).getId());
|
||||||
|
|
||||||
lastList.add(grade);
|
lastList.add(grade);
|
||||||
|
@ -8,26 +8,26 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.grades.SubjectsList;
|
import io.github.wulkanowy.api.grades.SubjectsList;
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
import io.github.wulkanowy.dao.entities.DaoSession;
|
|
||||||
import io.github.wulkanowy.dao.entities.Subject;
|
import io.github.wulkanowy.dao.entities.Subject;
|
||||||
import io.github.wulkanowy.dao.entities.SubjectDao;
|
import io.github.wulkanowy.dao.entities.SubjectDao;
|
||||||
|
import io.github.wulkanowy.services.LoginSession;
|
||||||
import io.github.wulkanowy.services.jobs.VulcanSync;
|
import io.github.wulkanowy.services.jobs.VulcanSync;
|
||||||
import io.github.wulkanowy.utilities.ConversionVulcanObject;
|
import io.github.wulkanowy.utilities.ConversionVulcanObject;
|
||||||
|
|
||||||
public class SubjectsSynchronisation {
|
public class SubjectsSynchronisation {
|
||||||
|
|
||||||
public void sync(VulcanSynchronisation vulcanSynchronisation, DaoSession daoSession) throws IOException,
|
public void sync(LoginSession loginSession) throws IOException,
|
||||||
ParseException, LoginErrorException {
|
ParseException, NotLoggedInErrorException {
|
||||||
|
|
||||||
SubjectsList subjectsList = new SubjectsList(vulcanSynchronisation.getStudentAndParent());
|
SubjectsList subjectsList = loginSession.getVulcan().getSubjectsList();
|
||||||
SubjectDao subjectDao = daoSession.getSubjectDao();
|
SubjectDao subjectDao = loginSession.getDaoSession().getSubjectDao();
|
||||||
|
|
||||||
List<Subject> subjectEntitiesList = ConversionVulcanObject.subjectsToSubjectEntities(subjectsList.getAll());
|
List<Subject> subjectEntitiesList = ConversionVulcanObject.subjectsToSubjectEntities(subjectsList.getAll());
|
||||||
List<Subject> preparedList = new ArrayList<>();
|
List<Subject> preparedList = new ArrayList<>();
|
||||||
|
|
||||||
for (Subject subject : subjectEntitiesList) {
|
for (Subject subject : subjectEntitiesList) {
|
||||||
subject.setUserId(vulcanSynchronisation.getUserId());
|
subject.setUserId(loginSession.getUserId());
|
||||||
preparedList.add(subject);
|
preparedList.add(subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,122 +0,0 @@
|
|||||||
package io.github.wulkanowy.services.synchronisation;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import io.github.wulkanowy.activity.WulkanowyApp;
|
|
||||||
import io.github.wulkanowy.api.Cookies;
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
import io.github.wulkanowy.api.login.AccountPermissionException;
|
|
||||||
import io.github.wulkanowy.api.login.BadCredentialsException;
|
|
||||||
import io.github.wulkanowy.api.login.Login;
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
|
||||||
import io.github.wulkanowy.api.user.BasicInformation;
|
|
||||||
import io.github.wulkanowy.api.user.PersonalData;
|
|
||||||
import io.github.wulkanowy.dao.entities.Account;
|
|
||||||
import io.github.wulkanowy.dao.entities.AccountDao;
|
|
||||||
import io.github.wulkanowy.dao.entities.DaoSession;
|
|
||||||
import io.github.wulkanowy.security.CryptoException;
|
|
||||||
import io.github.wulkanowy.security.Safety;
|
|
||||||
import io.github.wulkanowy.services.jobs.VulcanSync;
|
|
||||||
|
|
||||||
public class VulcanSynchronisation {
|
|
||||||
|
|
||||||
private StudentAndParent studentAndParent;
|
|
||||||
|
|
||||||
private Long userId = 0L;
|
|
||||||
|
|
||||||
public void loginCurrentUser(Context context, DaoSession daoSession) throws CryptoException,
|
|
||||||
BadCredentialsException, LoginErrorException, AccountPermissionException, IOException {
|
|
||||||
|
|
||||||
AccountDao accountDao = daoSession.getAccountDao();
|
|
||||||
|
|
||||||
userId = context.getSharedPreferences("LoginData", Context.MODE_PRIVATE).getLong("userId", 0);
|
|
||||||
|
|
||||||
if (userId != 0) {
|
|
||||||
|
|
||||||
Log.d(VulcanSync.DEBUG_TAG, "Login current user id=" + String.valueOf(userId));
|
|
||||||
|
|
||||||
Safety safety = new Safety(context);
|
|
||||||
Account account = accountDao.load(userId);
|
|
||||||
Login login = loginUser(
|
|
||||||
account.getEmail(),
|
|
||||||
safety.decrypt(account.getEmail(), account.getPassword()),
|
|
||||||
account.getSymbol());
|
|
||||||
|
|
||||||
getAndSetStudentAndParentFromApi(account.getSymbol(), login.getCookies());
|
|
||||||
} else {
|
|
||||||
Log.wtf(VulcanSync.DEBUG_TAG, "loginCurrentUser - USERID IS EMPTY");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loginNewUser(String email, String password, String symbol, Context context, DaoSession daoSession)
|
|
||||||
throws BadCredentialsException, LoginErrorException, AccountPermissionException, IOException, CryptoException {
|
|
||||||
|
|
||||||
AccountDao accountDao = daoSession.getAccountDao();
|
|
||||||
|
|
||||||
Login login = loginUser(email, password, symbol);
|
|
||||||
|
|
||||||
Safety safety = new Safety(context);
|
|
||||||
BasicInformation basicInformation = new BasicInformation(getAndSetStudentAndParentFromApi(symbol, login.getCookies()));
|
|
||||||
PersonalData personalData = basicInformation.getPersonalData();
|
|
||||||
|
|
||||||
Account account = new Account()
|
|
||||||
.setName(personalData.getFirstAndLastName())
|
|
||||||
.setEmail(email)
|
|
||||||
.setPassword(safety.encrypt(email, password))
|
|
||||||
.setSymbol(symbol);
|
|
||||||
|
|
||||||
userId = accountDao.insert(account);
|
|
||||||
|
|
||||||
Log.d(VulcanSync.DEBUG_TAG, "Login and save new user id=" + String.valueOf(userId));
|
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = context.getSharedPreferences("LoginData", Context.MODE_PRIVATE);
|
|
||||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
|
||||||
editor.putLong("userId", userId);
|
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loginNewUser(String email, String password, String symbol, Activity activity)
|
|
||||||
throws BadCredentialsException, LoginErrorException, AccountPermissionException, IOException, CryptoException {
|
|
||||||
loginNewUser(email, password, symbol, activity, ((WulkanowyApp) activity.getApplication()).getDaoSession());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Login loginUser(String email, String password, String symbol) throws BadCredentialsException,
|
|
||||||
LoginErrorException, AccountPermissionException {
|
|
||||||
|
|
||||||
Cookies cookies = new Cookies();
|
|
||||||
Login login = new Login(cookies);
|
|
||||||
login.login(email, password, symbol);
|
|
||||||
return login;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getUserId() {
|
|
||||||
return userId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public StudentAndParent getStudentAndParent() {
|
|
||||||
return studentAndParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private StudentAndParent getAndSetStudentAndParentFromApi(String symbol, Map<String, String> cookiesMap)
|
|
||||||
throws IOException, LoginErrorException {
|
|
||||||
|
|
||||||
if (studentAndParent == null) {
|
|
||||||
Cookies cookies = new Cookies();
|
|
||||||
cookies.setItems(cookiesMap);
|
|
||||||
|
|
||||||
StudentAndParent snp = new StudentAndParent(cookies, symbol);
|
|
||||||
|
|
||||||
studentAndParent = snp;
|
|
||||||
return snp;
|
|
||||||
} else {
|
|
||||||
return studentAndParent;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,8 +7,6 @@ public class FixtureHelper {
|
|||||||
|
|
||||||
public static String getAsString(InputStream inputStream) {
|
public static String getAsString(InputStream inputStream) {
|
||||||
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
|
Scanner s = new Scanner(inputStream).useDelimiter("\\A");
|
||||||
String input = s.hasNext() ? s.next() : "";
|
return s.hasNext() ? s.next() : "";
|
||||||
|
|
||||||
return input;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,23 +10,23 @@ import org.mockito.Mockito;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.login.LoginErrorException;
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
|
|
||||||
public class StudentAndParentTest {
|
public class StudentAndParentTest {
|
||||||
|
|
||||||
private String fixtureFileName = "OcenyWszystkie-semester.html";
|
|
||||||
|
|
||||||
private StudentAndParent snp;
|
private StudentAndParent snp;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
String input = FixtureHelper.getAsString(
|
||||||
|
getClass().getResourceAsStream("OcenyWszystkie-semester.html"));
|
||||||
Document gradesPageDocument = Jsoup.parse(input);
|
Document gradesPageDocument = Jsoup.parse(input);
|
||||||
|
|
||||||
snp = Mockito.mock(StudentAndParent.class);
|
snp = Mockito.mock(StudentAndParent.class);
|
||||||
|
|
||||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(gradesPageDocument);
|
Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(gradesPageDocument);
|
||||||
Mockito.when(snp.getCalculatedID(Mockito.anyString())).thenCallRealMethod();
|
Mockito.when(snp.getExtractedIdFromUrl(Mockito.anyString())).thenCallRealMethod();
|
||||||
|
Mockito.when(snp.getBaseUrl()).thenReturn("https://uonetplus-opiekun.vulcan.net.pl/{symbol}/{ID}/");
|
||||||
Mockito.when(snp.getSymbol()).thenReturn("symbol");
|
Mockito.when(snp.getSymbol()).thenReturn("symbol");
|
||||||
Mockito.when(snp.getId()).thenReturn("123456");
|
Mockito.when(snp.getId()).thenReturn("123456");
|
||||||
Mockito.when(snp.getSemesters()).thenCallRealMethod();
|
Mockito.when(snp.getSemesters()).thenCallRealMethod();
|
||||||
@ -36,20 +36,63 @@ public class StudentAndParentTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getCalculatedIDStandardTest() throws Exception {
|
public void snpTest() throws Exception {
|
||||||
Assert.assertEquals("123456", snp.getCalculatedID("https://uonetplus-opiekun"
|
StudentAndParent snp = new StudentAndParent(new Cookies(), "demo123", "id123");
|
||||||
|
Assert.assertEquals("demo123", snp.getSymbol());
|
||||||
|
Assert.assertEquals("id123", snp.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSnpPageUrlWithIdTest() throws Exception {
|
||||||
|
Mockito.when(snp.getSnpPageUrl()).thenCallRealMethod();
|
||||||
|
Assert.assertEquals("https://uonetplus-opiekun.vulcan.net.pl/symbol/123456/",
|
||||||
|
snp.getSnpPageUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSnpPageUrlWithoutIdTest() throws Exception {
|
||||||
|
String input = FixtureHelper.getAsString(getClass().getResourceAsStream("Start.html"));
|
||||||
|
Document startPageDocument = Jsoup.parse(input);
|
||||||
|
|
||||||
|
Mockito.when(snp.getPageByUrl(Mockito.anyString())).thenReturn(startPageDocument);
|
||||||
|
Mockito.when(snp.getStartPageUrl()).thenReturn("http://wulkan.io");
|
||||||
|
Mockito.when(snp.getId()).thenCallRealMethod();
|
||||||
|
|
||||||
|
Mockito.when(snp.getSnpPageUrl()).thenCallRealMethod();
|
||||||
|
Assert.assertEquals("https://uonetplus-opiekun.vulcan.net.pl/symbol/534213/Start/Index/",
|
||||||
|
snp.getSnpPageUrl());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = NotLoggedInErrorException.class)
|
||||||
|
public void getSnpPageUrlWithWrongPage() throws Exception {
|
||||||
|
Document wrongPageDocument = Jsoup.parse(
|
||||||
|
FixtureHelper.getAsString(getClass().getResourceAsStream("OcenyWszystkie-semester.html"))
|
||||||
|
);
|
||||||
|
|
||||||
|
Mockito.when(snp.getPageByUrl(Mockito.anyString())).thenReturn(wrongPageDocument);
|
||||||
|
Mockito.when(snp.getStartPageUrl()).thenReturn("http://wulkan.io");
|
||||||
|
Mockito.when(snp.getId()).thenCallRealMethod();
|
||||||
|
|
||||||
|
Mockito.when(snp.getSnpPageUrl()).thenCallRealMethod();
|
||||||
|
|
||||||
|
snp.getSnpPageUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getExtractedIDStandardTest() throws Exception {
|
||||||
|
Assert.assertEquals("123456", snp.getExtractedIdFromUrl("https://uonetplus-opiekun"
|
||||||
+ ".vulcan.net.pl/powiat/123456/Start/Index/"));
|
+ ".vulcan.net.pl/powiat/123456/Start/Index/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getCalculatedIDDemoTest() throws Exception {
|
public void getExtractedIDDemoTest() throws Exception {
|
||||||
Assert.assertEquals("demo12345", snp.getCalculatedID("https://uonetplus-opiekundemo"
|
Assert.assertEquals("demo12345", snp.getExtractedIdFromUrl("https://uonetplus-opiekundemo"
|
||||||
+ ".vulcan.net.pl/demoupowiat/demo12345/Start/Index/"));
|
+ ".vulcan.net.pl/demoupowiat/demo12345/Start/Index/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = LoginErrorException.class)
|
@Test(expected = NotLoggedInErrorException.class)
|
||||||
public void getCalculatedIDNotLoggedTest() throws Exception {
|
public void getExtractedIDNotLoggedTest() throws Exception {
|
||||||
Assert.assertEquals("123", snp.getCalculatedID("https://uonetplus"
|
Assert.assertEquals("123", snp.getExtractedIdFromUrl("https://uonetplus"
|
||||||
+ ".vulcan.net.pl/powiat/"));
|
+ ".vulcan.net.pl/powiat/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package io.github.wulkanowy.api;
|
||||||
|
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
public abstract class StudentAndParentTestCase {
|
||||||
|
|
||||||
|
protected StudentAndParent getSnp(String fixtureFileName) throws Exception {
|
||||||
|
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
||||||
|
|
||||||
|
Document tablePageDocument = Jsoup.parse(input);
|
||||||
|
|
||||||
|
StudentAndParent snp = Mockito.mock(StudentAndParent.class);
|
||||||
|
Mockito.when(snp.getSnPPageDocument(Mockito.anyString()))
|
||||||
|
.thenReturn(tablePageDocument);
|
||||||
|
Mockito.when(snp.getSemesters(Mockito.any(Document.class))).thenCallRealMethod();
|
||||||
|
Mockito.when(snp.getCurrentSemester(Mockito.<Semester>anyList()))
|
||||||
|
.thenCallRealMethod();
|
||||||
|
Mockito.when(snp.getRowDataChildValue(Mockito.any(Element.class),
|
||||||
|
Mockito.anyInt())).thenCallRealMethod();
|
||||||
|
|
||||||
|
return snp;
|
||||||
|
}
|
||||||
|
}
|
124
app/src/test/java/io/github/wulkanowy/api/VulcanTest.java
Normal file
124
app/src/test/java/io/github/wulkanowy/api/VulcanTest.java
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
package io.github.wulkanowy.api;
|
||||||
|
|
||||||
|
import org.hamcrest.CoreMatchers;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.attendance.AttendanceStatistics;
|
||||||
|
import io.github.wulkanowy.api.attendance.AttendanceTable;
|
||||||
|
import io.github.wulkanowy.api.grades.GradesList;
|
||||||
|
import io.github.wulkanowy.api.grades.SubjectsList;
|
||||||
|
import io.github.wulkanowy.api.login.NotLoggedInErrorException;
|
||||||
|
import io.github.wulkanowy.api.notes.AchievementsList;
|
||||||
|
import io.github.wulkanowy.api.notes.NotesList;
|
||||||
|
import io.github.wulkanowy.api.school.SchoolInfo;
|
||||||
|
import io.github.wulkanowy.api.school.TeachersInfo;
|
||||||
|
import io.github.wulkanowy.api.timetable.Timetable;
|
||||||
|
import io.github.wulkanowy.api.user.BasicInformation;
|
||||||
|
import io.github.wulkanowy.api.user.FamilyInformation;
|
||||||
|
|
||||||
|
public class VulcanTest extends Vulcan {
|
||||||
|
|
||||||
|
private Vulcan vulcan;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
StudentAndParent snp = Mockito.mock(StudentAndParent.class);
|
||||||
|
vulcan = Mockito.mock(Vulcan.class);
|
||||||
|
Mockito.when(vulcan.getStudentAndParent())
|
||||||
|
.thenReturn(snp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = NotLoggedInErrorException.class)
|
||||||
|
public void getStudentAndParentTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getStudentAndParent()).thenCallRealMethod();
|
||||||
|
vulcan.getStudentAndParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test(expected = NotLoggedInErrorException.class)
|
||||||
|
public void getAttendanceExceptionText() throws Exception {
|
||||||
|
Mockito.when(vulcan.getAttendanceTable()).thenCallRealMethod();
|
||||||
|
Mockito.when(vulcan.getStudentAndParent()).thenThrow(NotLoggedInErrorException.class);
|
||||||
|
|
||||||
|
vulcan.getAttendanceTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAttendanceTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getAttendanceTable()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getAttendanceTable(),
|
||||||
|
CoreMatchers.instanceOf(AttendanceTable.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAttendanceStatisticTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getAttendanceStatistics()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getAttendanceStatistics(),
|
||||||
|
CoreMatchers.instanceOf(AttendanceStatistics.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getGradesListTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getGradesList()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getGradesList(),
|
||||||
|
CoreMatchers.instanceOf(GradesList.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSubjectListTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getSubjectsList()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getSubjectsList(),
|
||||||
|
CoreMatchers.instanceOf(SubjectsList.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getAchievementsListTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getAchievementsList()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getAchievementsList(),
|
||||||
|
CoreMatchers.instanceOf(AchievementsList.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getNotesListTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getNotesList()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getNotesList(),
|
||||||
|
CoreMatchers.instanceOf(NotesList.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSchoolInfoTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getSchoolInfo()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getSchoolInfo(),
|
||||||
|
CoreMatchers.instanceOf(SchoolInfo.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTeachersInfoTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getTeachersInfo()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getTeachersInfo(),
|
||||||
|
CoreMatchers.instanceOf(TeachersInfo.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTimetableTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getTimetable()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getTimetable(),
|
||||||
|
CoreMatchers.instanceOf(Timetable.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getBasicInformationTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getBasicInformation()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getBasicInformation(),
|
||||||
|
CoreMatchers.instanceOf(BasicInformation.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getFamilyInformationTest() throws Exception {
|
||||||
|
Mockito.when(vulcan.getFamilyInformation()).thenCallRealMethod();
|
||||||
|
Assert.assertThat(vulcan.getFamilyInformation(),
|
||||||
|
CoreMatchers.instanceOf(FamilyInformation.class));
|
||||||
|
}
|
||||||
|
}
|
@ -1,39 +1,23 @@
|
|||||||
package io.github.wulkanowy.api.attendance;
|
package io.github.wulkanowy.api.attendance;
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class StatisticsTest {
|
public class AttendanceStatisticsTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private Statistics excellent;
|
private AttendanceStatistics excellent;
|
||||||
|
|
||||||
private Statistics full;
|
private AttendanceStatistics full;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
this.excellent = getSetUpTable("Frekwencja-excellent.html");
|
this.excellent = new AttendanceStatistics(getSnp("Frekwencja-excellent.html"));
|
||||||
this.full = getSetUpTable("Frekwencja-full.html");
|
this.full = new AttendanceStatistics(getSnp("Frekwencja-full.html"));
|
||||||
}
|
|
||||||
|
|
||||||
private Statistics getSetUpTable(String fixtureFileName) throws Exception {
|
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
|
||||||
|
|
||||||
Document tablePageDocument = Jsoup.parse(input);
|
|
||||||
|
|
||||||
StudentAndParent timetable = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(timetable.getSnPPageDocument(Mockito.anyString()))
|
|
||||||
.thenReturn(tablePageDocument);
|
|
||||||
|
|
||||||
return new Statistics(timetable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
@ -1,37 +1,21 @@
|
|||||||
package io.github.wulkanowy.api.attendance;
|
package io.github.wulkanowy.api.attendance;
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class TableTest {
|
public class AttendanceTableTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private Table excellent;
|
private AttendanceTable excellent;
|
||||||
|
|
||||||
private Table full;
|
private AttendanceTable full;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
excellent = getSetUpTable("Frekwencja-excellent.html");
|
excellent = new AttendanceTable(getSnp("Frekwencja-excellent.html"));
|
||||||
full = getSetUpTable("Frekwencja-full.html");
|
full = new AttendanceTable(getSnp("Frekwencja-full.html"));
|
||||||
}
|
|
||||||
|
|
||||||
public Table getSetUpTable(String fixtureFileName) throws Exception {
|
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
|
||||||
|
|
||||||
Document tablePageDocument = Jsoup.parse(input);
|
|
||||||
|
|
||||||
StudentAndParent timetable = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(timetable.getSnPPageDocument(Mockito.anyString()))
|
|
||||||
.thenReturn(tablePageDocument);
|
|
||||||
|
|
||||||
return new Table(timetable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
@ -6,66 +6,109 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class GradesListTest extends GradesTest {
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
|
|
||||||
private String fixtureFileName = "OcenyWszystkie-filled.html";
|
public class GradesListTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private GradesList gradesList;
|
private GradesList filled;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp(fixtureFileName);
|
filled = new GradesList(getSnp("OcenyWszystkie-filled.html"));
|
||||||
|
|
||||||
gradesList = new GradesList(snp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllTest() throws Exception {
|
public void getAllTest() throws Exception {
|
||||||
List<Grade> grades = gradesList.getAll();
|
Assert.assertEquals(6, filled.getAll().size()); // 2 items are skipped
|
||||||
Assert.assertEquals(6, grades.size()); // 2 items are skipped
|
}
|
||||||
|
|
||||||
Grade grade1 = grades.get(0);
|
@Test
|
||||||
Assert.assertEquals("Zajęcia z wychowawcą", grade1.getSubject());
|
public void getSubjectTest() throws Exception {
|
||||||
Assert.assertEquals("5", grade1.getValue());
|
List<Grade> list = filled.getAll();
|
||||||
Assert.assertEquals("000000", grade1.getColor());
|
|
||||||
Assert.assertEquals("A1", grade1.getSymbol());
|
|
||||||
Assert.assertEquals("Dzień Kobiet w naszej klasie", grade1.getDescription());
|
|
||||||
Assert.assertEquals("1,00", grade1.getWeight());
|
|
||||||
Assert.assertEquals("2017-03-21", grade1.getDate());
|
|
||||||
Assert.assertEquals("Patryk Maciejewski", grade1.getTeacher());
|
|
||||||
Assert.assertEquals("7654321", grade1.getSemester());
|
|
||||||
|
|
||||||
Grade grade2 = grades.get(3);
|
Assert.assertEquals("Zajęcia z wychowawcą", list.get(0).getSubject());
|
||||||
Assert.assertEquals("Język angielski", grade2.getSubject());
|
Assert.assertEquals("Język angielski", list.get(3).getSubject());
|
||||||
Assert.assertEquals("5", grade2.getValue());
|
Assert.assertEquals("Wychowanie fizyczne", list.get(4).getSubject());
|
||||||
Assert.assertEquals("1289F7", grade2.getColor());
|
Assert.assertEquals("Język polski", list.get(5).getSubject());
|
||||||
Assert.assertEquals("BW3", grade2.getSymbol());
|
}
|
||||||
Assert.assertEquals("Writing", grade2.getDescription());
|
|
||||||
Assert.assertEquals("3,00", grade2.getWeight());
|
|
||||||
Assert.assertEquals("2017-06-02", grade2.getDate());
|
|
||||||
Assert.assertEquals("Oliwia Woźniak", grade2.getTeacher());
|
|
||||||
Assert.assertEquals("7654321", grade2.getSemester());
|
|
||||||
|
|
||||||
Grade grade3 = grades.get(4);
|
@Test
|
||||||
Assert.assertEquals("Wychowanie fizyczne", grade3.getSubject());
|
public void getValueTest() throws Exception {
|
||||||
Assert.assertEquals("1", grade3.getValue());
|
List<Grade> list = filled.getAll();
|
||||||
Assert.assertEquals("6ECD07", grade3.getColor());
|
|
||||||
Assert.assertEquals("STR", grade3.getSymbol());
|
|
||||||
Assert.assertEquals("", grade3.getDescription());
|
|
||||||
Assert.assertEquals("8,00", grade3.getWeight());
|
|
||||||
Assert.assertEquals("2017-04-02", grade3.getDate());
|
|
||||||
Assert.assertEquals("Klaudia Dziedzic", grade3.getTeacher());
|
|
||||||
Assert.assertEquals("7654321", grade3.getSemester());
|
|
||||||
|
|
||||||
Grade grade4 = grades.get(5);
|
Assert.assertEquals("5", list.get(0).getValue());
|
||||||
Assert.assertEquals("Język polski", grade4.getSubject());
|
Assert.assertEquals("5", list.get(3).getValue());
|
||||||
Assert.assertEquals("1", grade4.getValue());
|
Assert.assertEquals("1", list.get(4).getValue());
|
||||||
Assert.assertEquals("6ECD07", grade4.getColor());
|
Assert.assertEquals("1", list.get(5).getValue());
|
||||||
Assert.assertEquals("K", grade4.getSymbol());
|
}
|
||||||
Assert.assertEquals("Kordian", grade4.getDescription());
|
|
||||||
Assert.assertEquals("5,00", grade4.getWeight());
|
@Test
|
||||||
Assert.assertEquals("2017-02-06", grade4.getDate());
|
public void getColorTest() throws Exception {
|
||||||
Assert.assertEquals("Amelia Stępień", grade4.getTeacher());
|
List<Grade> list = filled.getAll();
|
||||||
Assert.assertEquals("7654321", grade4.getSemester());
|
|
||||||
|
Assert.assertEquals("000000", list.get(0).getColor());
|
||||||
|
Assert.assertEquals("1289F7", list.get(3).getColor());
|
||||||
|
Assert.assertEquals("6ECD07", list.get(4).getColor());
|
||||||
|
Assert.assertEquals("6ECD07", list.get(5).getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSymbolTest() throws Exception {
|
||||||
|
List<Grade> list = filled.getAll();
|
||||||
|
|
||||||
|
Assert.assertEquals("A1", list.get(0).getSymbol());
|
||||||
|
Assert.assertEquals("BW3", list.get(3).getSymbol());
|
||||||
|
Assert.assertEquals("STR", list.get(4).getSymbol());
|
||||||
|
Assert.assertEquals("K", list.get(5).getSymbol());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDescriptionTest() throws Exception {
|
||||||
|
List<Grade> list = filled.getAll();
|
||||||
|
|
||||||
|
Assert.assertEquals("Dzień Kobiet w naszej klasie", list.get(0).getDescription());
|
||||||
|
Assert.assertEquals("Writing", list.get(3).getDescription());
|
||||||
|
Assert.assertEquals("", list.get(4).getDescription());
|
||||||
|
Assert.assertEquals("Kordian", list.get(5).getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getWeightTest() throws Exception {
|
||||||
|
List<Grade> list = filled.getAll();
|
||||||
|
|
||||||
|
Assert.assertEquals("1,00", list.get(0).getWeight());
|
||||||
|
Assert.assertEquals("3,00", list.get(3).getWeight());
|
||||||
|
Assert.assertEquals("8,00", list.get(4).getWeight());
|
||||||
|
Assert.assertEquals("5,00", list.get(5).getWeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDateTest() throws Exception {
|
||||||
|
List<Grade> list = filled.getAll();
|
||||||
|
|
||||||
|
Assert.assertEquals("2017-03-21", list.get(0).getDate());
|
||||||
|
Assert.assertEquals("2017-06-02", list.get(3).getDate());
|
||||||
|
Assert.assertEquals("2017-04-02", list.get(4).getDate());
|
||||||
|
Assert.assertEquals("2017-02-06", list.get(5).getDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTeacherTest() throws Exception {
|
||||||
|
List<Grade> list = filled.getAll();
|
||||||
|
|
||||||
|
Assert.assertEquals("Patryk Maciejewski", list.get(0).getTeacher());
|
||||||
|
Assert.assertEquals("Oliwia Woźniak", list.get(3).getTeacher());
|
||||||
|
Assert.assertEquals("Klaudia Dziedzic", list.get(4).getTeacher());
|
||||||
|
Assert.assertEquals("Amelia Stępień", list.get(5).getTeacher());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getSemesterTest() throws Exception {
|
||||||
|
List<Grade> list = filled.getAll();
|
||||||
|
|
||||||
|
Assert.assertEquals("7654321", list.get(0).getSemester());
|
||||||
|
Assert.assertEquals("7654321", list.get(3).getSemester());
|
||||||
|
Assert.assertEquals("7654321", list.get(4).getSemester());
|
||||||
|
Assert.assertEquals("7654321", list.get(5).getSemester());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package io.github.wulkanowy.api.grades;
|
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
|
||||||
import io.github.wulkanowy.api.Semester;
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class GradesTest {
|
|
||||||
|
|
||||||
protected StudentAndParent snp;
|
|
||||||
|
|
||||||
public void setUp(String fixtureFileName) throws Exception {
|
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
|
||||||
Document gradesPageDocument = Jsoup.parse(input);
|
|
||||||
|
|
||||||
snp = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString()))
|
|
||||||
.thenReturn(gradesPageDocument);
|
|
||||||
Mockito.when(snp.getSemesters(Mockito.any(Document.class))).thenCallRealMethod();
|
|
||||||
Mockito.when(snp.getCurrentSemester(Mockito.<Semester>anyList()))
|
|
||||||
.thenCallRealMethod();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,83 +1,82 @@
|
|||||||
package io.github.wulkanowy.api.grades;
|
package io.github.wulkanowy.api.grades;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class SubjectsListTest extends GradesTest {
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
|
|
||||||
private String fixtureStdFileName = "OcenyWszystkie-subjects.html";
|
public class SubjectsListTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private String fixtureAverageFileName = "OcenyWszystkie-subjects-average.html";
|
private SubjectsList std;
|
||||||
|
|
||||||
public SubjectsList getSetUpSubjectsList(String fixtureFileName) throws Exception {
|
private SubjectsList average;
|
||||||
super.setUp(fixtureFileName);
|
|
||||||
|
|
||||||
return new SubjectsList(snp);
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
std = new SubjectsList(getSnp("OcenyWszystkie-subjects.html"));
|
||||||
|
average = new SubjectsList(getSnp("OcenyWszystkie-subjects-average.html"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllStdTest() throws Exception {
|
public void getAllTest() throws Exception {
|
||||||
List<Subject> list = getSetUpSubjectsList(fixtureStdFileName).getAll();
|
Assert.assertEquals(5, std.getAll().size());
|
||||||
|
Assert.assertEquals(5, average.getAll().size());
|
||||||
Assert.assertEquals(5, list.size());
|
|
||||||
|
|
||||||
Subject subject0 = list.get(0);
|
|
||||||
Assert.assertEquals("Zachowanie", subject0.getName());
|
|
||||||
Assert.assertEquals("bardzo dobre", subject0.getPredictedRating());
|
|
||||||
Assert.assertEquals("bardzo dobre", subject0.getFinalRating());
|
|
||||||
|
|
||||||
Subject subject1 = list.get(1);
|
|
||||||
Assert.assertEquals("Praktyka zawodowa", subject1.getName());
|
|
||||||
Assert.assertEquals("-", subject1.getPredictedRating());
|
|
||||||
Assert.assertEquals("celujący", subject1.getFinalRating());
|
|
||||||
|
|
||||||
Subject subject2 = list.get(2);
|
|
||||||
Assert.assertEquals("Metodologia programowania", subject2.getName());
|
|
||||||
Assert.assertEquals("bardzo dobry", subject2.getPredictedRating());
|
|
||||||
Assert.assertEquals("celujący", subject2.getFinalRating());
|
|
||||||
|
|
||||||
Subject subject3 = list.get(3);
|
|
||||||
Assert.assertEquals("Podstawy przedsiębiorczości", subject3.getName());
|
|
||||||
Assert.assertEquals("3/4", subject3.getPredictedRating());
|
|
||||||
Assert.assertEquals("dostateczny", subject3.getFinalRating());
|
|
||||||
|
|
||||||
Subject subject4 = list.get(4);
|
|
||||||
Assert.assertEquals("Wychowanie do życia w rodzinie", subject4.getName());
|
|
||||||
Assert.assertEquals("-", subject4.getPredictedRating());
|
|
||||||
Assert.assertEquals("-", subject4.getFinalRating());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllAverageTest() throws Exception {
|
public void getNameTest() throws Exception {
|
||||||
List<Subject> list = getSetUpSubjectsList(fixtureAverageFileName).getAll();
|
List<Subject> stdList = std.getAll();
|
||||||
|
|
||||||
Assert.assertEquals(5, list.size());
|
Assert.assertEquals("Zachowanie", stdList.get(0).getName());
|
||||||
|
Assert.assertEquals("Praktyka zawodowa", stdList.get(1).getName());
|
||||||
|
Assert.assertEquals("Metodologia programowania", stdList.get(2).getName());
|
||||||
|
Assert.assertEquals("Podstawy przedsiębiorczości", stdList.get(3).getName());
|
||||||
|
Assert.assertEquals("Wychowanie do życia w rodzinie", stdList.get(4).getName());
|
||||||
|
|
||||||
Subject subject0 = list.get(0);
|
List<Subject> averageList = average.getAll();
|
||||||
Assert.assertEquals("Zachowanie", subject0.getName());
|
Assert.assertEquals("Zachowanie", averageList.get(0).getName());
|
||||||
Assert.assertEquals("bardzo dobre", subject0.getPredictedRating());
|
Assert.assertEquals("Język polski", averageList.get(1).getName());
|
||||||
Assert.assertEquals("bardzo dobre", subject0.getFinalRating());
|
Assert.assertEquals("Wychowanie fizyczne", averageList.get(2).getName());
|
||||||
|
Assert.assertEquals("Język angielski", averageList.get(3).getName());
|
||||||
|
Assert.assertEquals("Wiedza o społeczeństwie", averageList.get(4).getName());
|
||||||
|
}
|
||||||
|
|
||||||
Subject subject1 = list.get(1);
|
@Test
|
||||||
Assert.assertEquals("Język polski", subject1.getName());
|
public void getPredictedRatingTest() throws Exception {
|
||||||
Assert.assertEquals("-", subject1.getPredictedRating());
|
List<Subject> stdList = std.getAll();
|
||||||
Assert.assertEquals("dobry", subject1.getFinalRating());
|
|
||||||
|
|
||||||
Subject subject2 = list.get(2);
|
Assert.assertEquals("bardzo dobre", stdList.get(0).getPredictedRating());
|
||||||
Assert.assertEquals("Wychowanie fizyczne", subject2.getName());
|
Assert.assertEquals("-", stdList.get(1).getPredictedRating());
|
||||||
Assert.assertEquals("bardzo dobry", subject2.getPredictedRating());
|
Assert.assertEquals("bardzo dobry", stdList.get(2).getPredictedRating());
|
||||||
Assert.assertEquals("celujący", subject2.getFinalRating());
|
Assert.assertEquals("3/4", stdList.get(3).getPredictedRating());
|
||||||
|
Assert.assertEquals("-", stdList.get(4).getPredictedRating());
|
||||||
|
|
||||||
Subject subject3 = list.get(3);
|
List<Subject> averageList = average.getAll();
|
||||||
Assert.assertEquals("Język angielski", subject3.getName());
|
Assert.assertEquals("bardzo dobre", averageList.get(0).getPredictedRating());
|
||||||
Assert.assertEquals("4/5", subject3.getPredictedRating());
|
Assert.assertEquals("-", averageList.get(1).getPredictedRating());
|
||||||
Assert.assertEquals("bardzo dobry", subject3.getFinalRating());
|
Assert.assertEquals("bardzo dobry", averageList.get(2).getPredictedRating());
|
||||||
|
Assert.assertEquals("4/5", averageList.get(3).getPredictedRating());
|
||||||
|
Assert.assertEquals("-", averageList.get(4).getPredictedRating());
|
||||||
|
}
|
||||||
|
|
||||||
Subject subject4 = list.get(4);
|
@Test
|
||||||
Assert.assertEquals("Wiedza o społeczeństwie", subject4.getName());
|
public void getFinalRatingTest() throws Exception {
|
||||||
Assert.assertEquals("-", subject4.getPredictedRating());
|
List<Subject> stdList = std.getAll();
|
||||||
Assert.assertEquals("-", subject4.getFinalRating());
|
|
||||||
|
Assert.assertEquals("bardzo dobre", stdList.get(0).getFinalRating());
|
||||||
|
Assert.assertEquals("celujący", stdList.get(1).getFinalRating());
|
||||||
|
Assert.assertEquals("celujący", stdList.get(2).getFinalRating());
|
||||||
|
Assert.assertEquals("dostateczny", stdList.get(3).getFinalRating());
|
||||||
|
Assert.assertEquals("-", stdList.get(4).getFinalRating());
|
||||||
|
|
||||||
|
List<Subject> averageList = average.getAll();
|
||||||
|
Assert.assertEquals("bardzo dobre", averageList.get(0).getFinalRating());
|
||||||
|
Assert.assertEquals("dobry", averageList.get(1).getFinalRating());
|
||||||
|
Assert.assertEquals("celujący", averageList.get(2).getFinalRating());
|
||||||
|
Assert.assertEquals("bardzo dobry", averageList.get(3).getFinalRating());
|
||||||
|
Assert.assertEquals("-", averageList.get(4).getFinalRating());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,36 @@
|
|||||||
package io.github.wulkanowy.api.notes;
|
package io.github.wulkanowy.api.notes;
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class AchievementsListTest {
|
public class AchievementsListTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private String fixtureFilledFileName = "UwagiOsiagniecia-filled.html";
|
private AchievementsList filledAchievementsList;
|
||||||
|
|
||||||
private String fixtureEmptyFileName = "UwagiOsiagniecia-empty.html";
|
private AchievementsList emptyAchievementsList;
|
||||||
|
|
||||||
private AchievementsList getSetUpAchievementsList(String fixtureFileName) throws Exception {
|
@Before
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
public void setUp() throws Exception {
|
||||||
|
filledAchievementsList = new AchievementsList(getSnp("UwagiOsiagniecia-filled.html"));
|
||||||
Document notesPageDocument = Jsoup.parse(input);
|
emptyAchievementsList = new AchievementsList(getSnp("UwagiOsiagniecia-empty.html"));
|
||||||
|
|
||||||
StudentAndParent snp = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(notesPageDocument);
|
|
||||||
|
|
||||||
return new AchievementsList(snp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllAchievementsFilledTest() throws Exception {
|
public void getAllAchievementsTest() throws Exception {
|
||||||
List<String> list = getSetUpAchievementsList(fixtureFilledFileName).getAllAchievements();
|
Assert.assertEquals(2, filledAchievementsList.getAllAchievements().size());
|
||||||
|
Assert.assertEquals(0, emptyAchievementsList.getAllAchievements().size());
|
||||||
Assert.assertEquals(2, list.size());
|
|
||||||
Assert.assertEquals("I miejsce w ogólnopolskim konkursie ortograficznym", list.get(0));
|
|
||||||
Assert.assertEquals("III miejsce w ogólnopolskim konkursie plastycznym", list.get(1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllAchievementsEmptyTest() throws Exception {
|
public void getAchievements() throws Exception {
|
||||||
List<String> list = getSetUpAchievementsList(fixtureEmptyFileName).getAllAchievements();
|
List<String> filledList = filledAchievementsList.getAllAchievements();
|
||||||
|
|
||||||
Assert.assertEquals(0, list.size());
|
Assert.assertEquals("I miejsce w ogólnopolskim konkursie ortograficznym", filledList.get(0));
|
||||||
|
Assert.assertEquals("III miejsce w ogólnopolskim konkursie plastycznym", filledList.get(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,57 +1,60 @@
|
|||||||
package io.github.wulkanowy.api.notes;
|
package io.github.wulkanowy.api.notes;
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class NotesListTest {
|
public class NotesListTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private String fixtureFilledFileName = "UwagiOsiagniecia-filled.html";
|
private NotesList filled;
|
||||||
|
|
||||||
private String fixtureEmptyFileName = "UwagiOsiagniecia-empty.html";
|
private NotesList empty;
|
||||||
|
|
||||||
private NotesList getSetUpNotesList(String fixtureFileName) throws Exception {
|
@Before
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
public void setUp() throws Exception {
|
||||||
|
filled = new NotesList(getSnp("UwagiOsiagniecia-filled.html"));
|
||||||
Document notesPageDocument = Jsoup.parse(input);
|
empty = new NotesList(getSnp("UwagiOsiagniecia-empty.html"));
|
||||||
|
|
||||||
StudentAndParent snp = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(notesPageDocument);
|
|
||||||
Mockito.when(snp.getRowDataChildValue(Mockito.any(Element.class),
|
|
||||||
Mockito.anyInt())).thenCallRealMethod();
|
|
||||||
|
|
||||||
return new NotesList(snp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllNotesFilledTest() throws Exception {
|
public void getAllNotesTest() throws Exception {
|
||||||
List<Note> list = getSetUpNotesList(fixtureFilledFileName).getAllNotes();
|
Assert.assertEquals(3, filled.getAllNotes().size());
|
||||||
|
Assert.assertEquals(0, empty.getAllNotes().size());
|
||||||
Assert.assertEquals(3, list.size());
|
|
||||||
|
|
||||||
Assert.assertEquals("06.06.2017", list.get(0).getDate());
|
|
||||||
Assert.assertEquals("Jan Kowalski [JK]", list.get(0).getTeacher());
|
|
||||||
Assert.assertEquals("Zaangażowanie społeczne", list.get(0).getCategory());
|
|
||||||
Assert.assertEquals("Pomoc przy pikniku charytatywnym", list.get(0).getContent());
|
|
||||||
|
|
||||||
Assert.assertEquals("01.10.2016", list.get(2).getDate());
|
|
||||||
Assert.assertEquals("Kochański Leszek [KL]", list.get(2).getTeacher());
|
|
||||||
Assert.assertEquals("Zachowanie na lekcji", list.get(2).getCategory());
|
|
||||||
Assert.assertEquals("Przeszkadzanie w prowadzeniu lekcji", list.get(2).getContent());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAllNotesWhenEmpty() throws Exception {
|
public void getDateTest() throws Exception {
|
||||||
List<Note> list = getSetUpNotesList(fixtureEmptyFileName).getAllNotes();
|
List<Note> filledList = filled.getAllNotes();
|
||||||
|
|
||||||
Assert.assertEquals(0, list.size());
|
Assert.assertEquals("06.06.2017", filledList.get(0).getDate());
|
||||||
|
Assert.assertEquals("01.10.2016", filledList.get(2).getDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTeacherTest() throws Exception {
|
||||||
|
List<Note> filledList = filled.getAllNotes();
|
||||||
|
|
||||||
|
Assert.assertEquals("Jan Kowalski [JK]", filledList.get(0).getTeacher());
|
||||||
|
Assert.assertEquals("Kochański Leszek [KL]", filledList.get(2).getTeacher());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getCategoryTest() throws Exception {
|
||||||
|
List<Note> filledList = filled.getAllNotes();
|
||||||
|
|
||||||
|
Assert.assertEquals("Zaangażowanie społeczne", filledList.get(0).getCategory());
|
||||||
|
Assert.assertEquals("Zachowanie na lekcji", filledList.get(2).getCategory());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getContentTest() throws Exception {
|
||||||
|
List<Note> filledList = filled.getAllNotes();
|
||||||
|
|
||||||
|
Assert.assertEquals("Pomoc przy pikniku charytatywnym", filledList.get(0).getContent());
|
||||||
|
Assert.assertEquals("Przeszkadzanie w prowadzeniu lekcji", filledList.get(2).getContent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,30 +4,45 @@ import org.junit.Assert;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class SchoolInfoTest extends SchoolTest {
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
|
|
||||||
|
public class SchoolInfoTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private SchoolInfo schoolInfo;
|
private SchoolInfo schoolInfo;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
schoolInfo = new SchoolInfo(getSnp("Szkola.html"));
|
||||||
schoolInfo = new SchoolInfo(snp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getSchoolDataTest() throws Exception {
|
public void getNameTest() throws Exception {
|
||||||
SchoolData schoolData = schoolInfo.getSchoolData();
|
Assert.assertEquals("Zespół Szkół nr 64", schoolInfo.getSchoolData().getName());
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertEquals("Zespół Szkół nr 64", schoolData.getName());
|
@Test
|
||||||
|
public void getAddressTest() throws Exception {
|
||||||
Assert.assertEquals("ul. Wiśniowa 128, 01-234 Rogalowo, Nibylandia",
|
Assert.assertEquals("ul. Wiśniowa 128, 01-234 Rogalowo, Nibylandia",
|
||||||
schoolData.getAddress());
|
schoolInfo.getSchoolData().getAddress());
|
||||||
Assert.assertEquals("55 5555555", schoolData.getPhoneNumber());
|
}
|
||||||
Assert.assertEquals("Antoni Sobczyk", schoolData.getHeadmaster());
|
|
||||||
|
@Test
|
||||||
|
public void getPhoneNumberTest() throws Exception {
|
||||||
|
Assert.assertEquals("55 5555555", schoolInfo.getSchoolData().getPhoneNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getHeadmasterTest() throws Exception {
|
||||||
|
Assert.assertEquals("Antoni Sobczyk", schoolInfo.getSchoolData().getHeadmaster());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPedagoguesTest() throws Exception {
|
||||||
Assert.assertArrayEquals(new String[]{
|
Assert.assertArrayEquals(new String[]{
|
||||||
"Zofia Czerwińska [ZC]",
|
"Zofia Czerwińska [ZC]",
|
||||||
"Aleksander Krzemiński [AK]",
|
"Aleksander Krzemiński [AK]",
|
||||||
"Karolina Kowalska [KK]",
|
"Karolina Kowalska [KK]",
|
||||||
"Bartek Dąbrowski [BD]"
|
"Bartek Dąbrowski [BD]"
|
||||||
}, schoolData.getPedagogues());
|
}, schoolInfo.getSchoolData().getPedagogues());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
package io.github.wulkanowy.api.school;
|
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class SchoolTest {
|
|
||||||
|
|
||||||
protected StudentAndParent snp;
|
|
||||||
private String fixtureFileName = "Szkola.html";
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
|
||||||
|
|
||||||
Document schoolPageDocument = Jsoup.parse(input);
|
|
||||||
|
|
||||||
snp = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(schoolPageDocument);
|
|
||||||
Mockito.when(snp.getRowDataChildValue(Mockito.any(Element.class),
|
|
||||||
Mockito.anyInt())).thenCallRealMethod();
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,35 +6,47 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TeachersInfoTest extends SchoolTest {
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
|
|
||||||
|
public class TeachersInfoTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private TeachersInfo teachersInfo;
|
private TeachersInfo teachersInfo;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
teachersInfo = new TeachersInfo(getSnp("Szkola.html"));
|
||||||
teachersInfo = new TeachersInfo(snp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getTeachersDataTest() throws Exception {
|
public void getClassNameTest() throws Exception {
|
||||||
TeachersData teachersData = teachersInfo.getTeachersData();
|
Assert.assertEquals("1a", teachersInfo.getTeachersData().getClassName());
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertEquals("1a", teachersData.getClassName());
|
@Test
|
||||||
|
public void getClassTeacherTest() throws Exception {
|
||||||
Assert.assertArrayEquals(new String[]{
|
Assert.assertArrayEquals(new String[]{
|
||||||
"Karolina Kowalska [AN]",
|
"Karolina Kowalska [AN]",
|
||||||
"Antoni Sobczyk [AS]"
|
"Antoni Sobczyk [AS]"
|
||||||
}, teachersData.getClassTeacher());
|
}, teachersInfo.getTeachersData().getClassTeacher());
|
||||||
|
}
|
||||||
|
|
||||||
List<Subject> subjects = teachersData.getSubjects();
|
@Test
|
||||||
|
public void getTeachersDataSubjectsNameTest() throws Exception {
|
||||||
|
List<Subject> subjects = teachersInfo.getTeachersData().getSubjects();
|
||||||
|
|
||||||
Assert.assertEquals("Biologia", subjects.get(0).getName());
|
Assert.assertEquals("Biologia", subjects.get(0).getName());
|
||||||
|
Assert.assertEquals("Język angielski", subjects.get(6).getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTeachersDataSubjectsTeachersTest() throws Exception {
|
||||||
|
List<Subject> subjects = teachersInfo.getTeachersData().getSubjects();
|
||||||
|
|
||||||
Assert.assertArrayEquals(new String[]{"Karolina Kowalska [AN]"},
|
Assert.assertArrayEquals(new String[]{"Karolina Kowalska [AN]"},
|
||||||
subjects.get(0).getTeachers());
|
subjects.get(0).getTeachers());
|
||||||
Assert.assertEquals("Karolina Kowalska [AN]",
|
Assert.assertEquals("Karolina Kowalska [AN]",
|
||||||
subjects.get(0).getTeachers()[0]);
|
subjects.get(0).getTeachers()[0]);
|
||||||
|
|
||||||
Assert.assertEquals("Język angielski", subjects.get(6).getName());
|
|
||||||
Assert.assertArrayEquals(new String[]{
|
Assert.assertArrayEquals(new String[]{
|
||||||
"Karolina Kowalska [AN]",
|
"Karolina Kowalska [AN]",
|
||||||
"Mateusz Kowal [MK]",
|
"Mateusz Kowal [MK]",
|
||||||
|
@ -1,222 +0,0 @@
|
|||||||
package io.github.wulkanowy.api.timetable;
|
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class TableTest {
|
|
||||||
|
|
||||||
private String fixtureStdFileName = "PlanLekcji-std.html";
|
|
||||||
|
|
||||||
private String fixtureHolidaysFileName = "PlanLekcji-holidays.html";
|
|
||||||
|
|
||||||
private String fixtureFullFileName = "PlanLekcji-full.html";
|
|
||||||
|
|
||||||
private Table getSetUpTable(String fixtureFileName) throws Exception {
|
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
|
||||||
|
|
||||||
Document tablePageDocument = Jsoup.parse(input);
|
|
||||||
|
|
||||||
StudentAndParent timetable = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(timetable.getSnPPageDocument(Mockito.anyString()))
|
|
||||||
.thenReturn(tablePageDocument);
|
|
||||||
|
|
||||||
return new Table(timetable);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableStandardTest() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureStdFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
Assert.assertEquals(5, week.getDays().size());
|
|
||||||
Assert.assertEquals("19.06.2017", week.getStartDayDate());
|
|
||||||
|
|
||||||
Assert.assertEquals("19.06.2017", week.getDay(0).getDate());
|
|
||||||
Assert.assertEquals("23.06.2017", week.getDay(4).getDate());
|
|
||||||
|
|
||||||
Assert.assertFalse(week.getDay(4).isFreeDay());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableStandardLessonStartEndEndTest() throws Exception {
|
|
||||||
Table tableStd = getSetUpTable(fixtureStdFileName);
|
|
||||||
Week stdWeek = tableStd.getWeekTable();
|
|
||||||
|
|
||||||
Assert.assertEquals("08:00", stdWeek.getDay(0).getLesson(0).getStartTime());
|
|
||||||
Assert.assertEquals("08:45", stdWeek.getDay(1).getLesson(0).getEndTime());
|
|
||||||
Assert.assertEquals("12:15", stdWeek.getDay(2).getLesson(4).getEndTime());
|
|
||||||
Assert.assertEquals("14:10", stdWeek.getDay(3).getLesson(7).getStartTime());
|
|
||||||
|
|
||||||
Table tableFull = getSetUpTable(fixtureFullFileName);
|
|
||||||
Week fullWeek = tableFull.getWeekTable();
|
|
||||||
|
|
||||||
Assert.assertEquals("07:10", fullWeek.getDay(0).getLesson(0).getStartTime());
|
|
||||||
Assert.assertEquals("07:55", fullWeek.getDay(1).getLesson(0).getEndTime());
|
|
||||||
Assert.assertEquals("12:20", fullWeek.getDay(2).getLesson(6).getStartTime());
|
|
||||||
Assert.assertEquals("19:00", fullWeek.getDay(3).getLesson(13).getEndTime());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(expected = IndexOutOfBoundsException.class)
|
|
||||||
public void getWeekTableStandardOutOfBoundsIndex() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureStdFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
week.getDay(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableHolidaysTest() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureHolidaysFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
Assert.assertTrue(week.getDay(1).isFreeDay());
|
|
||||||
|
|
||||||
Assert.assertNotEquals("Wakacje", week.getDay(2).getFreeDayName());
|
|
||||||
|
|
||||||
Assert.assertEquals("Ferie letnie", week.getDay(3).getFreeDayName());
|
|
||||||
Assert.assertEquals("31.07.2017", week.getStartDayDate());
|
|
||||||
Assert.assertEquals(5, week.getDays().size());
|
|
||||||
Assert.assertEquals(14, week.getDay(4).getLessons().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableHolidaysWithEmptyLessonsTest() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureHolidaysFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
Assert.assertEquals(5, week.getDays().size());
|
|
||||||
|
|
||||||
Assert.assertTrue(week.getDay(0).getLesson(5).isEmpty());
|
|
||||||
Assert.assertTrue(week.getDay(2).getLesson(13).isEmpty());
|
|
||||||
Assert.assertTrue(week.getDay(3).getLesson(0).isEmpty());
|
|
||||||
Assert.assertTrue(week.getDay(4).getLesson(13).isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableFullTest() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureFullFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
Assert.assertFalse(week.getDay(1).getLesson(2).isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableFullLessonsGroupsDivisionTest() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureFullFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
// class="", span*4
|
|
||||||
Lesson lesson1 = week.getDay(0).getLesson(1);
|
|
||||||
Assert.assertTrue(lesson1.isDivisionIntoGroups());
|
|
||||||
Assert.assertEquals("J1", lesson1.getGroupName());
|
|
||||||
|
|
||||||
// class="", span*3
|
|
||||||
Lesson lesson2 = week.getDay(0).getLesson(7);
|
|
||||||
Assert.assertFalse(lesson2.isDivisionIntoGroups());
|
|
||||||
Assert.assertEquals("", lesson2.getGroupName());
|
|
||||||
|
|
||||||
// div*3 (2), class="x-treelabel-zas", span*4
|
|
||||||
Lesson lesson3 = week.getDay(1).getLesson(2);
|
|
||||||
Assert.assertFalse(lesson3.isDivisionIntoGroups());
|
|
||||||
Assert.assertEquals("", lesson3.getGroupName());
|
|
||||||
|
|
||||||
// div*3 (2), class="x-treelabel-zas", span*5
|
|
||||||
Lesson lesson4 = week.getDay(1).getLesson(3);
|
|
||||||
Assert.assertTrue(lesson4.isDivisionIntoGroups());
|
|
||||||
Assert.assertEquals("wf2", lesson4.getGroupName());
|
|
||||||
|
|
||||||
// class="x-treelabel-ppl", span*3
|
|
||||||
Lesson lesson5 = week.getDay(4).getLesson(0);
|
|
||||||
Assert.assertFalse(lesson5.isDivisionIntoGroups());
|
|
||||||
Assert.assertEquals("", lesson5.getGroupName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableFullLessonsTypesTest() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureFullFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
// class="", span*4
|
|
||||||
Lesson lesson1 = week.getDay(0).getLesson(1);
|
|
||||||
Assert.assertFalse(lesson1.isPlanning());
|
|
||||||
Assert.assertTrue(lesson1.isRealized());
|
|
||||||
Assert.assertFalse(lesson1.isMovedOrCanceled());
|
|
||||||
Assert.assertFalse(lesson1.isNewMovedInOrChanged());
|
|
||||||
|
|
||||||
// class="", span*3
|
|
||||||
Lesson lesson2 = week.getDay(0).getLesson(7);
|
|
||||||
Assert.assertFalse(lesson2.isPlanning());
|
|
||||||
Assert.assertTrue(lesson2.isRealized());
|
|
||||||
Assert.assertTrue(lesson2.isMovedOrCanceled());
|
|
||||||
Assert.assertFalse(lesson2.isNewMovedInOrChanged());
|
|
||||||
|
|
||||||
// div*3 (2), class="x-treelabel-zas", span*4
|
|
||||||
Lesson lesson3 = week.getDay(1).getLesson(2);
|
|
||||||
Assert.assertFalse(lesson3.isPlanning());
|
|
||||||
Assert.assertTrue(lesson3.isRealized());
|
|
||||||
Assert.assertFalse(lesson3.isMovedOrCanceled());
|
|
||||||
Assert.assertTrue(lesson3.isNewMovedInOrChanged());
|
|
||||||
|
|
||||||
// div*3 (2), class="x-treelabel-zas", span*5
|
|
||||||
Lesson lesson4 = week.getDay(1).getLesson(3);
|
|
||||||
Assert.assertFalse(lesson4.isPlanning());
|
|
||||||
Assert.assertTrue(lesson4.isRealized());
|
|
||||||
Assert.assertFalse(lesson4.isMovedOrCanceled());
|
|
||||||
Assert.assertTrue(lesson4.isNewMovedInOrChanged());
|
|
||||||
|
|
||||||
// class="x-treelabel-ppl", span*3
|
|
||||||
Lesson lesson5 = week.getDay(4).getLesson(0);
|
|
||||||
Assert.assertTrue(lesson5.isPlanning());
|
|
||||||
Assert.assertFalse(lesson5.isRealized());
|
|
||||||
Assert.assertFalse(lesson5.isMovedOrCanceled());
|
|
||||||
Assert.assertFalse(lesson5.isNewMovedInOrChanged());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void getWeekTableFullLessonsBasicInfoTest() throws Exception {
|
|
||||||
Table table = getSetUpTable(fixtureFullFileName);
|
|
||||||
Week week = table.getWeekTable();
|
|
||||||
|
|
||||||
// class="", span*4
|
|
||||||
Lesson lesson1 = week.getDay(0).getLesson(1);
|
|
||||||
Assert.assertEquals("Język angielski", lesson1.getSubject());
|
|
||||||
Assert.assertEquals("Kobczyk Iwona", lesson1.getTeacher());
|
|
||||||
Assert.assertEquals("", lesson1.getRoom());
|
|
||||||
Assert.assertEquals("", lesson1.getDescription());
|
|
||||||
|
|
||||||
// class="", span*3
|
|
||||||
Lesson lesson2 = week.getDay(0).getLesson(7);
|
|
||||||
Assert.assertEquals("Fizyka", lesson2.getSubject());
|
|
||||||
Assert.assertEquals("Bączek Grzegorz", lesson2.getTeacher());
|
|
||||||
Assert.assertEquals("33", lesson2.getRoom());
|
|
||||||
Assert.assertEquals("okienko dla uczniów", lesson2.getDescription());
|
|
||||||
|
|
||||||
// div*3 (2), class="x-treelabel-zas", span*4
|
|
||||||
Lesson lesson3 = week.getDay(1).getLesson(2);
|
|
||||||
Assert.assertEquals("Język polski", lesson3.getSubject());
|
|
||||||
Assert.assertEquals("Bocian Natalia", lesson3.getTeacher());
|
|
||||||
Assert.assertEquals("", lesson3.getRoom());
|
|
||||||
Assert.assertEquals("przeniesiona z lekcji 7, 20.06.2017", lesson3.getDescription());
|
|
||||||
|
|
||||||
// div*3 (2), class="x-treelabel-zas", span*5
|
|
||||||
Lesson lesson4 = week.getDay(1).getLesson(3);
|
|
||||||
Assert.assertEquals("Wychowanie fizyczne", lesson4.getSubject());
|
|
||||||
Assert.assertEquals("Nowicka Irena", lesson4.getTeacher());
|
|
||||||
Assert.assertEquals("", lesson4.getRoom());
|
|
||||||
Assert.assertEquals("przeniesiona z lekcji 4, 20.06.2017", lesson4.getDescription());
|
|
||||||
|
|
||||||
// class="x-treelabel-ppl", span*3
|
|
||||||
Lesson lesson5 = week.getDay(4).getLesson(0);
|
|
||||||
Assert.assertEquals("Uroczyste zakończenie roku szkolnego", lesson5.getSubject());
|
|
||||||
Assert.assertEquals("Baran Małgorzata", lesson5.getTeacher());
|
|
||||||
Assert.assertEquals("37", lesson5.getRoom());
|
|
||||||
Assert.assertEquals("", lesson5.getDescription());
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,195 @@
|
|||||||
|
package io.github.wulkanowy.api.timetable;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
|
|
||||||
|
public class TimetableTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
|
private Timetable std;
|
||||||
|
|
||||||
|
private Timetable full;
|
||||||
|
|
||||||
|
private Timetable holidays;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
std = new Timetable(getSnp("PlanLekcji-std.html"));
|
||||||
|
full = new Timetable(getSnp("PlanLekcji-full.html"));
|
||||||
|
holidays = new Timetable(getSnp("PlanLekcji-holidays.html"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Week
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getWeekTableTest() throws Exception {
|
||||||
|
Assert.assertEquals(5, std.getWeekTable().getDays().size());
|
||||||
|
Assert.assertEquals(5, full.getWeekTable().getDays().size());
|
||||||
|
Assert.assertEquals(5, holidays.getWeekTable().getDays().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getStartDayDateTest() throws Exception {
|
||||||
|
Assert.assertEquals("19.06.2017", std.getWeekTable().getStartDayDate());
|
||||||
|
Assert.assertEquals("19.06.2017", full.getWeekTable().getStartDayDate());
|
||||||
|
Assert.assertEquals("31.07.2017", holidays.getWeekTable().getStartDayDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Day
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDayDateTest() throws Exception {
|
||||||
|
Assert.assertEquals("19.06.2017", std.getWeekTable().getDay(0).getDate());
|
||||||
|
Assert.assertEquals("23.06.2017", std.getWeekTable().getDay(4).getDate());
|
||||||
|
Assert.assertEquals("20.06.2017", full.getWeekTable().getDay(1).getDate());
|
||||||
|
Assert.assertEquals("22.06.2017", full.getWeekTable().getDay(3).getDate());
|
||||||
|
Assert.assertEquals("02.08.2017", holidays.getWeekTable().getDay(2).getDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDayIsFreeTest() throws Exception {
|
||||||
|
Assert.assertFalse(std.getWeekTable().getDay(0).isFreeDay());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(2).isFreeDay());
|
||||||
|
Assert.assertTrue(holidays.getWeekTable().getDay(4).isFreeDay());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDayFreeDayName() throws Exception {
|
||||||
|
Assert.assertNotEquals("Wakacje", std.getWeekTable().getDay(0).getFreeDayName());
|
||||||
|
Assert.assertNotEquals("Ferie letnie", full.getWeekTable().getDay(1).getFreeDayName());
|
||||||
|
Assert.assertNotEquals("Wakacje", holidays.getWeekTable().getDay(2).getFreeDayName());
|
||||||
|
Assert.assertEquals("Ferie letnie", holidays.getWeekTable().getDay(4).getFreeDayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getDayLessonsTest() throws Exception {
|
||||||
|
Assert.assertEquals(8, std.getWeekTable().getDay(0).getLessons().size());
|
||||||
|
Assert.assertEquals(14, full.getWeekTable().getDay(2).getLessons().size());
|
||||||
|
Assert.assertEquals(14, holidays.getWeekTable().getDay(4).getLessons().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lesson
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonSubjectTest() throws Exception {
|
||||||
|
Assert.assertEquals("Historia", std.getWeekTable().getDay(0).getLesson(1).getSubject());
|
||||||
|
Assert.assertEquals("Zajęcia techniczne", std.getWeekTable().getDay(2).getLesson(4).getSubject());
|
||||||
|
Assert.assertEquals("Język angielski", full.getWeekTable().getDay(0).getLesson(1).getSubject());
|
||||||
|
Assert.assertEquals("Uroczyste zakończenie roku szkolnego", full.getWeekTable().getDay(4).getLesson(0).getSubject());
|
||||||
|
Assert.assertEquals("", holidays.getWeekTable().getDay(3).getLesson(3).getSubject());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonTeacherTest() throws Exception {
|
||||||
|
Assert.assertEquals("Bogatka Katarzyna", std.getWeekTable().getDay(0).getLesson(1).getTeacher());
|
||||||
|
Assert.assertEquals("Chlebowski Stanisław", std.getWeekTable().getDay(2).getLesson(4).getTeacher());
|
||||||
|
Assert.assertEquals("Kobczyk Iwona", full.getWeekTable().getDay(0).getLesson(1).getTeacher());
|
||||||
|
Assert.assertEquals("Bączek Grzegorz", full.getWeekTable().getDay(0).getLesson(7).getTeacher());
|
||||||
|
Assert.assertEquals("Baran Małgorzata", full.getWeekTable().getDay(4).getLesson(0).getTeacher());
|
||||||
|
Assert.assertEquals("", holidays.getWeekTable().getDay(3).getLesson(3).getTeacher());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonRoomTest() throws Exception {
|
||||||
|
Assert.assertEquals("", std.getWeekTable().getDay(3).getLesson(3).getRoom());
|
||||||
|
Assert.assertEquals("33", full.getWeekTable().getDay(0).getLesson(7).getRoom());
|
||||||
|
Assert.assertEquals("32", full.getWeekTable().getDay(1).getLesson(8).getRoom());
|
||||||
|
Assert.assertEquals("37", full.getWeekTable().getDay(4).getLesson(0).getRoom());
|
||||||
|
Assert.assertEquals("", holidays.getWeekTable().getDay(3).getLesson(3).getRoom());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonDescriptionTest() throws Exception {
|
||||||
|
Assert.assertEquals("", std.getWeekTable().getDay(3).getLesson(3).getDescription());
|
||||||
|
Assert.assertEquals("okienko dla uczniów", full.getWeekTable().getDay(0).getLesson(7).getDescription());
|
||||||
|
Assert.assertEquals("przeniesiona z lekcji 7, 20.06.2017", full.getWeekTable().getDay(1).getLesson(2).getDescription());
|
||||||
|
Assert.assertEquals("przeniesiona z lekcji 4, 20.06.2017", full.getWeekTable().getDay(1).getLesson(3).getDescription());
|
||||||
|
Assert.assertEquals("", full.getWeekTable().getDay(4).getLesson(0).getDescription());
|
||||||
|
Assert.assertEquals("", holidays.getWeekTable().getDay(3).getLesson(3).getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonGroupNameTest() throws Exception {
|
||||||
|
Assert.assertEquals("CH", std.getWeekTable().getDay(0).getLesson(2).getGroupName());
|
||||||
|
Assert.assertEquals("JNPW", std.getWeekTable().getDay(4).getLesson(0).getGroupName());
|
||||||
|
Assert.assertEquals("", full.getWeekTable().getDay(0).getLesson(7).getGroupName());
|
||||||
|
Assert.assertEquals("wf2", full.getWeekTable().getDay(1).getLesson(3).getGroupName());
|
||||||
|
Assert.assertEquals("", holidays.getWeekTable().getDay(3).getLesson(3).getGroupName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonStartTimeTest() throws Exception {
|
||||||
|
Assert.assertEquals("08:00", std.getWeekTable().getDay(0).getLesson(0).getStartTime());
|
||||||
|
Assert.assertEquals("14:10", std.getWeekTable().getDay(3).getLesson(7).getStartTime());
|
||||||
|
Assert.assertEquals("07:10", full.getWeekTable().getDay(0).getLesson(0).getStartTime());
|
||||||
|
Assert.assertEquals("12:20", full.getWeekTable().getDay(2).getLesson(6).getStartTime());
|
||||||
|
Assert.assertEquals("12:20", holidays.getWeekTable().getDay(2).getLesson(6).getStartTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonEndTimeTest() throws Exception {
|
||||||
|
Assert.assertEquals("08:45", std.getWeekTable().getDay(1).getLesson(0).getEndTime());
|
||||||
|
Assert.assertEquals("12:15", std.getWeekTable().getDay(2).getLesson(4).getEndTime());
|
||||||
|
Assert.assertEquals("07:55", full.getWeekTable().getDay(1).getLesson(0).getEndTime());
|
||||||
|
Assert.assertEquals("19:00", full.getWeekTable().getDay(3).getLesson(13).getEndTime());
|
||||||
|
Assert.assertEquals("19:00", holidays.getWeekTable().getDay(3).getLesson(13).getEndTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonIsEmptyTest() throws Exception {
|
||||||
|
Assert.assertFalse(std.getWeekTable().getDay(1).getLesson(4).isEmpty());
|
||||||
|
Assert.assertTrue(std.getWeekTable().getDay(3).getLesson(7).isEmpty());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(1).getLesson(2).isEmpty());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(0).getLesson(7).isEmpty());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(2).getLesson(9).isEmpty());
|
||||||
|
Assert.assertTrue(holidays.getWeekTable().getDay(0).getLesson(5).isEmpty());
|
||||||
|
Assert.assertTrue(holidays.getWeekTable().getDay(4).getLesson(13).isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonIsDivisionIntoGroupsTest() throws Exception {
|
||||||
|
Assert.assertTrue(std.getWeekTable().getDay(0).getLesson(2).isDivisionIntoGroups());
|
||||||
|
Assert.assertTrue(std.getWeekTable().getDay(4).getLesson(0).isDivisionIntoGroups());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(0).getLesson(7).isDivisionIntoGroups());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(3).isDivisionIntoGroups());
|
||||||
|
Assert.assertFalse(holidays.getWeekTable().getDay(3).getLesson(3).isDivisionIntoGroups());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonIsPlanningTest() throws Exception {
|
||||||
|
Assert.assertFalse(std.getWeekTable().getDay(4).getLesson(4).isPlanning());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(0).getLesson(1).isPlanning());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(1).getLesson(3).isPlanning());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(4).getLesson(0).isPlanning());
|
||||||
|
Assert.assertFalse(holidays.getWeekTable().getDay(3).getLesson(3).isPlanning());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonIsRealizedTest() throws Exception {
|
||||||
|
Assert.assertTrue(std.getWeekTable().getDay(3).getLesson(3).isRealized());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(0).getLesson(1).isRealized());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(3).isRealized());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(0).isRealized());
|
||||||
|
Assert.assertFalse(holidays.getWeekTable().getDay(3).getLesson(3).isRealized());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonIsMovedOrCanceledTest() throws Exception {
|
||||||
|
Assert.assertFalse(std.getWeekTable().getDay(3).getLesson(3).isMovedOrCanceled());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(0).getLesson(7).isMovedOrCanceled());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(1).getLesson(3).isMovedOrCanceled());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(4).getLesson(0).isMovedOrCanceled());
|
||||||
|
Assert.assertFalse(holidays.getWeekTable().getDay(3).getLesson(3).isMovedOrCanceled());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getLessonIsNewMovedInOrChangedTest() throws Exception {
|
||||||
|
Assert.assertFalse(std.getWeekTable().getDay(3).getLesson(3).isNewMovedInOrChanged());
|
||||||
|
Assert.assertFalse(full.getWeekTable().getDay(0).getLesson(1).isNewMovedInOrChanged());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(2).isNewMovedInOrChanged());
|
||||||
|
Assert.assertTrue(full.getWeekTable().getDay(1).getLesson(3).isNewMovedInOrChanged());
|
||||||
|
Assert.assertFalse(holidays.getWeekTable().getDay(3).getLesson(3).isNewMovedInOrChanged());
|
||||||
|
}
|
||||||
|
}
|
@ -4,47 +4,103 @@ import org.junit.Assert;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class BasicInformationTest extends UserTest {
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
|
|
||||||
|
public class BasicInformationTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private BasicInformation basicInformation;
|
private BasicInformation basicInformation;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
basicInformation = new BasicInformation(getSnp("UczenDanePodstawowe.html"));
|
||||||
basicInformation = new BasicInformation(snp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getPersonalData() throws Exception {
|
public void getPersonalFirstNameTest() throws Exception {
|
||||||
PersonalData data = basicInformation.getPersonalData();
|
Assert.assertEquals("Maria", basicInformation.getPersonalData().getFirstName());
|
||||||
|
|
||||||
Assert.assertEquals("Maria", data.getFirstName());
|
|
||||||
Assert.assertEquals("Kamińska", data.getSurname());
|
|
||||||
Assert.assertEquals("Maria Kamińska", data.getFirstAndLastName());
|
|
||||||
Assert.assertEquals("Maria Aneta Kamińska", data.getName());
|
|
||||||
Assert.assertEquals("01.01.1900, Warszawa", data.getDateAndBirthPlace());
|
|
||||||
Assert.assertEquals("12345678900", data.getPesel());
|
|
||||||
Assert.assertEquals("Kobieta", data.getGender());
|
|
||||||
Assert.assertTrue(data.isPolishCitizenship());
|
|
||||||
Assert.assertEquals("Nowak", data.getFamilyName());
|
|
||||||
Assert.assertEquals("Gabriela, Kamil", data.getParentsNames());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAddressData() throws Exception {
|
public void getPersonalSurnameTest() throws Exception {
|
||||||
AddressData data = basicInformation.getAddressData();
|
Assert.assertEquals("Kamińska", basicInformation.getPersonalData().getSurname());
|
||||||
|
|
||||||
Assert.assertEquals("ul. Sportowa 16, 00-123 Warszawa", data.getAddress());
|
|
||||||
Assert.assertEquals("ul. Sportowa 17, 00-123 Warszawa", data.getRegisteredAddress());
|
|
||||||
Assert.assertEquals("ul. Sportowa 18, 00-123 Warszawa", data.getCorrespondenceAddress());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getContactDetails() throws Exception {
|
public void getPersonalFirstAndLastNameTest() throws Exception {
|
||||||
ContactDetails data = basicInformation.getContactDetails();
|
Assert.assertEquals("Maria Kamińska",
|
||||||
|
basicInformation.getPersonalData().getFirstAndLastName());
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertEquals("005554433", data.getPhoneNumber());
|
@Test
|
||||||
Assert.assertEquals("555444333", data.getCellPhoneNumber());
|
public void getPersonalNameTest() throws Exception {
|
||||||
Assert.assertEquals("wulkanowy@example.null", data.getEmail());
|
Assert.assertEquals("Maria Aneta Kamińska", basicInformation.getPersonalData().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPersonalDateAndBirthPlaceTest() throws Exception {
|
||||||
|
Assert.assertEquals("01.01.1900, Warszawa",
|
||||||
|
basicInformation.getPersonalData().getDateAndBirthPlace());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPersonalPeselTest() throws Exception {
|
||||||
|
Assert.assertEquals("12345678900", basicInformation.getPersonalData().getPesel());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPersonalGenderTest() throws Exception {
|
||||||
|
Assert.assertEquals("Kobieta", basicInformation.getPersonalData().getGender());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void isPersonalPolishCitizenshipTest() throws Exception {
|
||||||
|
Assert.assertTrue(basicInformation.getPersonalData().isPolishCitizenship());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPersonalFamilyNameTest() throws Exception {
|
||||||
|
Assert.assertEquals("Nowak", basicInformation.getPersonalData().getFamilyName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPersonalParentsNames() throws Exception {
|
||||||
|
Assert.assertEquals("Gabriela, Kamil",
|
||||||
|
basicInformation.getPersonalData().getParentsNames());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getBasicAddressTest() throws Exception {
|
||||||
|
Assert.assertEquals("ul. Sportowa 16, 00-123 Warszawa",
|
||||||
|
basicInformation.getAddressData().getAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getBasicRegisteredAddressTest() throws Exception {
|
||||||
|
Assert.assertEquals("ul. Sportowa 17, 00-123 Warszawa",
|
||||||
|
basicInformation.getAddressData().getRegisteredAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getBasicCorrespondenceAddressTest() throws Exception {
|
||||||
|
Assert.assertEquals("ul. Sportowa 18, 00-123 Warszawa",
|
||||||
|
basicInformation.getAddressData().getCorrespondenceAddress());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getContactPhoneNumberTest() throws Exception {
|
||||||
|
Assert.assertEquals("005554433",
|
||||||
|
basicInformation.getContactDetails().getPhoneNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getContactCellPhoneNumberTest() throws Exception {
|
||||||
|
Assert.assertEquals("555444333",
|
||||||
|
basicInformation.getContactDetails().getCellPhoneNumber());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getContactEmailTest() throws Exception {
|
||||||
|
Assert.assertEquals("wulkanowy@example.null",
|
||||||
|
basicInformation.getContactDetails().getEmail());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,34 +6,54 @@ import org.junit.Test;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FamilyInformationTest extends UserTest {
|
import io.github.wulkanowy.api.StudentAndParentTestCase;
|
||||||
|
|
||||||
|
public class FamilyInformationTest extends StudentAndParentTestCase {
|
||||||
|
|
||||||
private FamilyInformation familyInformation;
|
private FamilyInformation familyInformation;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
familyInformation = new FamilyInformation(getSnp("UczenDanePodstawowe.html"));
|
||||||
familyInformation = new FamilyInformation(snp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getFamilyMembers() throws Exception {
|
public void getFamilyMembers() throws Exception {
|
||||||
List<FamilyMember> familyMemberList = familyInformation.getFamilyMembers();
|
Assert.assertEquals(2, familyInformation.getFamilyMembers().size());
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertEquals(2, familyMemberList.size());
|
@Test
|
||||||
|
public void getNameTest() throws Exception {
|
||||||
|
List<FamilyMember> list = familyInformation.getFamilyMembers();
|
||||||
|
Assert.assertEquals("Marianna Pająk", list.get(0).getName());
|
||||||
|
Assert.assertEquals("Dawid Świątek", list.get(1).getName());
|
||||||
|
}
|
||||||
|
|
||||||
FamilyMember member0 = familyMemberList.get(0);
|
@Test
|
||||||
Assert.assertEquals("Marianna Pająk", member0.getName());
|
public void getKinshipTest() throws Exception {
|
||||||
Assert.assertEquals("matka", member0.getKinship());
|
List<FamilyMember> list = familyInformation.getFamilyMembers();
|
||||||
Assert.assertEquals("ul. Sportowa 16, 00-123 Warszawa", member0.getAddress());
|
Assert.assertEquals("matka", list.get(0).getKinship());
|
||||||
Assert.assertEquals("555111222", member0.getTelephones());
|
Assert.assertEquals("ojciec", list.get(1).getKinship());
|
||||||
Assert.assertEquals("wulkanowy@example.null", member0.getEmail());
|
}
|
||||||
|
|
||||||
FamilyMember member1 = familyMemberList.get(1);
|
@Test
|
||||||
Assert.assertEquals("Dawid Świątek", member1.getName());
|
public void getAddressTest() throws Exception {
|
||||||
Assert.assertEquals("ojciec", member1.getKinship());
|
List<FamilyMember> list = familyInformation.getFamilyMembers();
|
||||||
Assert.assertEquals("ul. Sportowa 18, 00-123 Warszawa", member1.getAddress());
|
Assert.assertEquals("ul. Sportowa 16, 00-123 Warszawa", list.get(0).getAddress());
|
||||||
Assert.assertEquals("555222111", member1.getTelephones());
|
Assert.assertEquals("ul. Sportowa 18, 00-123 Warszawa", list.get(1).getAddress());
|
||||||
Assert.assertEquals("wulkanowy@example.null", member1.getEmail());
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getTelephonesTest() throws Exception {
|
||||||
|
List<FamilyMember> list = familyInformation.getFamilyMembers();
|
||||||
|
Assert.assertEquals("555111222", list.get(0).getTelephones());
|
||||||
|
Assert.assertEquals("555222111", list.get(1).getTelephones());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getEmailTest() throws Exception {
|
||||||
|
List<FamilyMember> list = familyInformation.getFamilyMembers();
|
||||||
|
Assert.assertEquals("wulkanowy@example.null", list.get(0).getEmail());
|
||||||
|
Assert.assertEquals("wulkanowy@example.null", list.get(1).getEmail());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
package io.github.wulkanowy.api.user;
|
|
||||||
|
|
||||||
import org.jsoup.Jsoup;
|
|
||||||
import org.jsoup.nodes.Document;
|
|
||||||
import org.jsoup.nodes.Element;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
import io.github.wulkanowy.api.FixtureHelper;
|
|
||||||
import io.github.wulkanowy.api.StudentAndParent;
|
|
||||||
|
|
||||||
public class UserTest {
|
|
||||||
|
|
||||||
protected StudentAndParent snp;
|
|
||||||
|
|
||||||
private String fixtureFileName = "UczenDanePodstawowe.html";
|
|
||||||
|
|
||||||
@Before
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
String input = FixtureHelper.getAsString(getClass().getResourceAsStream(fixtureFileName));
|
|
||||||
|
|
||||||
Document pageDocument = Jsoup.parse(input);
|
|
||||||
|
|
||||||
snp = Mockito.mock(StudentAndParent.class);
|
|
||||||
Mockito.when(snp.getSnPPageDocument(Mockito.anyString())).thenReturn(pageDocument);
|
|
||||||
Mockito.when(snp.getRowDataChildValue(Mockito.any(Element.class), Mockito.anyInt()))
|
|
||||||
.thenCallRealMethod();
|
|
||||||
}
|
|
||||||
}
|
|
24
app/src/test/resources/io/github/wulkanowy/api/Start.html
Normal file
24
app/src/test/resources/io/github/wulkanowy/api/Start.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Uonet+</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="startScreen">
|
||||||
|
<div class="holder">
|
||||||
|
<div class="content">
|
||||||
|
<div class="panel linkownia pracownik klient">
|
||||||
|
<a href="https://uonetplus-opiekun.vulcan.net.pl/symbol/534213/Start/Index/">
|
||||||
|
<div class="imagedHeader directLink">
|
||||||
|
<div id="idEmptyAppUczeń">
|
||||||
|
<div class="name">Uczeń</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -41,19 +41,19 @@
|
|||||||
<td>08:00 08:45</td>
|
<td>08:00 08:45</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język angielski [J1]</span>
|
<span>Język angielski [J1]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Kobczyk Iwona</span>
|
<span>Kobczyk Iwona</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Użytkowanie urządzeń peryferyjnych komputera [zaw2]</span>
|
<span>Użytkowanie urządzeń peryferyjnych komputera [zaw2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Bączek Robert</span>
|
<span>Bączek Robert</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -64,9 +64,9 @@
|
|||||||
<td>08:50 09:35</td>
|
<td>08:50 09:35</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język polski</span>
|
<span>Język polski</span>
|
||||||
<span class="">Bocian Natalia</span>
|
<span>Bocian Natalia</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -84,24 +84,24 @@
|
|||||||
<span class="x-treelabel-rlz">(przeniesiona z lekcji 7, 20.06.2017)</span>
|
<span class="x-treelabel-rlz">(przeniesiona z lekcji 7, 20.06.2017)</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język polski</span>
|
<span>Język polski</span>
|
||||||
<span class="">Bocian Natalia</span>
|
<span>Bocian Natalia</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Urządzenia techniki komputerowej [zaw2]</span>
|
<span>Urządzenia techniki komputerowej [zaw2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Bocian Grzegorz</span>
|
<span>Bocian Grzegorz</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Baran Małgorzata</span>
|
<span>Baran Małgorzata</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -111,9 +111,9 @@
|
|||||||
<td>09:40 10:25</td>
|
<td>09:40 10:25</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język polski</span>
|
<span>Język polski</span>
|
||||||
<span class="">Bocian Natalia</span>
|
<span>Bocian Natalia</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -131,26 +131,26 @@
|
|||||||
<span class="x-treelabel-rlz">(przeniesiona z lekcji 4, 20.06.2017)</span>
|
<span class="x-treelabel-rlz">(przeniesiona z lekcji 4, 20.06.2017)</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wychowanie fizyczne [wf2]</span>
|
<span>Wychowanie fizyczne [wf2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Nowicka Irena</span>
|
<span>Nowicka Irena</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Metodologia programowania [zaw2]</span>
|
<span>Metodologia programowania [zaw2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Baran Małgorzata</span>
|
<span>Baran Małgorzata</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wychowanie fizyczne [wf2]</span>
|
<span>Wychowanie fizyczne [wf2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Nowicka Irena</span>
|
<span>Nowicka Irena</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -160,10 +160,10 @@
|
|||||||
<td>10:40 11:25</td>
|
<td>10:40 11:25</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Urządzenia techniki komputerowej [zaw2]</span>
|
<span>Urządzenia techniki komputerowej [zaw2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Bocian Grzegorz</span>
|
<span>Bocian Grzegorz</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -177,17 +177,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Baran Małgorzata</span>
|
<span>Baran Małgorzata</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wychowanie fizyczne [wf2]</span>
|
<span>Wychowanie fizyczne [wf2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Nowicka Irena</span>
|
<span>Nowicka Irena</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -197,10 +197,10 @@
|
|||||||
<td>11:30 12:15</td>
|
<td>11:30 12:15</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Urządzenia techniki komputerowej [zaw2]</span>
|
<span>Urządzenia techniki komputerowej [zaw2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Bocian Grzegorz</span>
|
<span>Bocian Grzegorz</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -213,17 +213,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Religia</span>
|
<span>Religia</span>
|
||||||
<span class="">Cyranka Krystian</span>
|
<span>Cyranka Krystian</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Sieci komputerowe i administrowanie sieciami [zaw2]</span>
|
<span>Sieci komputerowe i administrowanie sieciami [zaw2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Rożeniec Piotr</span>
|
<span>Rożeniec Piotr</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -233,9 +233,9 @@
|
|||||||
<td>12:20 13:05</td>
|
<td>12:20 13:05</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Baran Małgorzata</span>
|
<span>Baran Małgorzata</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -248,17 +248,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język angielski [J1]</span>
|
<span>Język angielski [J1]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Brodziec Sylwia</span>
|
<span>Brodziec Sylwia</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Religia</span>
|
<span>Religia</span>
|
||||||
<span class="">Cyranka Krystian</span>
|
<span>Cyranka Krystian</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -284,17 +284,17 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Multimedia i grafika komputerowa [zaw2]</span>
|
<span>Multimedia i grafika komputerowa [zaw2]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Bocian Konrad</span>
|
<span>Bocian Konrad</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wiedza o kulturze</span>
|
<span>Wiedza o kulturze</span>
|
||||||
<span class="">Bocian Natalia</span>
|
<span>Bocian Natalia</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
@ -304,9 +304,9 @@
|
|||||||
<td>14:00 14:45</td>
|
<td>14:00 14:45</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Zajęcia z wychowawcą</span>
|
<span>Zajęcia z wychowawcą</span>
|
||||||
<span class="">Baran Małgorzata</span>
|
<span>Baran Małgorzata</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -26,18 +26,18 @@
|
|||||||
<td>08:00 08:45</td>
|
<td>08:00 08:45</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Edukacja dla bezpieczeństwa</span>
|
<span>Edukacja dla bezpieczeństwa</span>
|
||||||
<span class="">Kobczyk Iwona</span>
|
<span>Kobczyk Iwona</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język niemiecki [JNPW]</span>
|
<span>Język niemiecki [JNPW]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Dzwoniec Ewa</span>
|
<span>Dzwoniec Ewa</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@ -49,10 +49,10 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język niemiecki [JNPW]</span>
|
<span>Język niemiecki [JNPW]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Dzwoniec Ewa</span>
|
<span>Dzwoniec Ewa</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -61,38 +61,38 @@
|
|||||||
<td>08:50 09:35</td>
|
<td>08:50 09:35</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Historia</span>
|
<span>Historia</span>
|
||||||
<span class="">Bogatka Katarzyna</span>
|
<span>Bogatka Katarzyna</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wychowanie fizyczne [CH]</span>
|
<span>Wychowanie fizyczne [CH]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Brodziec Dominika</span>
|
<span>Brodziec Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Fizyka</span>
|
<span>Fizyka</span>
|
||||||
<span class="">Bocian Łukasz</span>
|
<span>Bocian Łukasz</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Biologia</span>
|
<span>Biologia</span>
|
||||||
<span class="">Kowalska Anna</span>
|
<span>Kowalska Anna</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Religia</span>
|
<span>Religia</span>
|
||||||
<span class="">Kraska Maciej</span>
|
<span>Kraska Maciej</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -101,38 +101,38 @@
|
|||||||
<td>09:40 10:25</td>
|
<td>09:40 10:25</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wychowanie fizyczne [CH]</span>
|
<span>Wychowanie fizyczne [CH]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Brodziec Dominika</span>
|
<span>Brodziec Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język polski</span>
|
<span>Język polski</span>
|
||||||
<span class="">Rożeniec Paulina</span>
|
<span>Rożeniec Paulina</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Bączek Dominika</span>
|
<span>Bączek Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Plastyka</span>
|
<span>Plastyka</span>
|
||||||
<span class="">Rożeniec Paulina</span>
|
<span>Rożeniec Paulina</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Zajęcia z wychowawcą</span>
|
<span>Zajęcia z wychowawcą</span>
|
||||||
<span class="">Kowalska Anna</span>
|
<span>Kowalska Anna</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -141,38 +141,38 @@
|
|||||||
<td>10:30 11:15</td>
|
<td>10:30 11:15</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Geografia</span>
|
<span>Geografia</span>
|
||||||
<span class="">Orłowski Konrad</span>
|
<span>Orłowski Konrad</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Bączek Dominika</span>
|
<span>Bączek Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język angielski [JAPN]</span>
|
<span>Język angielski [JAPN]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Biegus Kazimiera</span>
|
<span>Biegus Kazimiera</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Bączek Dominika</span>
|
<span>Bączek Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Historia</span>
|
<span>Historia</span>
|
||||||
<span class="">Bogatka Katarzyna</span>
|
<span>Bogatka Katarzyna</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -181,38 +181,38 @@
|
|||||||
<td>11:30 12:15</td>
|
<td>11:30 12:15</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Bączek Dominika</span>
|
<span>Bączek Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Biologia</span>
|
<span>Biologia</span>
|
||||||
<span class="">Kowalska Anna</span>
|
<span>Kowalska Anna</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Zajęcia techniczne</span>
|
<span>Zajęcia techniczne</span>
|
||||||
<span class="">Chlebowski Stanisław</span>
|
<span>Chlebowski Stanisław</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język angielski [JAPN]</span>
|
<span>Język angielski [JAPN]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Biegus Kazimiera</span>
|
<span>Biegus Kazimiera</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język polski</span>
|
<span>Język polski</span>
|
||||||
<span class="">Rożeniec Paulina</span>
|
<span>Rożeniec Paulina</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -221,38 +221,38 @@
|
|||||||
<td>12:30 13:15</td>
|
<td>12:30 13:15</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Matematyka</span>
|
<span>Matematyka</span>
|
||||||
<span class="">Bączek Dominika</span>
|
<span>Bączek Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Fizyka</span>
|
<span>Fizyka</span>
|
||||||
<span class="">Bocian Łukasz</span>
|
<span>Bocian Łukasz</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język polski</span>
|
<span>Język polski</span>
|
||||||
<span class="">Rożeniec Paulina</span>
|
<span>Rożeniec Paulina</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wychowanie fizyczne [CH]</span>
|
<span>Wychowanie fizyczne [CH]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Brodziec Dominika</span>
|
<span>Brodziec Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język polski</span>
|
<span>Język polski</span>
|
||||||
<span class="">Rożeniec Paulina</span>
|
<span>Rożeniec Paulina</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -261,25 +261,25 @@
|
|||||||
<td>13:20 14:05</td>
|
<td>13:20 14:05</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Język angielski [JAPN]</span>
|
<span>Język angielski [JAPN]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Biegus Kazimiera</span>
|
<span>Biegus Kazimiera</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Religia</span>
|
<span>Religia</span>
|
||||||
<span class="">Kraska Maciej</span>
|
<span>Kraska Maciej</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
<span class="">Wychowanie fizyczne [CH]</span>
|
<span>Wychowanie fizyczne [CH]</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
<span class="">Brodziec Dominika</span>
|
<span>Brodziec Dominika</span>
|
||||||
<span class=""></span>
|
<span></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user