added unit tests for the roster #89

Merged
julius-lautz merged 37 commits from roster_tests into dev 2021-11-28 23:26:38 +00:00
Showing only changes of commit 3442702197 - Show all commits

View File

@ -4,14 +4,11 @@ import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import ch.unisg.roster.roster.adapter.out.persistence.mongodb.RosterRepository; import ch.unisg.roster.roster.adapter.out.persistence.mongodb.RosterRepository;
import ch.unisg.roster.roster.application.port.in.LoadRosterItemPort; import ch.unisg.roster.roster.application.port.in.LoadRosterItemPort;
import ch.unisg.roster.roster.domain.Roster; import ch.unisg.roster.roster.domain.Roster;
import ch.unisg.roster.roster.domain.RosterItem; import ch.unisg.roster.roster.domain.RosterItem;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.ConfigurableEnvironment;
@ -29,14 +26,14 @@ public class RosterApplication {
private static ConfigurableEnvironment ENVIRONMENT; private static ConfigurableEnvironment ENVIRONMENT;
@Autowired private static LoadRosterItemPort loadRosterItemPort;
private LoadRosterItemPort loadRosterItemPort;
public static void main(String[] args) { public static void main(String[] args) {
reynisson commented 2021-11-25 10:13:35 +00:00 (Migrated from github.com)
Review

Let's make sure this is needed

Let's make sure this is needed
SpringApplication rosterApp = new SpringApplication(RosterApplication.class); SpringApplication rosterApp = new SpringApplication(RosterApplication.class);
ENVIRONMENT = rosterApp.run(args).getEnvironment(); ENVIRONMENT = rosterApp.run(args).getEnvironment();
bootstrapMarketplaceWithMqtt(); bootstrapMarketplaceWithMqtt();
initialiseRoster();
} }
/** /**
@ -55,9 +52,9 @@ public class RosterApplication {
} }
} }
@PostConstruct private static void initialiseRoster(){
private void initialiseRoster(){ List<RosterItem> rosterItemList = loadRosterItemPort.loadAllRosterItems();
Roster.getInstance().initialiseRoster(loadRosterItemPort.loadAllRosterItems()); Roster.getInstance().initialiseRoster(rosterItemList);
} }
} }