Merge remote-tracking branch 'origin/roster_tests' into roster_tests

# Conflicts:
#	roster/src/main/java/ch/unisg/roster/RosterApplication.java
This commit is contained in:
reynisson 2021-11-26 13:40:13 +01:00
commit 3442702197

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) {
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);
} }
} }