// Path: src/test/java/no/cantara/cs/testsupport/ApplicationConfigBuilder.java
// public class ApplicationConfigBuilder {
// 
//     public static ApplicationConfig createConfigDto(String name, Application application) {
//         MavenMetadata metadata = new MavenMetadata("net.whydah.identity", application.artifactId, "2.0.1.Final");
//         String url = new NexusUrlBuilder("http://mvnrepo.cantara.no", "releases").build(metadata);
//         DownloadItem downloadItem = new DownloadItem(url, null, null, metadata);
//         EventExtractionConfig extractionConfig = new EventExtractionConfig("jau");
//         EventExtractionTag tag = new EventExtractionTag("testtag", "\\bheihei\\b", "logs/blabla.logg");
//         extractionConfig.addEventExtractionTag(tag);
// 
//         ApplicationConfig config = new ApplicationConfig(name);
//         config.addDownloadItem(downloadItem);
//         config.addEventExtractionConfig(extractionConfig);
//         config.setStartServiceScript("java -DIAM_MODE=DEV -jar " + downloadItem.filename());
// 
//         LinkedHashMap<String, String> propertiesMap = new LinkedHashMap<>();
//         propertiesMap.put("a", "1");
//         propertiesMap.put("b", "2");
//         config.addPropertiesStore(new NamedPropertiesStore(propertiesMap, "named_properties_store.properties"));
// 
//         return config;
//     }
// }
// 
// Path: src/test/java/no/cantara/cs/testsupport/BaseSystemTest.java
// @Test(groups = "system-test")
// public abstract class BaseSystemTest {
//     private TestServer testServer;
//     private ConfigServiceClient configServiceClient;
// 
//     @BeforeClass
//     @Parameters({ "persistenceType" })
//     public void startServer(@Optional("mapdb") String persistenceType) throws Exception {
//         if (persistenceType.equals("postgres")) {
//             testServer = new TestServerPostgres(getClass());
//         } else {
//             testServer = new TestServerMapDb(getClass());
//         }
//         testServer.cleanAllData();
//         testServer.start();
//         configServiceClient = testServer.getConfigServiceClient();
//     }
// 
//     @AfterClass
//     public void stop() {
//         if (testServer != null) {
//             testServer.stop();
//         }
//         configServiceClient.cleanApplicationState();
//     }
// 
//     public TestServer getTestServer() {
//         return testServer;
//     }
// 
//     public ConfigServiceClient getConfigServiceClient() {
//         return configServiceClient;
//     }
// 
//     public ConfigServiceAdminClient getConfigServiceAdminClient() {
//         return testServer.getAdminClient();
//     }
// }


import no.cantara.cs.client.ConfigServiceAdminClient;
import no.cantara.cs.dto.*;
import no.cantara.cs.testsupport.ApplicationConfigBuilder;
import no.cantara.cs.testsupport.BaseSystemTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
import static org.testng.Assert.*;
package no.cantara.cs.admin;




/**
 * @author Asbjørn Willersrud
 */
public class ClientAdminResourceStatusTest extends BaseSystemTest {
    private Application application;
    private ClientConfig clientConfig;

    @BeforeClass
    public void setup() throws Exception {
        ConfigServiceAdminClient configServiceAdminClient = getConfigServiceAdminClient();
        application = configServiceAdminClient.registerApplication("ClientStatusTest-ArtifactId");
// Path: src/test/java/no/cantara/cs/testsupport/ApplicationConfigBuilder.java
// public class ApplicationConfigBuilder {
// 
//     public static ApplicationConfig createConfigDto(String name, Application application) {
//         MavenMetadata metadata = new MavenMetadata("net.whydah.identity", application.artifactId, "2.0.1.Final");
//         String url = new NexusUrlBuilder("http://mvnrepo.cantara.no", "releases").build(metadata);
//         DownloadItem downloadItem = new DownloadItem(url, null, null, metadata);
//         EventExtractionConfig extractionConfig = new EventExtractionConfig("jau");
//         EventExtractionTag tag = new EventExtractionTag("testtag", "\\bheihei\\b", "logs/blabla.logg");
//         extractionConfig.addEventExtractionTag(tag);
// 
//         ApplicationConfig config = new ApplicationConfig(name);
//         config.addDownloadItem(downloadItem);
//         config.addEventExtractionConfig(extractionConfig);
//         config.setStartServiceScript("java -DIAM_MODE=DEV -jar " + downloadItem.filename());
// 
//         LinkedHashMap<String, String> propertiesMap = new LinkedHashMap<>();
//         propertiesMap.put("a", "1");
//         propertiesMap.put("b", "2");
//         config.addPropertiesStore(new NamedPropertiesStore(propertiesMap, "named_properties_store.properties"));
// 
//         return config;
//     }
// }
// 
// Path: src/test/java/no/cantara/cs/testsupport/BaseSystemTest.java
// @Test(groups = "system-test")
// public abstract class BaseSystemTest {
//     private TestServer testServer;
//     private ConfigServiceClient configServiceClient;
// 
//     @BeforeClass
//     @Parameters({ "persistenceType" })
//     public void startServer(@Optional("mapdb") String persistenceType) throws Exception {
//         if (persistenceType.equals("postgres")) {
//             testServer = new TestServerPostgres(getClass());
//         } else {
//             testServer = new TestServerMapDb(getClass());
//         }
//         testServer.cleanAllData();
//         testServer.start();
//         configServiceClient = testServer.getConfigServiceClient();
//     }
// 
//     @AfterClass
//     public void stop() {
//         if (testServer != null) {
//             testServer.stop();
//         }
//         configServiceClient.cleanApplicationState();
//     }
// 
//     public TestServer getTestServer() {
//         return testServer;
//     }
// 
//     public ConfigServiceClient getConfigServiceClient() {
//         return configServiceClient;
//     }
// 
//     public ConfigServiceAdminClient getConfigServiceAdminClient() {
//         return testServer.getAdminClient();
//     }
// }


// Path: src/test/java/no/cantara/cs/admin/ClientAdminResourceStatusTest.java
import no.cantara.cs.client.ConfigServiceAdminClient;
import no.cantara.cs.dto.*;
import no.cantara.cs.testsupport.ApplicationConfigBuilder;
import no.cantara.cs.testsupport.BaseSystemTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
import static org.testng.Assert.*;

package no.cantara.cs.admin;




/**
 * @author Asbjørn Willersrud
 */
public class ClientAdminResourceStatusTest extends BaseSystemTest {
    private Application application;
    private ClientConfig clientConfig;

    @BeforeClass
    public void setup() throws Exception {
        ConfigServiceAdminClient configServiceAdminClient = getConfigServiceAdminClient();
        application = configServiceAdminClient.registerApplication("ClientStatusTest-ArtifactId");
        configServiceAdminClient.createApplicationConfig(application, ApplicationConfigBuilder.createConfigDto("arbitrary-config", application));