Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more tests, SMSC-418, SMSC-419, SMSC-420, SMSC-421, MSB-3445
- Loading branch information
Showing
37 changed files
with
1,595 additions
and
466 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 @@ | ||
*.log |
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 @@ | ||
*.txt |
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
2 changes: 1 addition & 1 deletion
2
...mobicents/protocols/smpp/HelperClass.java → .../org/mobicents/protocols/HelperClass.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
61 changes: 61 additions & 0 deletions
61
test/features/src/test/java/org/mobicents/protocols/http/HttpManagementProxy.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,61 @@ | ||
/** | ||
* | ||
*/ | ||
package org.mobicents.protocols.http; | ||
|
||
import java.util.HashMap; | ||
|
||
import javax.management.MBeanServerConnection; | ||
import javax.management.ObjectName; | ||
import javax.management.remote.JMXConnector; | ||
import javax.management.remote.JMXConnectorFactory; | ||
import javax.management.remote.JMXServiceURL; | ||
|
||
/** | ||
* @author Olena Radiboh (olena.radiboh@telestax.com) | ||
*/ | ||
public class HttpManagementProxy { | ||
public static final String JMX_DOMAIN = "org.mobicents.smsc"; | ||
public static final String JMX_LAYER_HTTP_USERS_MANAGEMENT = "HttpUserManagement"; | ||
public static final String JMX_LAYER_HTTP_USER = "HttpUser"; | ||
|
||
private MBeanServerConnection mbsc; | ||
private ObjectName httpUserManagementName; | ||
private ObjectName httpUserName; | ||
|
||
public HttpManagementProxy() throws Exception { | ||
// Provide credentials required by server for user authentication | ||
HashMap environment = new HashMap(); | ||
// String[] credentials = new String[] {"admin", "admin"}; | ||
// environment.put (JMXConnector.CREDENTIALS, credentials); | ||
|
||
// Create JMXServiceURL of JMX Connector (must be known in advance) | ||
JMXServiceURL url; | ||
|
||
url = new JMXServiceURL("service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1190/jmxconnector"); | ||
|
||
// Get JMX connector | ||
JMXConnector jmxc = JMXConnectorFactory.connect(url, environment); | ||
|
||
httpUserManagementName = new ObjectName( | ||
JMX_DOMAIN + ":layer=" + JMX_LAYER_HTTP_USERS_MANAGEMENT + ",name=SmscManagement"); | ||
|
||
// Get MBean server connection | ||
mbsc = jmxc.getMBeanServerConnection(); | ||
} | ||
|
||
public void createHttpUser(String user, String password, int networkId) throws Exception { | ||
String[] signature = new String[] { String.class.getName(), String.class.getName(), int.class.getName() }; | ||
Object[] params = new Object[] { user, password, networkId }; | ||
try { | ||
mbsc.invoke(httpUserManagementName, "createHttpUser", params, signature); | ||
} catch (Exception e) { | ||
} | ||
} | ||
|
||
public void destroyHttpUser(String user) throws Exception { | ||
String[] signature = new String[] { String.class.getName() }; | ||
Object[] params = new Object[] { user }; | ||
mbsc.invoke(httpUserManagementName, "destroyHttpUser", params, signature); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
test/features/src/test/java/org/mobicents/protocols/http/TestHttpClient.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,55 @@ | ||
/** | ||
* | ||
*/ | ||
package org.mobicents.protocols.http; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.commons.httpclient.HttpClient; | ||
import org.apache.commons.httpclient.HttpException; | ||
import org.apache.commons.httpclient.methods.PostMethod; | ||
|
||
/** | ||
* @author Olena Radiboh (olena.radiboh@telestax.com) | ||
*/ | ||
public class TestHttpClient { | ||
|
||
public static String HTTP_USER = "userid"; | ||
public static String HTTP_PASSWORD = "password"; | ||
public static String HTTP_MESSAGE = "msg"; | ||
public static String HTTP_FROM = "sender"; | ||
public static String HTTP_TO = "to"; | ||
|
||
private String user; | ||
private String password; | ||
private String hostPort; | ||
|
||
public TestHttpClient(String user, String password, String hostPort) { | ||
this.user = user; | ||
this.password = password; | ||
this.hostPort = hostPort; | ||
} | ||
|
||
public void sendHttpMessage(String senderAddr, String receiverAddr, String message) throws HttpException, IOException { | ||
PostMethod post = new PostMethod("http://" + hostPort + "/restcomm/sendSms"); | ||
HttpClient httpclient = new HttpClient(); | ||
|
||
post.setParameter(HTTP_USER, user); | ||
post.setParameter(HTTP_PASSWORD, password); | ||
post.setParameter(HTTP_FROM, senderAddr); | ||
post.setParameter(HTTP_TO, receiverAddr); | ||
post.setParameter(HTTP_MESSAGE, message); | ||
|
||
// post.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(message.getBytes()), message.length())); | ||
|
||
try { | ||
int result = httpclient.executeMethod(post); | ||
System.out.println("Response status code: " + result); | ||
System.out.println("Response body: "); | ||
System.out.println(post.getResponseBodyAsString()); | ||
} finally { | ||
post.releaseConnection(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.