@@ -0,0 +1,3065 @@
+package org.pdxfinder.commands.postload;%0A%0Aimport joptsimple.OptionParser;%0Aimport joptsimple.OptionSet;%0Aimport org.pdxfinder.graph.dao.ModelCreation;%0Aimport org.pdxfinder.services.DataImportService;%0Aimport org.pdxfinder.services.UtilityService;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.CommandLineRunner;%0Aimport org.springframework.stereotype.Component;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.InputStreamReader;%0Aimport java.net.URL;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Paths;%0Aimport java.util.Collection;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0Aimport java.util.stream.Stream;%0A%0A/*%0A * Created by csaba on 23/03/2019.%0A */%0A%0A@Component%0Apublic class CheckPDXPages implements CommandLineRunner%7B%0A%0A    private final static Logger log = LoggerFactory.getLogger(CheckPDXPages.class);%0A%0A    private String errorHtml = %22err_body%22;%0A    private String successHtml = %22level2%22;%0A%0A%0A    @Autowired%0A    DataImportService dataImportService;%0A%0A    @Autowired%0A    UtilityService utilityService;%0A%0A    @Override%0A    public void run(String... args) throws Exception %7B%0A%0A%0A        OptionParser parser = new OptionParser();%0A        parser.allowsUnrecognizedOptions();%0A        parser.accepts(%22checkPDXPages%22, %22Testing PDX details page urls%22);%0A        OptionSet options = parser.parse(args);%0A%0A%0A        if (options.has(%22checkPDXPages%22)) %7B%0A%0A            testDetailsPageUrls();%0A        %7D%0A%0A    %7D%0A%0A%0A    private void testDetailsPageUrls()%7B%0A%0A        Collection%3CModelCreation%3E models = dataImportService.findAllModels();%0A%0A        String html = %22%22;%0A        for(ModelCreation model : models)%7B%0A%0A            long startTime = System.currentTimeMillis();%0A            String url = %22http://localhost:8080/data/pdx/%22+model.getDataSource()+%22/%22+model.getSourcePdxId();%0A%0A            html = parseURL(url);%0A            long endTime = System.currentTimeMillis();%0A            long totalTime = endTime - startTime;%0A            checkPageContent(html, url, Long.toString(totalTime));%0A%0A        %7D%0A%0A        //log.info(html);%0A%0A    %7D%0A%0A%0A    private void checkPageContent(String html, String url, String responseTime)%7B%0A%0A        if(html == null %7C%7C html.isEmpty() %7C%7C html.contains(errorHtml))%7B%0A            log.error(%22Page is not available %22+url);%0A        %7D%0A        else if(html.contains(successHtml))%7B%0A            log.info(%22Details page is up: %22+url+%22 Response time: %22+responseTime+%22ms%22);%0A        %7D%0A        else%7B%0A            log.warn(%22What has just happened??? %22+url);%0A        %7D%0A    %7D%0A%0A%0A%0A    public String parseURL(String urlStr) %7B%0A%0A        StringBuilder sb = new StringBuilder();%0A%0A        try %7B%0A            URL url = new URL(urlStr);%0A            BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));%0A            String inputLine;%0A            while ((inputLine = in.readLine()) != null) %7B%0A                sb.append(inputLine);%0A            %7D%0A            in.close();%0A        %7D catch (Exception e) %7B%0A            return %22%22;%0A        %7D%0A        return sb.toString();%0A    %7D%0A%7D%0A

Add details page checking command