CHECKPOINT: Made configuyrator as a service. Test and java access modifier correction needs to be done before pull request
This commit is contained in:
@ -4,5 +4,5 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class TestApplication {
|
||||
|
||||
public final static String TEST_CONFIG_FILE = "Zajecia.xlsx";
|
||||
}
|
||||
|
@ -9,8 +9,7 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.plannaplan.Configurator;
|
||||
import com.plannaplan.models.ConfigData;
|
||||
import com.plannaplan.TestApplication;
|
||||
import com.plannaplan.services.CourseService;
|
||||
import com.plannaplan.services.GroupService;
|
||||
import com.plannaplan.services.LecturerService;
|
||||
@ -18,31 +17,29 @@ import com.plannaplan.services.LecturerService;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@ContextConfiguration
|
||||
public class FileToDatabaseMigratorTest {
|
||||
|
||||
private static String FILE_NAME = "Zajecia.xlsx";
|
||||
|
||||
@Autowired
|
||||
private Configurator restTemplate;
|
||||
|
||||
@Autowired
|
||||
FileToDatabaseMigrator migrator;
|
||||
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
@Autowired
|
||||
private GroupService groupService;
|
||||
|
||||
@Autowired
|
||||
@Autowired
|
||||
private LecturerService lecturerService;
|
||||
|
||||
@Test
|
||||
public void shouldImportDataFromFileToDatabase() throws Exception {
|
||||
final InputStream inputStream = getClass().getClassLoader().getResourceAsStream(FILE_NAME);
|
||||
final ConfigData data = new ConfigData(null, null, inputStream);
|
||||
this.restTemplate.config(data);
|
||||
public void shouldImportDataFromFileToDatabase() throws Exception {
|
||||
final InputStream inputStream = getClass().getClassLoader()
|
||||
.getResourceAsStream(TestApplication.TEST_CONFIG_FILE);
|
||||
final FileReader reader = new FileReader(inputStream);
|
||||
this.migrator.migrate(reader.read());
|
||||
int courses_ammount = this.courseService.getCoursesAmmount();
|
||||
int groups_ammount = this.groupService.getGroupsAmmount();
|
||||
int lecturers_ammount = this.lecturerService.getLecturersAmmount();
|
||||
|
@ -0,0 +1,26 @@
|
||||
package com.plannaplan.services;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@ContextConfiguration
|
||||
public class ConfiguratorServiceTest {
|
||||
|
||||
@Autowired
|
||||
ConfiguratorService configuratorService;
|
||||
|
||||
@Test
|
||||
public void shouldImportDataToDataBase() {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -12,6 +12,7 @@ import com.plannaplan.exceptions.UserNotFoundException;
|
||||
import com.plannaplan.types.UserRoles;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.api.MethodOrderer.OrderAnnotation;
|
||||
@ -40,6 +41,7 @@ public class UserServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void shouldReturnToken() {
|
||||
try {
|
||||
String token = this.userService.login(TEST_USER_MAIL);
|
||||
|
Reference in New Issue
Block a user