-
Notifications
You must be signed in to change notification settings - Fork 463
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added simple javabean to hold values instead of properties
use SimpleTable for output added simple test added help text
- Loading branch information
Showing
6 changed files
with
179 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
cli/src/main/java/org/jboss/as/cli/impl/ConnectionInfoBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2011, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.cli.impl; | ||
|
||
import java.security.cert.X509Certificate; | ||
import java.util.Date; | ||
|
||
public class ConnectionInfoBean { | ||
|
||
private boolean disableLocalAuth; | ||
private String username; | ||
private Date loggedSince; | ||
private X509Certificate[] serverCertificates; | ||
|
||
public boolean isDisableLocalAuth() { | ||
return disableLocalAuth; | ||
} | ||
|
||
public void setDisableLocalAuth(boolean disableLocalAuth) { | ||
this.disableLocalAuth = disableLocalAuth; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public Date getLoggedSince() { | ||
return loggedSince; | ||
} | ||
|
||
public void setLoggedSince(Date loggedSince) { | ||
this.loggedSince = loggedSince; | ||
} | ||
|
||
public X509Certificate[] getServerCertificates() { | ||
return serverCertificates; | ||
} | ||
|
||
public void setServerCertificates(X509Certificate[] serverCertificates) { | ||
this.serverCertificates = serverCertificates; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
SYNOPSIS | ||
|
||
connection-info | ||
|
||
DESCRIPTION | ||
|
||
Prints information about the current connection to the server. The | ||
information is username and date and hour since the user is logged in. | ||
If it is an SSL connection it also prints the server certificate as: | ||
subject, issuer, validity, SHA1 and MD5 fingerprint. | ||
|
||
|
||
ARGUMENTS | ||
|
||
n/a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...c/test/java/org/jboss/as/cli/completion/operation/test/ConnectionInfoHandlerTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2011, Red Hat, Inc., and individual contributors | ||
* as indicated by the @author tags. See the copyright.txt file in the | ||
* distribution for a full listing of individual contributors. | ||
* | ||
* This is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation; either version 2.1 of | ||
* the License, or (at your option) any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this software; if not, write to the Free | ||
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.jboss.as.cli.completion.operation.test; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
import org.jboss.as.cli.completion.mock.MockCommandContext; | ||
import org.jboss.as.cli.impl.ConnectionInfoBean; | ||
import org.junit.Test; | ||
|
||
/** | ||
* | ||
* @author Claudio Miranda | ||
*/ | ||
public class ConnectionInfoHandlerTestCase { | ||
|
||
private MockCommandContext ctx; | ||
|
||
public ConnectionInfoHandlerTestCase() { | ||
ctx = new MockCommandContext(); | ||
} | ||
|
||
@Test | ||
public void testConnected() { | ||
// if the username is populated, it is connected to the server. | ||
ConnectionInfoBean connInfo = (ConnectionInfoBean) ctx.get("connection_info"); | ||
assertNotNull(connInfo.getUsername()); | ||
} | ||
|
||
} |