golang integration
This commit is contained in:
parent
8926837a3e
commit
681e3d751e
7 changed files with 53 additions and 135 deletions
|
@ -1,49 +0,0 @@
|
|||
<!--
|
||||
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
~ and other contributors as indicated by the @author tags.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<assembly>
|
||||
<id>kcinit-dist</id>
|
||||
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
</formats>
|
||||
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
|
||||
<files>
|
||||
<file>
|
||||
<source>../kcinit/src/main/bin/kcinit</source>
|
||||
<outputDirectory>kcinit</outputDirectory>
|
||||
<fileMode>0755</fileMode>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
<file>
|
||||
<source>../kcinit/src/main/bin/kcinit.bat</source>
|
||||
<outputDirectory>kcinit</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
</files>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<includes>
|
||||
<include>org.keycloak:kcinit</include>
|
||||
</includes>
|
||||
<outputDirectory>kcinit</outputDirectory>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
|
||||
</assembly>
|
|
@ -1,69 +0,0 @@
|
|||
<!--
|
||||
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
~ and other contributors as indicated by the @author tags.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>keycloak-client-cli-parent</artifactId>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<version>4.0.0.CR1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>kcinit-dist</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Kcinit Distribution</name>
|
||||
<description/>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>kcinit</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>kcinit-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>assemble</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<outputDirectory>
|
||||
target
|
||||
</outputDirectory>
|
||||
<workDirectory>
|
||||
target/assembly/work
|
||||
</workDirectory>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -35,7 +35,6 @@
|
|||
<module>as7-eap6</module>
|
||||
<module>installed</module>
|
||||
<module>kcinit</module>
|
||||
<module>kcinit-dist</module>
|
||||
<module>jaxrs-oauth-client</module>
|
||||
<module>jetty</module>
|
||||
<module>js</module>
|
||||
|
|
|
@ -228,18 +228,46 @@
|
|||
<type>zip</type>
|
||||
<outputDirectory>${containers.home}</outputDirectory>
|
||||
</artifactItem>
|
||||
<artifactItem>
|
||||
<groupId>org.keycloak</groupId>
|
||||
<artifactId>kcinit-dist</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>zip</type>
|
||||
<outputDirectory>${containers.home}</outputDirectory>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.igormaznitsa</groupId>
|
||||
<artifactId>mvn-golang-wrapper</artifactId>
|
||||
<version>2.1.6</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<goVersion>1.9.2</goVersion>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>a</id>
|
||||
<goals>
|
||||
<goal>get</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<packages>
|
||||
<package>github.com/inconshreveable/mousetrap</package>
|
||||
<package>github.com/keycloak/kcinit</package>
|
||||
</packages>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>b</id>
|
||||
<goals>
|
||||
<goal>build</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<resultName>kcinit</resultName>
|
||||
<packages>
|
||||
<package>github.com/keycloak/kcinit</package>
|
||||
</packages>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ import java.io.InputStream;
|
|||
*/
|
||||
public class KcinitExec extends AbstractExec {
|
||||
|
||||
public static final String WORK_DIR = System.getProperty("user.dir") + "/target/containers/kcinit";
|
||||
public static final String WORK_DIR = System.getProperty("user.dir") + "/target";
|
||||
|
||||
public static final String CMD = OS_ARCH.isWindows() ? "kcinit.bat" : "kcinit";
|
||||
public static final String CMD = OS_ARCH.isWindows() ? "kcinit" : "kcinit";
|
||||
|
||||
private KcinitExec(String workDir, String argsLine, InputStream stdin) {
|
||||
this(workDir, argsLine, null, stdin);
|
||||
|
|
|
@ -34,7 +34,7 @@ public abstract class AbstractExec {
|
|||
|
||||
private boolean logStreams = Boolean.valueOf(System.getProperty("cli.log.output", "true"));
|
||||
|
||||
protected boolean dumpStreams;
|
||||
protected boolean dumpStreams = true;
|
||||
|
||||
protected String workDir = WORK_DIR;
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ public class KcinitTest extends AbstractTestRealmKeycloakTest {
|
|||
public void testBadCommand() throws Exception {
|
||||
KcinitExec exe = KcinitExec.execute("covfefe");
|
||||
Assert.assertEquals(1, exe.exitCode());
|
||||
Assert.assertEquals("stderr first line", "Unknown command: covfefe", exe.stderrLines().get(0));
|
||||
Assert.assertEquals("stderr first line", "Error: unknown command \"covfefe\" for \"kcinit\"", exe.stderrLines().get(0));
|
||||
}
|
||||
|
||||
//@Test
|
||||
|
@ -175,16 +175,21 @@ public class KcinitTest extends AbstractTestRealmKeycloakTest {
|
|||
exe = KcinitExec.newBuilder()
|
||||
.argsLine("install")
|
||||
.executeAsync();
|
||||
exe.waitForStderr("(y/n):");
|
||||
exe.sendLine("n");
|
||||
//System.out.println(exe.stderrString());
|
||||
//exe.waitForStderr("(y/n):");
|
||||
//exe.sendLine("n");
|
||||
exe.waitForStderr("Authentication server URL [http://localhost:8080/auth]:");
|
||||
exe.sendLine(OAuthClient.AUTH_SERVER_ROOT);
|
||||
//System.out.println(exe.stderrString());
|
||||
exe.waitForStderr("Name of realm [master]:");
|
||||
exe.sendLine("test");
|
||||
//System.out.println(exe.stderrString());
|
||||
exe.waitForStderr("client id [kcinit]:");
|
||||
exe.sendLine("");
|
||||
exe.waitForStderr("client secret [none]:");
|
||||
//System.out.println(exe.stderrString());
|
||||
exe.waitForStderr("Client secret [none]:");
|
||||
exe.sendLine("password");
|
||||
//System.out.println(exe.stderrString());
|
||||
exe.waitCompletion();
|
||||
Assert.assertEquals(0, exe.exitCode());
|
||||
}
|
||||
|
@ -193,13 +198,17 @@ public class KcinitTest extends AbstractTestRealmKeycloakTest {
|
|||
public void testBasic() throws Exception {
|
||||
testInstall();
|
||||
// login
|
||||
//System.out.println("login....");
|
||||
KcinitExec exe = KcinitExec.newBuilder()
|
||||
.argsLine("login")
|
||||
.executeAsync();
|
||||
//System.out.println(exe.stderrString());
|
||||
exe.waitForStderr("Username:");
|
||||
exe.sendLine("wburke");
|
||||
//System.out.println(exe.stderrString());
|
||||
exe.waitForStderr("Password:");
|
||||
exe.sendLine("password");
|
||||
//System.out.println(exe.stderrString());
|
||||
exe.waitForStderr("Login successful");
|
||||
exe.waitCompletion();
|
||||
Assert.assertEquals(0, exe.exitCode());
|
||||
|
@ -233,7 +242,7 @@ public class KcinitTest extends AbstractTestRealmKeycloakTest {
|
|||
Assert.assertEquals(1, exe.exitCode());
|
||||
Assert.assertEquals(0, exe.stdoutLines().size());
|
||||
Assert.assertEquals(1, exe.stderrLines().size());
|
||||
Assert.assertTrue(exe.stderrLines().get(0).contains("Failed to exchange token: invalid_client. Audience not found"));
|
||||
Assert.assertTrue(exe.stderrLines().get(0), exe.stderrLines().get(0).contains("failed to exchange token: invalid_client Audience not found"));
|
||||
|
||||
exe = KcinitExec.execute("logout");
|
||||
Assert.assertEquals(0, exe.exitCode());
|
||||
|
|
Loading…
Reference in a new issue