#103 merge with dev
commit
c77702704f
@ -0,0 +1,17 @@
|
||||
package ru.ulstu.core.model;
|
||||
|
||||
import ru.ulstu.deadline.model.Deadline;
|
||||
import ru.ulstu.timeline.model.Event;
|
||||
import ru.ulstu.user.model.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EventSource {
|
||||
List<Deadline> getDeadlines();
|
||||
|
||||
String getTitle();
|
||||
|
||||
List<User> getRecipients();
|
||||
|
||||
void addObjectToEvent(Event event);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package ru.ulstu.grant.page;
|
||||
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class KiasPage {
|
||||
private final static String KIAS_GRANT_DATE_FORMAT = "dd.MM.yyyy HH:mm";
|
||||
private WebDriver driver;
|
||||
|
||||
public KiasPage(WebDriver webDriver) {
|
||||
this.driver = webDriver;
|
||||
}
|
||||
|
||||
public boolean goToNextPage() {
|
||||
try {
|
||||
if (driver.findElements(By.id("js-ctrlNext")).size() > 0) {
|
||||
driver.findElement(By.id("js-ctrlNext")).click();
|
||||
return true;
|
||||
}
|
||||
} finally {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public List<WebElement> getPageOfGrants() {
|
||||
WebElement listContest = driver.findElement(By.tagName("tBody"));
|
||||
List<WebElement> grants = listContest.findElements(By.cssSelector("tr.tr"));
|
||||
return grants;
|
||||
}
|
||||
|
||||
public String getGrantTitle(WebElement grant) {
|
||||
return grant.findElement(By.cssSelector("td.tertiary")).findElement(By.tagName("a")).getText();
|
||||
}
|
||||
|
||||
public Date parseDeadLineDate(WebElement grantElement) throws ParseException {
|
||||
String deadlineDate = getFirstDeadline(grantElement); //10.06.2019 23:59
|
||||
SimpleDateFormat formatter = new SimpleDateFormat(KIAS_GRANT_DATE_FORMAT);
|
||||
return formatter.parse(deadlineDate);
|
||||
}
|
||||
|
||||
private String getFirstDeadline(WebElement grantElement) {
|
||||
return grantElement.findElement(By.xpath("./td[5]")).getText();
|
||||
}
|
||||
}
|
@ -1,11 +1,25 @@
|
||||
package ru.ulstu.grant.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import ru.ulstu.grant.model.Grant;
|
||||
import ru.ulstu.name.BaseRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GrantRepository extends JpaRepository<Grant, Integer> {
|
||||
public interface GrantRepository extends JpaRepository<Grant, Integer>, BaseRepository {
|
||||
|
||||
List<Grant> findByStatus(Grant.GrantStatus status);
|
||||
|
||||
Grant findByTitle(String title);
|
||||
|
||||
Grant findGrantById(Integer grantId);
|
||||
|
||||
@Override
|
||||
@Query("SELECT title FROM Grant g WHERE (g.title = :name) AND (:id IS NULL OR g.id != :id) ")
|
||||
String findByNameAndNotId(@Param("name") String name, @Param("id") Integer id);
|
||||
|
||||
@Query("SELECT g FROM Grant g WHERE (g.status <> 'SKIPPED') AND (g.status <> 'COMPLETED')")
|
||||
List<Grant> findAllActive();
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package ru.ulstu.paper.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AutoCompleteData {
|
||||
private List<String> authors = new ArrayList<>();
|
||||
private List<String> publicationTitles = new ArrayList<>();
|
||||
private List<String> publishers = new ArrayList<>();
|
||||
private List<String> journalOrCollectionTitles = new ArrayList<>();
|
||||
|
||||
public List<String> getAuthors() {
|
||||
return authors;
|
||||
}
|
||||
|
||||
public void setAuthors(List<String> authors) {
|
||||
this.authors = authors;
|
||||
}
|
||||
|
||||
public List<String> getPublicationTitles() {
|
||||
return publicationTitles;
|
||||
}
|
||||
|
||||
public void setPublicationTitles(List<String> publicationTitles) {
|
||||
this.publicationTitles = publicationTitles;
|
||||
}
|
||||
|
||||
public List<String> getPublishers() {
|
||||
return publishers;
|
||||
}
|
||||
|
||||
public void setPublishers(List<String> publishers) {
|
||||
this.publishers = publishers;
|
||||
}
|
||||
|
||||
public List<String> getJournalOrCollectionTitles() {
|
||||
return journalOrCollectionTitles;
|
||||
}
|
||||
|
||||
public void setJournalOrCollectionTitles(List<String> journalOrCollectionTitles) {
|
||||
this.journalOrCollectionTitles = journalOrCollectionTitles;
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package ru.ulstu.paper.model;
|
||||
|
||||
import ru.ulstu.core.model.BaseEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
|
||||
@Entity
|
||||
public class Reference extends BaseEntity {
|
||||
|
||||
private String authors;
|
||||
|
||||
@Column(name = "publication_title")
|
||||
private String publicationTitle;
|
||||
|
||||
@Column(name = "publication_year")
|
||||
private Integer publicationYear;
|
||||
|
||||
private String publisher;
|
||||
|
||||
private String pages;
|
||||
|
||||
@Column(name = "journal_or_collection_title")
|
||||
private String journalOrCollectionTitle;
|
||||
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
@Column(name = "reference_type")
|
||||
private ReferenceDto.ReferenceType referenceType = ReferenceDto.ReferenceType.ARTICLE;
|
||||
|
||||
public String getAuthors() {
|
||||
return authors;
|
||||
}
|
||||
|
||||
public void setAuthors(String authors) {
|
||||
this.authors = authors;
|
||||
}
|
||||
|
||||
public String getPublicationTitle() {
|
||||
return publicationTitle;
|
||||
}
|
||||
|
||||
public void setPublicationTitle(String publicationTitle) {
|
||||
this.publicationTitle = publicationTitle;
|
||||
}
|
||||
|
||||
public Integer getPublicationYear() {
|
||||
return publicationYear;
|
||||
}
|
||||
|
||||
public void setPublicationYear(Integer publicationYear) {
|
||||
this.publicationYear = publicationYear;
|
||||
}
|
||||
|
||||
public String getPublisher() {
|
||||
return publisher;
|
||||
}
|
||||
|
||||
public void setPublisher(String publisher) {
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
public String getPages() {
|
||||
return pages;
|
||||
}
|
||||
|
||||
public void setPages(String pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
|
||||
public String getJournalOrCollectionTitle() {
|
||||
return journalOrCollectionTitle;
|
||||
}
|
||||
|
||||
public void setJournalOrCollectionTitle(String journalOrCollectionTitle) {
|
||||
this.journalOrCollectionTitle = journalOrCollectionTitle;
|
||||
}
|
||||
|
||||
public ReferenceDto.ReferenceType getReferenceType() {
|
||||
return referenceType;
|
||||
}
|
||||
|
||||
public void setReferenceType(ReferenceDto.ReferenceType referenceType) {
|
||||
this.referenceType = referenceType;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package ru.ulstu.paper.repository;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import ru.ulstu.paper.model.Reference;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ReferenceRepository extends JpaRepository<Reference, Integer> {
|
||||
void deleteById(Integer id);
|
||||
|
||||
@Query("SELECT DISTINCT r.authors FROM Reference r")
|
||||
List<String> findDistinctAuthors();
|
||||
|
||||
@Query("SELECT DISTINCT r.publicationTitle FROM Reference r")
|
||||
List<String> findDistinctPublicationTitles();
|
||||
|
||||
@Query("SELECT DISTINCT r.publisher FROM Reference r")
|
||||
List<String> findDistinctPublishers();
|
||||
|
||||
@Query("SELECT DISTINCT r.journalOrCollectionTitle FROM Reference r where r.journalOrCollectionTitle <> ''")
|
||||
List<String> findDistinctJournalOrCollectionTitles();
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package ru.ulstu.user.model;
|
||||
|
||||
import ru.ulstu.conference.model.Conference;
|
||||
import ru.ulstu.utils.timetable.model.Lesson;
|
||||
|
||||
public class UserInfoNow {
|
||||
private Lesson lesson;
|
||||
private Conference conference;
|
||||
private User user;
|
||||
private boolean isOnline;
|
||||
|
||||
public UserInfoNow(Lesson lesson, Conference conference, User user, boolean isOnline) {
|
||||
this.lesson = lesson;
|
||||
this.conference = conference;
|
||||
this.user = user;
|
||||
this.isOnline = isOnline;
|
||||
}
|
||||
|
||||
public Lesson getLesson() {
|
||||
return lesson;
|
||||
}
|
||||
|
||||
public void setLesson(Lesson lesson) {
|
||||
this.lesson = lesson;
|
||||
}
|
||||
|
||||
public Conference getConference() {
|
||||
return conference;
|
||||
}
|
||||
|
||||
public void setConference(Conference conference) {
|
||||
this.conference = conference;
|
||||
}
|
||||
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return isOnline;
|
||||
}
|
||||
|
||||
public void setOnline(boolean online) {
|
||||
isOnline = online;
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package ru.ulstu.utils.timetable;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import ru.ulstu.core.util.DateUtils;
|
||||
import ru.ulstu.utils.timetable.errors.TimetableClientException;
|
||||
import ru.ulstu.utils.timetable.model.Lesson;
|
||||
import ru.ulstu.utils.timetable.model.TimetableResponse;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class TimetableService {
|
||||
private static final String TIMETABLE_URL = "http://timetable.athene.tech/api/1.0/timetable?filter=%s";
|
||||
private SimpleDateFormat lessonTimeFormat = new SimpleDateFormat("hh:mm");
|
||||
|
||||
private long[] lessonsStarts = new long[] {
|
||||
lessonTimeFormat.parse("8:00:00").getTime(),
|
||||
lessonTimeFormat.parse("9:40:00").getTime(),
|
||||
lessonTimeFormat.parse("11:30:00").getTime(),
|
||||
lessonTimeFormat.parse("13:10:00").getTime(),
|
||||
lessonTimeFormat.parse("14:50:00").getTime(),
|
||||
lessonTimeFormat.parse("16:30:00").getTime(),
|
||||
lessonTimeFormat.parse("18:10:00").getTime(),
|
||||
};
|
||||
|
||||
public TimetableService() throws ParseException {
|
||||
}
|
||||
|
||||
private int getCurrentDay() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int day = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
return (day + 5) % 7;
|
||||
}
|
||||
|
||||
private int getCurrentLessonNumber() {
|
||||
long lessonDuration = 90 * 60000;
|
||||
Date now = new Date();
|
||||
long timeNow = now.getTime() % (24 * 60 * 60 * 1000L);
|
||||
|
||||
for (int i = 0; i < lessonsStarts.length; i++) {
|
||||
if (timeNow > lessonsStarts[i] && timeNow < lessonsStarts[i] + lessonDuration) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private int getCurrentWeek() {
|
||||
Date currentDate = Calendar.getInstance().getTime();
|
||||
currentDate = DateUtils.clearTime(currentDate);
|
||||
|
||||
Calendar firstJan = Calendar.getInstance();
|
||||
firstJan.set(Calendar.MONTH, 0);
|
||||
firstJan.set(Calendar.DAY_OF_MONTH, 1);
|
||||
|
||||
return (int) Math.round(Math.ceil((((currentDate.getTime() - firstJan.getTime().getTime()) / 86400000)
|
||||
+ DateUtils.addDays(firstJan.getTime(), 1).getTime() / 7) % 2));
|
||||
}
|
||||
|
||||
private TimetableResponse getTimetableForUser(String userFIO) throws RestClientException {
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
return restTemplate.getForObject(String.format(TIMETABLE_URL, userFIO), TimetableResponse.class);
|
||||
}
|
||||
|
||||
public Lesson getCurrentLesson(String userFio) {
|
||||
TimetableResponse response;
|
||||
try {
|
||||
response = getTimetableForUser(userFio);
|
||||
} catch (RestClientException e) {
|
||||
e.printStackTrace();
|
||||
throw new TimetableClientException(userFio);
|
||||
}
|
||||
|
||||
int lessonNumber = getCurrentLessonNumber();
|
||||
if (lessonNumber < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Lesson> lessons = response
|
||||
.getResponse()
|
||||
.getWeeks()
|
||||
.get(getCurrentWeek())
|
||||
.getDays()
|
||||
.get(getCurrentDay())
|
||||
.getLessons()
|
||||
.get(lessonNumber);
|
||||
|
||||
if (lessons.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return new ObjectMapper().convertValue(lessons.get(0), Lesson.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package ru.ulstu.utils.timetable.errors;
|
||||
|
||||
public class TimetableClientException extends RuntimeException {
|
||||
public TimetableClientException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package ru.ulstu.utils.timetable.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class Day {
|
||||
|
||||
private Integer day;
|
||||
private List<List<Lesson>> lessons = new ArrayList<>();
|
||||
|
||||
public Integer getDay() {
|
||||
return day;
|
||||
}
|
||||
|
||||
public void setDay(Integer day) {
|
||||
this.day = day;
|
||||
}
|
||||
|
||||
public List<List<Lesson>> getLessons() {
|
||||
return lessons;
|
||||
}
|
||||
|
||||
public void setLessons(List<List<Lesson>> lessons) {
|
||||
this.lessons = lessons;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package ru.ulstu.utils.timetable.model;
|
||||
|
||||
public class Lesson {
|
||||
private String group;
|
||||
private String nameOfLesson;
|
||||
private String teacher;
|
||||
private String room;
|
||||
|
||||
public String getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public String getNameOfLesson() {
|
||||
return nameOfLesson;
|
||||
}
|
||||
|
||||
public String getTeacher() {
|
||||
return teacher;
|
||||
}
|
||||
|
||||
public String getRoom() {
|
||||
return room;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package ru.ulstu.utils.timetable.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Response {
|
||||
|
||||
private List<Week> weeks = new ArrayList<>();
|
||||
|
||||
public List<Week> getWeeks() {
|
||||
return weeks;
|
||||
}
|
||||
|
||||
public void setWeeks(List<Week> weeks) {
|
||||
this.weeks = weeks;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package ru.ulstu.utils.timetable.model;
|
||||
|
||||
public class TimetableResponse {
|
||||
private Response response;
|
||||
private String error;
|
||||
|
||||
public Response getResponse() {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void setResponse(Response response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package ru.ulstu.utils.timetable.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Week implements Serializable {
|
||||
|
||||
private List<Day> days = new ArrayList<>();
|
||||
|
||||
public List<Day> getDays() {
|
||||
return days;
|
||||
}
|
||||
|
||||
public void setDays(List<Day> days) {
|
||||
this.days = days;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190506_000000-1">
|
||||
<addColumn tableName="deadline">
|
||||
<column name="executor" type="varchar(255)"/>
|
||||
</addColumn>
|
||||
<addColumn tableName="deadline">
|
||||
<column name="done" type="boolean"/>
|
||||
</addColumn>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190506_000000-2">
|
||||
<createTable tableName="project_executors">
|
||||
<column name="project_id" type="integer"/>
|
||||
<column name="executors_id" type="integer"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="project_executors" baseColumnNames="project_id"
|
||||
constraintName="fk_project_project_executors" referencedTableName="project"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="project_executors" baseColumnNames="executors_id"
|
||||
constraintName="fk_user_project_executors" referencedTableName="users"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190507_000002-1">
|
||||
<addColumn tableName="event">
|
||||
<column name="project_id" type="integer"/>
|
||||
</addColumn>
|
||||
<addForeignKeyConstraint baseTableName="event" baseColumnNames="project_id"
|
||||
constraintName="fk_event_project_id" referencedTableName="project"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190517_000001-1">
|
||||
<modifyDataType tableName="deadline"
|
||||
columnName="executor"
|
||||
newDataType="integer"
|
||||
schemaName="public"/>
|
||||
<addForeignKeyConstraint baseTableName="deadline" baseColumnNames="executor"
|
||||
constraintName="fk_deadline_executor" referencedTableName="users"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="tanya" id="20190520_000000-1">
|
||||
<dropColumn columnName="applicationFileName" tableName="grants"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="masha" id="20190523_000000-1">
|
||||
<createTable tableName="reference">
|
||||
<column name="id" type="integer">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="authors" type="varchar(255)"/>
|
||||
<column name="publication_title" type="varchar(255)"/>
|
||||
<column name="publication_year" type="integer"/>
|
||||
<column name="paper_id" type="integer"/>
|
||||
<column name="publisher" type="varchar(255)"/>
|
||||
<column name="pages" type="varchar(255)"/>
|
||||
<column name="journal_or_collection_title" type="varchar(255)"/>
|
||||
<column name="reference_type" type="varchar(255)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="version" type="integer"/>
|
||||
</createTable>
|
||||
<addPrimaryKey columnNames="id" constraintName="pk_reference" tableName="reference"/>
|
||||
<addForeignKeyConstraint baseTableName="reference" baseColumnNames="paper_id"
|
||||
constraintName="fk_reference_paper_id" referencedTableName="paper"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190528_000000-1">
|
||||
<renameColumn tableName="deadline"
|
||||
columnDataType="integer"
|
||||
newColumnName="executors"
|
||||
oldColumnName="executor"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190528_000002-1">
|
||||
<createTable tableName="deadline_executors">
|
||||
<column name="deadline_id" type="integer"/>
|
||||
<column name="executors_id" type="integer"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="deadline_executors" baseColumnNames="deadline_id"
|
||||
constraintName="fk_deadline_deadline_executors" referencedTableName="deadline"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="deadline_executors" baseColumnNames="executors_id"
|
||||
constraintName="fk_user_deadline_executors" referencedTableName="users"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190528_000000-3">
|
||||
<createTable tableName="project_grants">
|
||||
<column name="project_id" type="integer"/>
|
||||
<column name="grants_id" type="integer"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="project_grants" baseColumnNames="project_id"
|
||||
constraintName="fk_project_project_grants" referencedTableName="project"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="project_grants" baseColumnNames="grants_id"
|
||||
constraintName="fk_grant_project_grants" referencedTableName="grants"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
<changeSet author="anton" id="20190529_000001-1">
|
||||
<addColumn tableName="file">
|
||||
<column name="project_id" type="integer"/>
|
||||
</addColumn>
|
||||
<addForeignKeyConstraint baseTableName="file" baseColumnNames="project_id"
|
||||
constraintName="fk_file_project" referencedTableName="project"
|
||||
referencedColumnNames="id"/>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,3 @@
|
||||
.loader {
|
||||
padding-left:50%
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
.div-deadline-done {
|
||||
width: 60%;
|
||||
height: 100%;
|
||||
float: right;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 673 B |
@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<body>
|
||||
<div th:fragment="filesList">
|
||||
<th:block th:each="file, rowStat : *{files}">
|
||||
|
||||
<div class="row" th:id="|files${rowStat.index}|"
|
||||
th:style="${file.deleted} ? 'display: none;' :''">
|
||||
<input type="hidden" th:field="*{files[__${rowStat.index}__].id}"/>
|
||||
<input type="hidden"
|
||||
th:field="*{files[__${rowStat.index}__].deleted}"/>
|
||||
<input type="hidden"
|
||||
th:field="*{files[__${rowStat.index}__].name}"/>
|
||||
<input type="hidden"
|
||||
th:field="*{files[__${rowStat.index}__].tmpFileName}"/>
|
||||
<div class="col-2">
|
||||
<a class="btn btn-danger float-right"
|
||||
th:onclick="|$('#files${rowStat.index}\\.deleted').val('true'); $('#files${rowStat.index}').hide(); |">
|
||||
<span aria-hidden="true"><i class="fa fa-times"/></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<a th:onclick="${file.id==null} ? 'downloadFile('+${file.tmpFileName}+',null,\''+${file.name}+'\')':
|
||||
'downloadFile(null,'+${file.id}+',\''+${file.name}+'\')' "
|
||||
href="javascript:void(0)"
|
||||
th:text="*{files[__${rowStat.index}__].name}">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</th:block>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,57 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default">
|
||||
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<script src="/js/users.js"></script>
|
||||
<link rel="stylesheet" href="../css/base.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<nav layout:fragment="navbar">
|
||||
<div class="navbar-header">
|
||||
<a class="navbar-brand" href="/"><span class="ui-menuitem-text"><i
|
||||
class="fa fa-plane fa-4" aria-hidden="true"></i> Balance</span></a>
|
||||
class="fa fa-plane fa-4" aria-style="display:none"></i> Balance</span></a>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container" layout:fragment="content">
|
||||
<form id="reset-form" method="post" class="margined-top-10">
|
||||
<fieldset>
|
||||
<div class="form-group">
|
||||
<input type="email" name="email" id="email" class="form-control"
|
||||
placeholder="E-Mail" required="true" autofocus="autofocus"/>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success btn-block">Сбросить пароль</button>
|
||||
<div class="form-group">
|
||||
<small class="form-text text-muted">
|
||||
<a href="/login">Вернуться к странице входа</a>
|
||||
</small>
|
||||
<div layout:fragment="content">
|
||||
<section class="bg-light" id="portfolio">
|
||||
|
||||
<div class="container">
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group">
|
||||
<input type="text" name="email" id="emailReset" class="form-control"
|
||||
placeholder="E-Mail"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" name="email" id="passwordNew" class="form-control"
|
||||
placeholder="Новый пароль" style="display:none"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="password" name="email" id="passwordConfirm" class="form-control"
|
||||
placeholder="Подтвердите пароль" style="display:none"/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" name="email" id="resetKey" class="form-control"
|
||||
placeholder="Код подтверждения" style="display:none"/>
|
||||
</div>
|
||||
<div id="dvloader" class="loader" style="display:none"><img src="../img/main/ajax-loader.gif" /></div>
|
||||
<button id="btnSend" type="button" onclick="requestResetPassword()"
|
||||
class="btn btn-success btn-block">
|
||||
Отправить код подтверждения
|
||||
</button>
|
||||
<button id="btnReset" style="display:none" type="button" onclick="resetPassword()"
|
||||
class="btn btn-success btn-block">
|
||||
Сбросить
|
||||
пароль
|
||||
</button>
|
||||
<div class="form-group">
|
||||
<small class="form-text text-muted">
|
||||
<a href="/login">Вернуться к странице входа</a>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<th:block layout:fragment="data-scripts">
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
$(document).ready(function () {
|
||||
$("#reset-form").submit(function () {
|
||||
var email = $("#email").val();
|
||||
if (isEmpty(email)) {
|
||||
showFeedbackMessage("Адрес электронной почты не задан", MessageTypesEnum.DANGER);
|
||||
return false;
|
||||
}
|
||||
postToRest(urlUsersPasswordResetRequest + "?email=" + email, null,
|
||||
function () {
|
||||
showFeedbackMessage("Запрос на смену пароля отправлен");
|
||||
},
|
||||
function () {
|
||||
$("#email").val("");
|
||||
}
|
||||
);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
/*]]>*/
|
||||
|
||||
</script>
|
||||
</th:block>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorator="default" xmlns:th="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<script src="/js/core.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" layout:fragment="content">
|
||||
<section id="services">
|
||||
<div class="container">
|
||||
<div class="col-lg-12 text-center">
|
||||
<h2 class="section-heading text-uppercase">Пользователи</h2>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<h2 th:text="${error}">teste</h2>
|
||||
</div>
|
||||
<div class="row justify-content-center" id="dashboard">
|
||||
<th:block th:each="user : ${users}">
|
||||
<div th:replace="users/fragments/userDashboardFragment :: userDashboard(user=${user})"/>
|
||||
</th:block>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<script th:inline="javascript">
|
||||
/*<![CDATA[*/
|
||||
$(document).ready(function () {
|
||||
var error = /*[[${error}]]*/
|
||||
showFeedbackMessage(error, MessageTypesEnum.WARNING)
|
||||
});
|
||||
/*]]>*/
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
<head th:fragment="headerfiles">
|
||||
<meta charset="UTF-8"/>
|
||||
</head>
|
||||
<body>
|
||||
<div th:fragment="userDashboard (user)" class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-3 dashboard-card">
|
||||
<div class="row">
|
||||
<div class="col col-10">
|
||||
<b><p th:text="${user.user.lastName} + ' ' + ${user.user.firstName} + ' ' + ${user.user.patronymic}"></p></b>
|
||||
<i><p th:if="${user.conference != null}" th:text="'Сейчас на конференции ' + ${user.conference.title}"></p></i>
|
||||
<i><p th:if="${user.lesson != null}" th:text="'Сейчас на паре ' + ${user.lesson.nameOfLesson} + ' в аудитории ' + ${user.lesson.room}"></p></i>
|
||||
<p th:if="${user.isOnline()}">Онлайн</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,174 @@
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import core.PageObject;
|
||||
import core.TestTemplate;
|
||||
import org.junit.Assert;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import project.ProjectDashboard;
|
||||
import project.ProjectPage;
|
||||
import project.ProjectsPage;
|
||||
import ru.ulstu.NgTrackerApplication;
|
||||
import ru.ulstu.configuration.ApplicationProperties;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@SpringBootTest(classes = NgTrackerApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
||||
public class ProjectTest extends TestTemplate {
|
||||
private final Map<PageObject, List<String>> navigationHolder = ImmutableMap.of(
|
||||
new ProjectPage(), Arrays.asList("ПРОЕКТЫ", "/projects/projects"),
|
||||
new ProjectsPage(), Arrays.asList("РЕДАКТИРОВАНИЕ ПРОЕКТА", "/projects/project?id=0"),
|
||||
new ProjectDashboard(), Arrays.asList("ПРОЕКТЫ", "/projects/dashboard")
|
||||
);
|
||||
|
||||
@Autowired
|
||||
private ApplicationProperties applicationProperties;
|
||||
|
||||
@Test
|
||||
public void testACreateNewProject() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 1);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(page.getKey());
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 0).getKey());
|
||||
String name = "Project " + (new Date()).getTime();
|
||||
String date = "01.01.2019";
|
||||
Integer deadNum = projectPage.getDeadlineCount();
|
||||
projectPage.setName(name);
|
||||
projectPage.clickAddDeadline();
|
||||
projectPage.addDeadlineDate(date, deadNum);
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBChangeNameAndSave() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = "Project " + (new Date()).getTime();
|
||||
projectPage.clearName();
|
||||
projectPage.setName(name);
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCChangeDeadlineAndSave() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = projectPage.getName();
|
||||
String date = "01.01.2019";
|
||||
Integer deadNum = projectPage.getDeadlineCount();
|
||||
projectPage.addDeadlineDate(date, deadNum);
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDSetStatusAndSave() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = projectPage.getName();
|
||||
projectPage.setStatus();
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEAddDescriptionAndSave() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = projectPage.getName();
|
||||
String description = "Description " + (new Date()).getTime();
|
||||
projectPage.addDescription(description);
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFAddLinkAndSave() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = projectPage.getName();
|
||||
String link = "Link " + (new Date()).getTime();
|
||||
projectPage.addLink(link);
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGAddDeadlineDescriptionAndSave() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = projectPage.getName();
|
||||
String deadDesc = "Description " + (new Date()).getTime();
|
||||
projectPage.addDeadlineDescription(deadDesc);
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHSetDeadlineCompletionAndSave() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = projectPage.getName();
|
||||
projectPage.setDeadlineCompletion();
|
||||
projectPage.clickSave();
|
||||
Assert.assertTrue(projectsPage.checkNameInList(name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIDeleteDeadline() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
projectPage.clickDeleteDeadline();
|
||||
Assert.assertTrue(projectPage.getDeadlineCount() == 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJDeleteProject() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
ProjectPage projectPage = (ProjectPage) getContext().initPage(page.getKey());
|
||||
ProjectsPage projectsPage = (ProjectsPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 1).getKey());
|
||||
projectsPage.getFirstProject();
|
||||
String name = projectPage.getName();
|
||||
projectPage.clickSave();
|
||||
projectsPage.deleteFirst();
|
||||
projectsPage.clickConfirm();
|
||||
Assert.assertFalse(projectsPage.checkNameInList(name));
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import core.PageObject;
|
||||
import core.TestTemplate;
|
||||
import org.junit.Assert;
|
||||
import org.junit.FixMethodOrder;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import ru.ulstu.NgTrackerApplication;
|
||||
import ru.ulstu.configuration.ApplicationProperties;
|
||||
import students.TaskPage;
|
||||
import students.TasksDashboardPage;
|
||||
import students.TasksPage;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
@SpringBootTest(classes = NgTrackerApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
||||
public class StudentTaskTest extends TestTemplate {
|
||||
private final Map<PageObject, List<String>> navigationHolder = ImmutableMap.of(
|
||||
new TasksPage(), Arrays.asList("Список задач", "/students/tasks"),
|
||||
new TasksDashboardPage(), Arrays.asList("Панель управления", "/students/dashboard"),
|
||||
new TaskPage(), Arrays.asList("Создать задачу", "/students/task?id=0")
|
||||
);
|
||||
|
||||
private final String tag = "ATag";
|
||||
|
||||
@Autowired
|
||||
private ApplicationProperties applicationProperties;
|
||||
|
||||
|
||||
@Test
|
||||
public void testACreateTask() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 2);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
|
||||
TaskPage taskPage = (TaskPage) getContext().initPage(page.getKey());
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 0).getKey());
|
||||
String taskName = "Task " + (new Date()).getTime();
|
||||
|
||||
taskPage.setName(taskName);
|
||||
taskPage.addDeadlineDate("01.01.2020", 0);
|
||||
taskPage.addDeadlineDescription("Description", 0);
|
||||
taskPage.save();
|
||||
|
||||
Assert.assertTrue(tasksPage.findTask(taskName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBEditTaskName() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
TaskPage taskPage = (TaskPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 2).getKey());
|
||||
String taskNewName = "Task " + (new Date()).getTime();
|
||||
|
||||
tasksPage.goToFirstTask();
|
||||
taskPage.removeName();
|
||||
taskPage.setName(taskNewName);
|
||||
taskPage.save();
|
||||
|
||||
Assert.assertTrue(tasksPage.findTask(taskNewName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCDeleteTask() throws InterruptedException {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
|
||||
Integer size = tasksPage.getTasks().size();
|
||||
tasksPage.deleteFirstTask();
|
||||
Thread.sleep(3000);
|
||||
tasksPage.submit();
|
||||
|
||||
Assert.assertEquals(size - 1, tasksPage.getTasks().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDAddDeadline() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
TaskPage taskPage = (TaskPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 2).getKey());
|
||||
|
||||
tasksPage.goToFirstTask();
|
||||
String taskId = taskPage.getId();
|
||||
Integer deadnum = taskPage.getDeadNum();
|
||||
|
||||
String descr = "Description";
|
||||
String date = "06.06.2019";
|
||||
String dateValue = "2019-06-06";
|
||||
|
||||
taskPage.clickAddDeadline();
|
||||
taskPage.addDeadlineDescription(descr, deadnum);
|
||||
taskPage.addDeadlineDate(date, deadnum);
|
||||
taskPage.save();
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/students/task?id=%s", taskId));
|
||||
|
||||
Assert.assertTrue(taskPage.hasDeadline(descr, dateValue));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEEditDeadline() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
TaskPage taskPage = (TaskPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 2).getKey());
|
||||
|
||||
tasksPage.goToFirstTask();
|
||||
String taskId = taskPage.getId();
|
||||
|
||||
String descr = "DescriptionTwo";
|
||||
String date = "12.12.2019";
|
||||
String dateValue = "2019-12-12";
|
||||
|
||||
taskPage.clearDeadlineDate(0);
|
||||
taskPage.clearDeadlineDescription(0);
|
||||
taskPage.addDeadlineDescription(descr, 0);
|
||||
taskPage.addDeadlineDate(date, 0);
|
||||
taskPage.save();
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/students/task?id=%s", taskId));
|
||||
|
||||
Assert.assertTrue(taskPage.hasDeadline(descr, dateValue));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFDeleteDeadline() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
TaskPage taskPage = (TaskPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 2).getKey());
|
||||
|
||||
tasksPage.goToFirstTask();
|
||||
String taskId = taskPage.getId();
|
||||
Integer deadNum = taskPage.getDeadNum();
|
||||
|
||||
taskPage.deleteDeadline();
|
||||
taskPage.save();
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + String.format("/students/task?id=%s", taskId));
|
||||
|
||||
Assert.assertEquals(deadNum - 1, (int) taskPage.getDeadNum());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGCreateTaskWithTag() throws InterruptedException {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 2);
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
|
||||
TaskPage taskPage = (TaskPage) getContext().initPage(page.getKey());
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(Iterables.get(navigationHolder.entrySet(), 0).getKey());
|
||||
String taskName = "Task " + (new Date()).getTime();
|
||||
|
||||
taskPage.setName(taskName);
|
||||
taskPage.setTag(tag);
|
||||
Thread.sleep(1000);
|
||||
taskPage.addDeadlineDate("01.01.2020", 0);
|
||||
taskPage.addDeadlineDescription("Description", 0);
|
||||
taskPage.save();
|
||||
|
||||
Assert.assertTrue(tasksPage.findTaskByTag(taskName, tag));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHFindTagInFilter() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
|
||||
|
||||
Assert.assertTrue(tasksPage.findTag(tag));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIFilterByTag() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
tasksPage.selectTag(tag);
|
||||
|
||||
Assert.assertTrue(tasksPage.findTasksByTag(tag));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJFilterByStatus() {
|
||||
Map.Entry<PageObject, List<String>> page = Iterables.get(navigationHolder.entrySet(), 0);
|
||||
|
||||
getContext().goTo(applicationProperties.getBaseUrl() + page.getValue().get(1));
|
||||
TasksPage tasksPage = (TasksPage) getContext().initPage(page.getKey());
|
||||
|
||||
tasksPage.selectStatus();
|
||||
Assert.assertTrue(tasksPage.findAllStatus());
|
||||
}
|
||||
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue