|
|
@@ -1,29 +1,55 @@
|
|
|
package com.psi.gabontel.mobileapp.thirdparty.helper;
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Hashtable;
|
|
|
|
|
|
import javax.naming.Context;
|
|
|
import javax.naming.InitialContext;
|
|
|
|
|
|
+import com.psi.applicationmanager.AppManagerFunction;
|
|
|
import com.psi.ussd.interfaces.UssdReceiverFunction;
|
|
|
|
|
|
public class Test {
|
|
|
-
|
|
|
public static void main(String[] args) {
|
|
|
-// final Hashtable<String, String> jndiProperties = new Hashtable<>();
|
|
|
-// //jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
|
|
|
-// jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
|
|
|
-// jndiProperties.put(Context.PROVIDER_URL, "http://localhost:8280/wildfly-services");
|
|
|
-// String jndi = "java:jboss/exported/Test_110_GabonTelUssdMfsInfo/GetMfsTypeBean!com.psi.ussd.interfaces.UssdReceiverFunction";
|
|
|
-// try {
|
|
|
-// final Context context = new InitialContext(jndiProperties);
|
|
|
-// UssdReceiverFunction reference = (UssdReceiverFunction) context.lookup(jndi.replace("java:jboss/exported", "ejb:") );
|
|
|
-// System.out.println(reference.requestFunc(Arrays.asList("moov","241060000")));
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
+ if(1==1)
|
|
|
+ appman(args);
|
|
|
+ else
|
|
|
+ ussd(args);
|
|
|
+ }
|
|
|
+ public static void appman(String[] args) {
|
|
|
+ final Hashtable<String, String> jndiProperties = new Hashtable<>();
|
|
|
+ //jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
|
|
|
+ jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
|
|
|
+ jndiProperties.put(Context.PROVIDER_URL, "http://127.0.0.1:8180/wildfly-services");
|
|
|
+ String jndi = "java:jboss/exported/Test_210_GabonTelMobicashMobileAppHelper/MobileAppThirdPartyHelper!com.psi.applicationmanager.AppManagerFunction";
|
|
|
+ try {
|
|
|
+ final Context context = new InitialContext(jndiProperties);
|
|
|
+ AppManagerFunction reference = (AppManagerFunction) context.lookup(jndi.replace("java:jboss/exported", "ejb:") );
|
|
|
+ HashMap<String,String> map = new HashMap<String,String>();
|
|
|
+ map.put("key", "MNFO1");
|
|
|
+ map.put("method", "postpaidinvoices");
|
|
|
+ map.put("param", "01765853");
|
|
|
+ map.put("language", "F");
|
|
|
+ System.out.println(reference.processTransaction("320180805000101", "24106394167", "MNFO1 postpaidinvoices 01765853", map));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ System.exit(0);
|
|
|
+ }
|
|
|
+ public static void ussd(String[] args) {
|
|
|
+ final Hashtable<String, String> jndiProperties = new Hashtable<>();
|
|
|
+ //jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
|
|
|
+ jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.wildfly.naming.client.WildFlyInitialContextFactory");
|
|
|
+ jndiProperties.put(Context.PROVIDER_URL, "http://127.0.0.1:8280/wildfly-services");
|
|
|
+ String jndi = "java:jboss/exported/Test_110_GabonTelUssdPostpaidInfo/GetListOfInvoicesBean!com.psi.ussd.interfaces.UssdReceiverFunction";
|
|
|
+ try {
|
|
|
+ final Context context = new InitialContext(jndiProperties);
|
|
|
+ UssdReceiverFunction reference = (UssdReceiverFunction) context.lookup(jndi.replace("java:jboss/exported", "ejb:") );
|
|
|
+ System.out.println(reference.requestFunc(Arrays.asList(new String[] {"01765853"})));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
System.exit(0);
|
|
|
}
|
|
|
-
|
|
|
}
|