Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sso
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
sso
Commits
4d972838
Commit
4d972838
authored
Jul 11, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
35f00dac
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
114 deletions
+40
-114
ConfirmQuotationTest.java
src/test/java/test/ConfirmQuotationTest.java
+21
-0
PriceListServiceTest.java
src/test/java/test/PriceListServiceTest.java
+6
-6
ShippingNotificationTest.java
src/test/java/test/ShippingNotificationTest.java
+13
-42
SoConfirmQuotationTest.java
src/test/java/test/SoConfirmQuotationTest.java
+0
-66
No files found.
src/test/java/test/ConfirmQuotationTest.java
0 → 100644
View file @
4d972838
package
test
;
import
com.egolm.sso.services.confirm_quotation.ConfirmQuotationService
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION
;
import
com.egolm.sso.util.ServiceFactory
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
public
class
ConfirmQuotationTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
wsdlLocation
=
"http://localhost:8080/sso/services/confirm_quotation?wsdl"
;
String
namespace
=
"http://confirm_quotation.sso.egolm.com"
;
String
serviceName
=
"ConfirmQuotationService"
;
ConfirmQuotationService
service
=
ServiceFactory
.
create
(
wsdlLocation
,
namespace
,
serviceName
,
ConfirmQuotationService
.
class
);
String
XML
=
StringUtil
.
readText
(
"D:/data/sso/007.XML"
);
Z_MT_SD_008_SO_CONFIRM_QUOTATION
Z_MT_SD_008_SO_CONFIRM_QUOTATION
=
XMLUtil
.
toBeanByJxab
(
XML
,
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
class
);
service
.
execute
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
);
}
}
src/test/java/test/PriceListServiceTest.java
View file @
4d972838
package
test
;
package
test
;
import
com.egolm.sso.services.
material_master.MaterialMaster
Service
;
import
com.egolm.sso.services.
price_list.PriceList
Service
;
import
com.egolm.sso.services.
material_master.Z_MT_SD_001_MATERIAL_MASTER
;
import
com.egolm.sso.services.
price_list.Z_MT_SD_002_PRICE_LIST
;
import
com.egolm.sso.util.ServiceFactory
;
import
com.egolm.sso.util.ServiceFactory
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.egolm.sso.util.XMLUtil
;
...
@@ -12,10 +12,10 @@ public class PriceListServiceTest {
...
@@ -12,10 +12,10 @@ public class PriceListServiceTest {
String
wsdlLocation
=
"http://localhost:8080/sso/services/price_list?wsdl"
;
String
wsdlLocation
=
"http://localhost:8080/sso/services/price_list?wsdl"
;
String
namespace
=
"http://price_list.sso.egolm.com"
;
String
namespace
=
"http://price_list.sso.egolm.com"
;
String
serviceName
=
"PriceListService"
;
String
serviceName
=
"PriceListService"
;
MaterialMasterService
service
=
ServiceFactory
.
create
(
wsdlLocation
,
namespace
,
serviceName
,
MaterialMaster
Service
.
class
);
PriceListService
service
=
ServiceFactory
.
create
(
wsdlLocation
,
namespace
,
serviceName
,
PriceList
Service
.
class
);
String
XML
=
StringUtil
.
readText
(
"D:/data/sso/00
1
.XML"
);
String
XML
=
StringUtil
.
readText
(
"D:/data/sso/00
2
.XML"
);
Z_MT_SD_00
1_MATERIAL_MASTER
Z_MT_SD_001_MATERIAL_MASTER
=
XMLUtil
.
toBeanByJxab
(
XML
,
Z_MT_SD_001_MATERIAL_MASTER
.
class
);
Z_MT_SD_00
2_PRICE_LIST
Z_MT_SD_002_PRICE_LIST
=
XMLUtil
.
toBeanByJxab
(
XML
,
Z_MT_SD_002_PRICE_LIST
.
class
);
service
.
execute
(
Z_MT_SD_00
1_MATERIAL_MASTER
);
service
.
execute
(
Z_MT_SD_00
2_PRICE_LIST
);
}
}
}
}
src/test/java/test/ShippingNotificationTest.java
View file @
4d972838
package
test
;
package
test
;
import
java.io.BufferedReader
;
import
com.egolm.sso.services.shipping_notfirmation.ShippingNotificationService
;
import
java.io.FileInputStream
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
;
import
java.io.IOException
;
import
com.egolm.sso.util.ServiceFactory
;
import
java.io.InputStreamReader
;
import
com.egolm.sso.util.StringUtil
;
import
java.util.Arrays
;
import
com.egolm.sso.util.XMLUtil
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.security.auth.callback.Callback
;
import
javax.security.auth.callback.CallbackHandler
;
import
org.apache.cxf.endpoint.ClientImpl
;
import
org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory
;
import
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor
;
import
org.apache.ws.security.WSConstants
;
import
org.apache.ws.security.handler.WSHandlerConstants
;
import
org.apache.wss4j.common.ext.WSPasswordCallback
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.sso.util.FileUtil
;
public
class
ShippingNotificationTest
{
public
class
ShippingNotificationTest
{
private
static
final
String
username
=
"test"
;
private
static
final
String
password
=
"78258c537d6e4d5fb210a57d05619fb6"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
JaxWsDynamicClientFactory
factory
=
JaxWsDynamicClientFactory
.
newInstance
();
String
wsdlLocation
=
"http://localhost:8080/sso/services/shipping_notification?wsdl"
;
ClientImpl
client
=
(
ClientImpl
)
factory
.
createClient
(
"http://localhost:8080/sso/services/shipping_notification?wsdl"
);
String
namespace
=
"http://shipping_notification.sso.egolm.com"
;
Map
<
String
,
Object
>
properties
=
new
HashMap
<
String
,
Object
>();
String
serviceName
=
"ShippingNotificationService"
;
properties
.
put
(
WSHandlerConstants
.
ACTION
,
WSHandlerConstants
.
USERNAME_TOKEN
);
ShippingNotificationService
service
=
ServiceFactory
.
create
(
wsdlLocation
,
namespace
,
serviceName
,
ShippingNotificationService
.
class
);
properties
.
put
(
WSHandlerConstants
.
USER
,
username
);
String
XML
=
StringUtil
.
readText
(
"D:/data/sso/007.XML"
);
properties
.
put
(
WSHandlerConstants
.
PASSWORD_TYPE
,
WSConstants
.
PW_DIGEST
);
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
=
XMLUtil
.
toBeanByJxab
(
XML
,
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
.
class
);
properties
.
put
(
WSHandlerConstants
.
PW_CALLBACK_REF
,
new
CallbackHandler
()
{
service
.
execute
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
);
public
void
handle
(
Callback
[]
callbacks
)
{
for
(
int
i
=
0
;
i
<
callbacks
.
length
;
i
++)
{
WSPasswordCallback
pc
=
(
WSPasswordCallback
)
callbacks
[
i
];
pc
.
setPassword
(
password
);
}
}
});
WSS4JOutInterceptor
interceptor
=
new
WSS4JOutInterceptor
();
interceptor
.
setProperties
(
properties
);
client
.
setOutInterceptors
(
Arrays
.
asList
(
interceptor
));
System
.
out
.
println
(
JSON
.
toJSONString
(
client
.
invoke
(
"execute"
,
FileUtil
.
readText
(
"D:/data/sso/007.XML"
))));
}
}
}
}
src/test/java/test/SoConfirmQuotationTest.java
deleted
100644 → 0
View file @
35f00dac
package
test
;
import
java.io.BufferedReader
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
import
javax.security.auth.callback.Callback
;
import
javax.security.auth.callback.CallbackHandler
;
import
org.apache.cxf.endpoint.ClientImpl
;
import
org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory
;
import
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor
;
import
org.apache.ws.security.WSConstants
;
import
org.apache.ws.security.handler.WSHandlerConstants
;
import
org.apache.wss4j.common.ext.WSPasswordCallback
;
import
com.alibaba.fastjson.JSON
;
public
class
SoConfirmQuotationTest
{
private
static
final
String
username
=
"test"
;
private
static
final
String
password
=
"78258c537d6e4d5fb210a57d05619fb6"
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
JaxWsDynamicClientFactory
factory
=
JaxWsDynamicClientFactory
.
newInstance
();
ClientImpl
client
=
(
ClientImpl
)
factory
.
createClient
(
"http://localhost:8080/sso/services/so_confirm_quotation?wsdl"
);
Map
<
String
,
Object
>
properties
=
new
HashMap
<
String
,
Object
>();
properties
.
put
(
WSHandlerConstants
.
ACTION
,
WSHandlerConstants
.
USERNAME_TOKEN
);
properties
.
put
(
WSHandlerConstants
.
USER
,
username
);
properties
.
put
(
WSHandlerConstants
.
PASSWORD_TYPE
,
WSConstants
.
PW_DIGEST
);
properties
.
put
(
WSHandlerConstants
.
PW_CALLBACK_REF
,
new
CallbackHandler
()
{
public
void
handle
(
Callback
[]
callbacks
)
{
for
(
int
i
=
0
;
i
<
callbacks
.
length
;
i
++)
{
WSPasswordCallback
pc
=
(
WSPasswordCallback
)
callbacks
[
i
];
pc
.
setPassword
(
password
);
}
}
});
WSS4JOutInterceptor
interceptor
=
new
WSS4JOutInterceptor
();
interceptor
.
setProperties
(
properties
);
client
.
setOutInterceptors
(
Arrays
.
asList
(
interceptor
));
String
xml
=
readText
(
"D:/data/sso/008.XML"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
client
.
invoke
(
"execute"
,
xml
)));
}
private
static
String
readText
(
String
path
)
throws
IOException
{
BufferedReader
br
=
null
;
try
{
br
=
new
BufferedReader
(
new
InputStreamReader
(
new
FileInputStream
(
path
)));
String
line
=
null
;
StringBuffer
sb
=
new
StringBuffer
();
while
((
line
=
br
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
return
sb
.
toString
();
}
finally
{
br
.
close
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment