Compare commits
No commits in common. "5ee375554899cc335e3dface6ee68453945f5b40" and "84b70f8f388aa34190ba9dc26d9884998d6c85a7" have entirely different histories.
5ee3755548
...
84b70f8f38
24
Makefile
24
Makefile
@ -19,14 +19,8 @@ front/MyINPulse-front/.installed:
|
||||
|
||||
vite: ./front/MyINPulse-front/.installed
|
||||
|
||||
keycloak: ./keycloak/.installed
|
||||
|
||||
keycloak/.installed:
|
||||
@echo "running one time install"
|
||||
@cd keycloak/CAS && sudo sh build.sh
|
||||
@touch ./keycloak/.installed
|
||||
|
||||
dev-front: clean vite keycloak
|
||||
dev-front: clean vite
|
||||
@cp config/frontdev.env front/MyINPulse-front/.env
|
||||
@cp config/frontdev.env .env
|
||||
@cp config/frontdev.env MyINPulse-back/.env
|
||||
@ -34,7 +28,7 @@ dev-front: clean vite keycloak
|
||||
@docker compose up -d --build
|
||||
@cd ./front/MyINPulse-front/ && npm run dev
|
||||
|
||||
prod: clean keycloak
|
||||
prod: clean
|
||||
@cp config/prod.env front/MyINPulse-front/.env
|
||||
@cp config/prod.env .env
|
||||
@cp config/prod.env .env
|
||||
@ -43,7 +37,7 @@ prod: clean keycloak
|
||||
|
||||
|
||||
|
||||
dev-back: keycloak
|
||||
dev-back:
|
||||
@cp config/backdev.env front/MyINPulse-front/.env
|
||||
@cp config/backdev.env .env
|
||||
@cp config/backdev.env MyINPulse-back/.env
|
||||
@ -52,7 +46,7 @@ dev-back: keycloak
|
||||
@echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)'
|
||||
@echo "./gradlew bootRun --args='--server.port=8081'"
|
||||
|
||||
dev: clean vite keycloak
|
||||
dev: clean vite
|
||||
@cp config/dev.env front/MyINPulse-front/.env
|
||||
@cp config/dev.env .env
|
||||
@cp config/dev.env MyINPulse-back/.env
|
||||
@ -61,13 +55,3 @@ dev: clean vite keycloak
|
||||
@echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)'
|
||||
@echo "./gradlew bootRun --args='--server.port=8081'"
|
||||
@cd ./front/MyINPulse-front/ && npm run dev &
|
||||
|
||||
test-back: clean keycloak
|
||||
@cp config/dev.env front/MyINPulse-front/.env
|
||||
@cp config/dev.env .env
|
||||
@cp config/dev.env MyINPulse-back/.env
|
||||
@cp config/dev.docker-compose.yaml docker-compose.yaml
|
||||
@docker compose up -d --build
|
||||
@echo "cd MyINPulse-back" && echo 'export $$(cat .env | xargs)'
|
||||
@cd ./MyINPulse-back/ && ./gradlew test && ./gradlew jacocoTestReport
|
||||
@firefox ./MyINPulse-back/build/jacocoHtml/index.html
|
||||
|
@ -37,6 +37,7 @@ public class Entrepreneur extends User {
|
||||
public Entrepreneur() {}
|
||||
|
||||
public Entrepreneur(
|
||||
Long idUser,
|
||||
String userSurname,
|
||||
String username,
|
||||
String primaryMail,
|
||||
@ -45,7 +46,7 @@ public class Entrepreneur extends User {
|
||||
String school,
|
||||
String course,
|
||||
boolean sneeStatus) {
|
||||
super(userSurname, username, primaryMail, secondaryMail, phoneNumber);
|
||||
super(idUser, userSurname, username, primaryMail, secondaryMail, phoneNumber);
|
||||
this.school = school;
|
||||
this.course = course;
|
||||
this.sneeStatus = sneeStatus;
|
||||
|
@ -28,8 +28,6 @@ public class User {
|
||||
|
||||
public User() {}
|
||||
|
||||
// TODO: this should be removed as we shouldn't be able to chose the ID. Leaving it for
|
||||
// compatibility purposes, as soon as it's not used anymore, delete it
|
||||
public User(
|
||||
Long idUser,
|
||||
String userSurname,
|
||||
@ -45,19 +43,6 @@ public class User {
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public User(
|
||||
String userSurname,
|
||||
String userName,
|
||||
String primaryMail,
|
||||
String secondaryMail,
|
||||
String phoneNumber) {
|
||||
this.userSurname = userSurname;
|
||||
this.userName = userName;
|
||||
this.primaryMail = primaryMail;
|
||||
this.secondaryMail = secondaryMail;
|
||||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public Long getIdUser() {
|
||||
return idUser;
|
||||
}
|
||||
|
@ -91,9 +91,7 @@ public class AdminApiService {
|
||||
newProject.getProjectAdministrator().updateListProject(newProject);
|
||||
}
|
||||
if (newProject.getEntrepreneurProposed() != null) {
|
||||
Entrepreneur proposed = newProject.getEntrepreneurProposed();
|
||||
proposed.setProjectProposed(newProject);
|
||||
proposed.setProjectParticipation(newProject);
|
||||
newProject.getEntrepreneurProposed().setProjectProposed(newProject);
|
||||
}
|
||||
newProject
|
||||
.getListEntrepreneurParticipation()
|
||||
|
@ -5,12 +5,10 @@ import static enseirb.myinpulse.model.ProjectDecisionValue.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import enseirb.myinpulse.model.Administrator;
|
||||
import enseirb.myinpulse.model.Entrepreneur;
|
||||
import enseirb.myinpulse.model.Project;
|
||||
import enseirb.myinpulse.model.ProjectDecision;
|
||||
import enseirb.myinpulse.service.AdminApiService;
|
||||
import enseirb.myinpulse.service.database.AdministratorService;
|
||||
import enseirb.myinpulse.service.database.EntrepreneurService;
|
||||
import enseirb.myinpulse.service.database.ProjectService;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
@ -28,16 +26,13 @@ import java.util.List;
|
||||
@Transactional
|
||||
public class AdminApiServiceTest {
|
||||
private static long administratorid;
|
||||
private static Administrator administrator;
|
||||
private static Entrepreneur entrepreneur;
|
||||
@Autowired private AdminApiService adminApiService;
|
||||
@Autowired private ProjectService projectService;
|
||||
|
||||
@BeforeAll
|
||||
static void setup(
|
||||
@Autowired AdministratorService administratorService,
|
||||
@Autowired ProjectService projectService,
|
||||
@Autowired EntrepreneurService entrepreneurService) {
|
||||
@Autowired ProjectService projectService) {
|
||||
administratorService.addAdministrator(
|
||||
new Administrator(
|
||||
"admin",
|
||||
@ -45,7 +40,7 @@ public class AdminApiServiceTest {
|
||||
"testAdminEmpty@example.com",
|
||||
"testAdmin@example.com",
|
||||
""));
|
||||
administrator =
|
||||
Administrator a =
|
||||
administratorService.addAdministrator(
|
||||
new Administrator(
|
||||
"admin2",
|
||||
@ -53,18 +48,7 @@ public class AdminApiServiceTest {
|
||||
"testAdminFull@example.com",
|
||||
"testAdmin@example.com",
|
||||
""));
|
||||
administratorid = administrator.getIdUser();
|
||||
entrepreneur =
|
||||
new Entrepreneur(
|
||||
"JeSuisUnEntrepreneurDeCompet",
|
||||
"EtUé",
|
||||
"Entrepreneur@inpulse.com",
|
||||
"mail2",
|
||||
"phone",
|
||||
"Ensimag nan jdeconne ENSEIRB (-matmeca mais on s'en fout)",
|
||||
"info ofc",
|
||||
false);
|
||||
entrepreneurService.addEntrepreneur(entrepreneur);
|
||||
administratorid = a.getIdUser();
|
||||
projectService.addNewProject(
|
||||
new Project(
|
||||
"sampleProjectAdminApiService",
|
||||
@ -177,41 +161,6 @@ public class AdminApiServiceTest {
|
||||
assertEquals(1, IterableToList(this.adminApiService.getPendingProjects()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void addProjectToAdmin() {
|
||||
assertEquals(0, administrator.getListProject().size());
|
||||
Project p1 = new Project("assProjectToAdmin", null, LocalDate.now(), ACTIVE, administrator);
|
||||
this.adminApiService.addNewProject(p1);
|
||||
assertEquals(1, administrator.getListProject().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void addProjectToUser() {
|
||||
assertNull(entrepreneur.getProjectParticipation());
|
||||
Project p1 =
|
||||
new Project("assProjectToAdmin", null, LocalDate.now(), ACTIVE, null, entrepreneur);
|
||||
this.adminApiService.addNewProject(p1);
|
||||
assertEquals(p1, entrepreneur.getProjectParticipation());
|
||||
}
|
||||
|
||||
@Test
|
||||
void addProjectWithManyUsers() {
|
||||
Entrepreneur e1 = new Entrepreneur();
|
||||
Entrepreneur e2 = new Entrepreneur();
|
||||
Entrepreneur e3 = new Entrepreneur();
|
||||
assertNull(e1.getProjectParticipation());
|
||||
assertNull(e2.getProjectParticipation());
|
||||
assertNull(e3.getProjectParticipation());
|
||||
Project p1 = new Project("assProjectToAdmin", null, LocalDate.now(), ACTIVE, null, null);
|
||||
p1.updateListEntrepreneurParticipation(e1);
|
||||
p1.updateListEntrepreneurParticipation(e2);
|
||||
p1.updateListEntrepreneurParticipation(e3);
|
||||
this.adminApiService.addNewProject(p1);
|
||||
assertEquals(p1, e1.getProjectParticipation());
|
||||
assertEquals(p1, e2.getProjectParticipation());
|
||||
assertEquals(p1, e3.getProjectParticipation());
|
||||
}
|
||||
|
||||
@Test
|
||||
void addDuplicateProject() {
|
||||
Project p1 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user