Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ dependencies {
implementation 'com.auth0:java-jwt:4.0.0'
implementation 'org.mapstruct:mapstruct:1.5.2.Final'
implementation 'org.apache.commons:commons-lang3:3.12.0'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final'
implementation 'junit:junit:4.13.1'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final'
implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package br.edu.ifsp.spo.eventos.eventplatformbackend.account;

import java.time.Instant;

public class AccountFactory {
public static Account sampleAccount() {
return new Account(
"Marcelo Silva",
"marcelo01@email.com",
"66709094030",
"$2a$10$V/3zrFYbQhhJI1A3s1ve9OOHi62D.WqBAjgOSg5rOafrB50hvo30S",
true
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package br.edu.ifsp.spo.eventos.eventplatformbackend.activity;

import br.edu.ifsp.spo.eventos.eventplatformbackend.event.Event;
import br.edu.ifsp.spo.eventos.eventplatformbackend.event.EventFactory;
import br.edu.ifsp.spo.eventos.eventplatformbackend.subevent.Subevent;
import br.edu.ifsp.spo.eventos.eventplatformbackend.subevent.SubeventFactory;

import java.util.List;

public class ActivityFactory {
public static Activity sampleActivity() {
return new Activity(
"Atividade de exemplo",
"slug-de-exemplo",
"descrição de exemplo",
ActivityType.SEMINAR,
ActivityModality.IN_PERSON,
true,
50,
10,
EventFactory.sampleEvent(),
SubeventFactory.sampleSubevent()
);
}

public static Activity sampleActivity2() {
return new Activity(
"Atividade de exemplo 2",
"slug-de-exemplo 2",
"descrição de exemplo 2",
ActivityType.SEMINAR,
ActivityModality.IN_PERSON,
true,
10,
20,
EventFactory.sampleEvent(),
SubeventFactory.sampleSubevent()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package br.edu.ifsp.spo.eventos.eventplatformbackend.area;

import br.edu.ifsp.spo.eventos.eventplatformbackend.area.Area;
import br.edu.ifsp.spo.eventos.eventplatformbackend.location.LocationFactory;

public class AreaFactory {
public static Area sampleArea() {
return new Area(
"Bloco A",
"Piso Superior",
LocationFactory.sampleLocation()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package br.edu.ifsp.spo.eventos.eventplatformbackend.common.validators;

import br.edu.ifsp.spo.eventos.eventplatformbackend.common.security.JwtUserDetails;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.util.List;
import java.util.UUID;

public class JwtUserDetailsFactory {
public static JwtUserDetails sampleJwtUserDetailsThatIsNotOrganizer() {
return new JwtUserDetails(
UUID.randomUUID(),
"username",
List.of(
new SimpleGrantedAuthority("ROLE_ATTENDANT")
),
List.of(),
List.of(),
List.of(),
List.of()
);
}

public static JwtUserDetails sampleJwtUserDetailsThatIsOrganizer(UUID eventId) {
return new JwtUserDetails(
UUID.randomUUID(),
"username",
List.of(
new SimpleGrantedAuthority("ROLE_ATTENDANT")
),
List.of(eventId.toString()),
List.of(),
List.of(),
List.of()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package br.edu.ifsp.spo.eventos.eventplatformbackend.event;

import br.edu.ifsp.spo.eventos.eventplatformbackend.common.annotations.Period;

import java.time.LocalDate;

public class EventFactory {
public static Event sampleEvent() {
return new Event(
"SEDICTEC 2023",
"sedcitec-2023",
"O evento aborda temas pertinentes ao desenvolvimento profissional dos alunos",
"O evento aborda temas pertinentes ao desenvolvimento profissional dos alunos",
"eventos@ifsp.edu.br",
new Period(
LocalDate.of(2022,9, 1),
LocalDate.of(2023,9, 23)
),
new Period(
LocalDate.of(2022,9, 19),
LocalDate.of(2023,9, 23)
),
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQRhTwr8uxAPMMBeL24_uEFjrePJ2bOGC7PRQ&usqp=CAU",
"https://media.istockphoto.com/photos/happy-businesswoman-and-her-colleagues-applauding-on-an-education-in-picture-id1327425232?b=1&k=20&m=1327425232&s=170667a&w=0&h=yjRwDUwLz0VwitBG9_m_vx9PTCHk4YV4QuZBAbyjwSQ="
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package br.edu.ifsp.spo.eventos.eventplatformbackend.location;

import java.util.UUID;

public class LocationFactory {
public static Location sampleLocation() {
return new Location(
UUID.randomUUID(),
"IFSP Campus São Paulo",
"R. Pedro Vicente, 625 - Canindé, São Paulo - SP, 01109-010"
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package br.edu.ifsp.spo.eventos.eventplatformbackend.registration;

import br.edu.ifsp.spo.eventos.eventplatformbackend.account.AccountFactory;
import br.edu.ifsp.spo.eventos.eventplatformbackend.session.SessionFactory;

public class RegistrationFactory {
public static Registration sampleRegistrationWithConfirmedStatus() {
return Registration.createWithConfirmedStatus(
AccountFactory.sampleAccount(),
SessionFactory.sampleSession()
);
}

public static Registration sampleRegistrationWithConfirmedStatusInOtherSession() {
return Registration.createWithConfirmedStatus(
AccountFactory.sampleAccount(),
SessionFactory.sampleSession2()
);
}

public static Registration sampleRegistrationWithWaitingListStatus() {
return Registration.createWithWaitingListdStatus(
AccountFactory.sampleAccount(),
SessionFactory.sampleSession()
);
}

public static Registration sampleRegistrationWithCanceledByAdminStatus() {
Registration registration = Registration.createWithWaitingListdStatus(
AccountFactory.sampleAccount(),
SessionFactory.sampleSession()
);
registration.setRegistrationStatus(RegistrationStatus.CANCELED_BY_ADMIN);
return registration;
}

public static Registration sampleRegistrationWithWaitingConfirmationStatus() {
Registration registration = Registration.createWithWaitingListdStatus(
AccountFactory.sampleAccount(),
SessionFactory.sampleSession()
);
registration.setRegistrationStatus(RegistrationStatus.WAITING_CONFIRMATION);
return registration;
}
}
Loading