use of org.talend.esb.job.controller.ESBEndpointConstants.EsbSecurity in project tesb-rt-se by Talend.
the class SecurityArgumentsTest method buildBasicAuthorizationPolicy.
@Test
public void buildBasicAuthorizationPolicy() throws Exception {
EsbSecurity esbSecurity = EsbSecurity.fromString("BASIC");
String username = "username";
String password = "password";
String alias = "alias";
SecurityArguments sa = new SecurityArguments(esbSecurity, null, username, password, alias, null, null, null, null);
AuthorizationPolicy p = sa.buildAuthorizationPolicy();
assertSame(p.getPassword(), password);
assertSame(p.getUserName(), username);
assertSame(p.getAuthorizationType(), "Basic");
}
use of org.talend.esb.job.controller.ESBEndpointConstants.EsbSecurity in project tesb-rt-se by Talend.
the class SecurityArgumentsTest method constructorTest.
@Test
public void constructorTest() throws Exception {
EsbSecurity esbSecurity = EsbSecurity.fromString(null);
Policy policy = createNiceMock(Policy.class);
String username = "username";
String password = "password";
String alias = "alias";
Map<String, String> clientProperties = new HashMap<String, String>();
String roleName = "roleName";
Object securityToken = new Object();
Crypto cryptoProvider = createNiceMock(Crypto.class);
SecurityArguments sa = new SecurityArguments(esbSecurity, policy, username, password, alias, clientProperties, roleName, securityToken, cryptoProvider);
assertSame(sa.getEsbSecurity(), esbSecurity);
assertSame(sa.getPolicy(), policy);
assertSame(sa.getUsername(), username);
assertSame(sa.getPassword(), password);
assertSame(sa.getAlias(), alias);
assertSame(sa.getClientProperties(), clientProperties);
assertSame(sa.getRoleName(), roleName);
assertSame(sa.getSecurityToken(), securityToken);
assertSame(sa.getCryptoProvider(), cryptoProvider);
}
Aggregations