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