Search in sources :

Example 1 with WildflyClient

use of org.guvnor.ala.wildfly.access.WildflyClient in project kie-wb-common by kiegroup.

the class WildflyRuntimeTest method waitForAppBuildTest.

@Test
public void waitForAppBuildTest() {
    final Optional<Source> _source = new GitConfigExecutor(new InMemorySourceRegistry()).apply(new GitConfigImpl(tempPath.getAbsolutePath(), "master", gitUrl, "drools-workshop-build", "true"));
    assertTrue(_source.isPresent());
    final Source source = _source.get();
    assertNotNull(source);
    List<String> goals = new ArrayList<>();
    goals.add("package");
    Properties properties = new Properties();
    properties.setProperty("failIfNoTests", "false");
    final Path projectRoot = source.getPath();
    final InputStream pomStream = org.uberfire.java.nio.file.Files.newInputStream(projectRoot.resolve("pom.xml"));
    final MavenProject project = MavenProjectLoader.parseMavenPom(pomStream);
    RepositoryVisitor repositoryVisitor = new RepositoryVisitor(projectRoot, project.getName());
    final String expectedBinary = project.getArtifact().getArtifactId() + "-" + project.getArtifact().getVersion() + "." + project.getArtifact().getType();
    final org.guvnor.ala.build.maven.model.MavenProject mavenProject = new MavenProjectImpl(project.getId(), project.getArtifact().getType(), project.getName(), expectedBinary, source.getPath(), source.getPath(), source.getPath().resolve("target").resolve(expectedBinary).toAbsolutePath(), repositoryVisitor.getRoot().getAbsolutePath(), null);
    final File pom = new File(mavenProject.getTempDir(), "pom.xml");
    MavenBuildExecutor.executeMaven(pom, properties, goals.toArray(new String[0]));
    final File file = new File(repositoryVisitor.getRoot().getAbsolutePath() + "/target/" + mavenProject.getExpectedBinary());
    WildflyClient wildflyClient = new WildflyClient("", "admin", "Admin#70365", ip, 8080, 9990);
    wildflyClient.deploy(file);
    final String id = file.getName();
    WildflyAppState appState = wildflyClient.getAppState(id);
    assertNotNull(appState);
    assertTrue(appState.getState().equals(RUNNING));
    wildflyClient.undeploy(id);
    appState = wildflyClient.getAppState(id);
    assertNotNull(appState);
    assertTrue(appState.getState().equals(UNKNOWN));
    wildflyClient.deploy(file);
    appState = wildflyClient.getAppState(id);
    assertNotNull(appState);
    assertTrue(appState.getState().equals(RUNNING));
}
Also used : Path(org.uberfire.java.nio.file.Path) GitConfigImpl(org.guvnor.ala.source.git.config.impl.GitConfigImpl) InputStream(java.io.InputStream) RepositoryVisitor(org.guvnor.ala.build.maven.util.RepositoryVisitor) ArrayList(java.util.ArrayList) WildflyClient(org.guvnor.ala.wildfly.access.WildflyClient) MavenProjectImpl(org.guvnor.ala.build.maven.model.impl.MavenProjectImpl) Properties(java.util.Properties) WildflyAppState(org.guvnor.ala.wildfly.access.WildflyAppState) Source(org.guvnor.ala.source.Source) GitConfigExecutor(org.guvnor.ala.source.git.executor.GitConfigExecutor) InMemorySourceRegistry(org.guvnor.ala.registry.inmemory.InMemorySourceRegistry) MavenProject(org.apache.maven.project.MavenProject) File(java.io.File) Test(org.junit.Test)

Example 2 with WildflyClient

use of org.guvnor.ala.wildfly.access.WildflyClient in project kie-wb-common by kiegroup.

the class WildflyAccessInterfaceImplTest method testWildflyClient.

@Test
public void testWildflyClient() {
    final String hostId = "localhost";
    final String port = "8081";
    final String managementPort = "9991";
    final String user = "admin";
    final String password = "pass";
    final WildflyClient client = accessInterface.getWildflyClient(new WildflyProviderImpl(new WildflyProviderConfigImpl(PROVIDER, hostId, port, managementPort, user, password)));
    assertNotNull(client);
    assertEquals(client.getPort(), 8081);
    assertEquals(client.getManagementPort(), 9991);
    assertEquals(client.getHost(), hostId);
    assertEquals(client.getProviderName(), PROVIDER);
    assertEquals(client.getUser(), user);
    assertEquals(client.getPassword(), password);
}
Also used : WildflyProviderImpl(org.guvnor.ala.wildfly.model.WildflyProviderImpl) WildflyClient(org.guvnor.ala.wildfly.access.WildflyClient) WildflyProviderConfigImpl(org.guvnor.ala.wildfly.config.impl.WildflyProviderConfigImpl) Test(org.junit.Test)

Example 3 with WildflyClient

use of org.guvnor.ala.wildfly.access.WildflyClient in project kie-wb-common by kiegroup.

the class WildflyAccessInterfaceImplTest method testWildflyClientNull.

@Test
public void testWildflyClientNull() {
    final WildflyClient client = accessInterface.getWildflyClient(new WildflyProviderImpl(new WildflyProviderConfigImpl(PROVIDER, null, null, null, null, null)));
    assertNotNull(client);
    assertEquals(client.getPort(), 8080);
    assertEquals(client.getManagementPort(), 9990);
}
Also used : WildflyProviderImpl(org.guvnor.ala.wildfly.model.WildflyProviderImpl) WildflyClient(org.guvnor.ala.wildfly.access.WildflyClient) WildflyProviderConfigImpl(org.guvnor.ala.wildfly.config.impl.WildflyProviderConfigImpl) Test(org.junit.Test)

Aggregations

WildflyClient (org.guvnor.ala.wildfly.access.WildflyClient)3 Test (org.junit.Test)3 WildflyProviderConfigImpl (org.guvnor.ala.wildfly.config.impl.WildflyProviderConfigImpl)2 WildflyProviderImpl (org.guvnor.ala.wildfly.model.WildflyProviderImpl)2 File (java.io.File)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 MavenProject (org.apache.maven.project.MavenProject)1 MavenProjectImpl (org.guvnor.ala.build.maven.model.impl.MavenProjectImpl)1 RepositoryVisitor (org.guvnor.ala.build.maven.util.RepositoryVisitor)1 InMemorySourceRegistry (org.guvnor.ala.registry.inmemory.InMemorySourceRegistry)1 Source (org.guvnor.ala.source.Source)1 GitConfigImpl (org.guvnor.ala.source.git.config.impl.GitConfigImpl)1 GitConfigExecutor (org.guvnor.ala.source.git.executor.GitConfigExecutor)1 WildflyAppState (org.guvnor.ala.wildfly.access.WildflyAppState)1 Path (org.uberfire.java.nio.file.Path)1