📄 standardservicetest.java
字号:
_test.displayHeaderMethod("testLogonIncorrectParameters");
try
{
_test.displayMsg(TestUtils.NEXT + "Parameters = Login incorrect");
try
{
UserContext userCT = new UserContext();
StandardService.logon("XZWbarnabe", PASSWORD_USER, userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
try
{
_test.displayMsg(TestUtils.NEXT +
"Parameters = Password incorrect");
try
{
UserContext userCT = new UserContext();
StandardService.logon(LOGIN_USER, "XZWbarnabe", userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
_test.displayFooterMethod("testLogonIncorrectParameters");
}
/**
* Tests the logon.
*
*/
public static void testLogon()
{
_test.displayHeaderMethod("testLogon");
try
{
try
{
UserContext userCT = new UserContext();
StandardService.logon(LOGIN_USER, PASSWORD_USER, userCT);
_test.displayResultSuccess(null);
}
catch (ServiceException se)
{
_test.displayResultFailure(TestUtils.NEXT + se.toString());
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
StringBuffer sb = new StringBuffer();
sb.append(
"\nLogon is the essential operation of the standardService.\n");
sb.append(
"If this operation is not executed with success, the test of the standardService can not continue.\n");
sb.append("The others tests are suspended.\n");
_test.displayMsg(sb.toString());
System.exit(0);
}
}
/**
* Tests the logon with null parameters.
*
*/
public static void testLogonLdapConfigNullParameters()
{
_test.displayHeaderMethod("testLogonLdapConfigNullParameters");
JBLdapConfig ldapConfig;
try
{
// Load ldapConfig
ldapConfig = PropertiesManager.getInstance()
.getPersistenceDescriptionMap()
.getLdapConfig();
try
{
_test.displayMsg(TestUtils.NEXT + "Parameters = Login null");
try
{
UserContext userCT = new UserContext();
StandardService.logon(null, PASSWORD_USER, ldapConfig,
userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
try
{
_test.displayMsg(TestUtils.NEXT + "Parameters = Password null");
try
{
UserContext userCT = new UserContext();
StandardService.logon(LOGIN_USER, null, ldapConfig, userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
try
{
_test.displayMsg(TestUtils.NEXT +
"Parameters = UserContext null");
try
{
StandardService.logon(LOGIN_USER, PASSWORD_USER,
ldapConfig, null);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : Problem to get the LdapConfig");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
_test.displayFooterMethod("testLogonLdapConfigNullParameters");
}
/**
* Tests the logon with empty parameters.
*
*/
public static void testLogonLdapConfigEmptyParameters()
{
_test.displayHeaderMethod("testLogonLdapConfigEmptyParameters");
JBLdapConfig ldapConfig;
try
{
// Load ldapConfig
ldapConfig = PropertiesManager.getInstance()
.getPersistenceDescriptionMap()
.getLdapConfig();
try
{
_test.displayMsg(TestUtils.NEXT +
"Parameters = Login empty String");
try
{
UserContext userCT = new UserContext();
StandardService.logon("", PASSWORD_USER, ldapConfig, userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
try
{
_test.displayMsg(TestUtils.NEXT +
"Parameters = Password empty String");
try
{
UserContext userCT = new UserContext();
StandardService.logon(LOGIN_USER, "", ldapConfig, userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : Problem to get the LdapConfig");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
_test.displayFooterMethod("testLogonLdapConfigEmptyParameters");
}
/**
* Tests the logon with incorrect parameters.
*
*/
public static void testLogonLdapConfigIncorrectParameters()
{
_test.displayHeaderMethod("testLogonLdapConfigIncorrectParameters");
JBLdapConfig ldapConfig;
try
{
// Load ldapConfig
ldapConfig = PropertiesManager.getInstance()
.getPersistenceDescriptionMap()
.getLdapConfig();
String refAppliDN = ldapConfig.getAppliDN();
String refBaseDN = ldapConfig.getBaseDN();
try
{
_test.displayMsg(TestUtils.NEXT +
"Parameters = Login incorrect");
try
{
UserContext userCT = new UserContext();
StandardService.logon("XZWbarnabe", PASSWORD_USER,
ldapConfig, userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
try
{
_test.displayMsg(TestUtils.NEXT +
"Parameters = Password incorrect");
try
{
UserContext userCT = new UserContext();
StandardService.logon(LOGIN_USER, "XZWbarnabe", ldapConfig,
userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
try
{
_test.displayMsg(TestUtils.NEXT +
"Parameters = LdapConfig incorrect");
try
{
UserContext userCT = new UserContext();
ldapConfig.setAppliDN("cn=bonjovi,dc=yourcompany,dc=com");
ldapConfig.setBaseDN("dc=yourcompany,dc=com");
StandardService.logon(LOGIN_USER, PASSWORD_USER,
ldapConfig, userCT);
_test.displayResultFailure(null);
}
catch (ServiceException se)
{
_test.displayResultSuccess(null);
}
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : ");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
_test.displayResultError(msg.toString());
}
ldapConfig.setAppliDN(refAppliDN);
ldapConfig.setBaseDN(refBaseDN);
}
catch (Exception ex)
{
StringBuffer msg = new StringBuffer();
msg.append("Exception : Problem to get the LdapConfig");
msg.append(TestUtils.NEXT);
msg.append(ex.toString());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -