/*
 * IoT - Industrial Internet Framework
 * Apache License Version 2.0, January 2004
 * Released as a part of Helsinki University
 * Software Engineering Lab in summer 2015
 */
package fi.iot.iiframework.application;

import fi.iot.iiframework.errors.ErrorLogger;
import fi.iot.iiframework.errors.ErrorSeverity;
import fi.iot.iiframework.errors.ErrorType;
import fi.iot.iiframework.errors.SysError;
import fi.iot.iiframework.source.InformationSourceConfiguration;
import fi.iot.iiframework.source.InformationSourceManager;
import fi.iot.iiframework.source.InformationSourceType;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan("fi.iot.iiframework")
public class Application {

    public static final Logger logger = Logger.getLogger(Application.class.getName());

    public static void main(String[] args) throws JAXBException, MalformedURLException, IOException {
        ApplicationContext ctx = SpringApplication.run(Application.class, args);
        logger.log(Level.CONFIG, "Following beans found:\t{0}", Arrays.toString(ctx.getBeanDefinitionNames()));

        SysError e = new SysError(ErrorType.UNKNOWN_ERROR, ErrorSeverity.NOTIFICATION, "This is a test error");
        ErrorLogger.log(e);

        SysError e2 = new SysError(ErrorType.CONFLICT_ERROR, ErrorSeverity.HIGH, "This is an another test error");
        ErrorLogger.log(e2);

        SysError e3 = new SysError(ErrorType.TIMEOUT_ERROR, ErrorSeverity.FATAL, "This is an another test error");
        ErrorLogger.log(e3);

        SysError e4 = new SysError(ErrorType.BAD_REQUEST, ErrorSeverity.NOTIFICATION, "This is an another test error");
        ErrorLogger.log(e4);

    }

}

@@ -1472,24 +1472,634 @@
 Names()));%0A%0A
+        initTestData(ctx);%0A    %7D%0A%0A    private static void initTestData(ApplicationContext ctx) throws JAXBException, IOException %7B%0A        InformationSourceManager infSourceManager = ctx.getBean(InformationSourceManager.class);%0A%0A        InformationSourceConfiguration config = new InformationSourceConfiguration();%0A        config.setName(%22Example Config%22);%0A        config.setType(InformationSourceType.XML);%0A        config.setUrl(%22http://axwikstr.users.cs.helsinki.fi/data.xml%22);%0A        infSourceManager.createSource(config);%0A        infSourceManager.getSources().get(config.getId()).readAndWrite();%0A        %0A
         SysE
@@ -2190,32 +2190,32 @@
 a test error%22);%0A
-
         ErrorLog
@@ -2666,18 +2666,16 @@
 og(e4);%0A
-%0A
     %7D%0A
-%0A
 %7D%0A

test code to separate method