}
private Topology createTestTopology(){
Topology topology = new Topology();
topology.setName("test-topology");
try {
topology.setUri(new URI(gatewayUrl + "/" + topology.getName()));
} catch (URISyntaxException ex) {
assertThat(topology.getUri(), not(nullValue()));
}
Provider identityProvider = new Provider();
identityProvider.setName("Default");
identityProvider.setRole("identity-assertion");
identityProvider.setEnabled(true);
Provider AuthenicationProvider = new Provider();
AuthenicationProvider.setName("ShiroProvider");
AuthenicationProvider.setRole("authentication");
AuthenicationProvider.setEnabled(true);
Param ldapMain = new Param();
ldapMain.setName("main.ldapRealm");
ldapMain.setValue("org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm");
Param ldapGroupContextFactory = new Param();
ldapGroupContextFactory.setName("main.ldapGroupContextFactory");
ldapGroupContextFactory.setValue("org.apache.hadoop.gateway.shirorealm.KnoxLdapContextFactory");
Param ldapRealmContext = new Param();
ldapRealmContext.setName("main.ldapRealm.contextFactory");
ldapRealmContext.setValue("$ldapGroupContextFactory");
Param ldapURL = new Param();
ldapURL.setName("main.ldapRealm.contextFactory.url");
ldapURL.setValue("ldap://localhost:" + ldapTransport.getPort());
Param ldapUserTemplate = new Param();
ldapUserTemplate.setName("main.ldapRealm.userDnTemplate");
ldapUserTemplate.setValue("uid={0},ou=people,dc=hadoop,dc=apache,dc=org");
Param authcBasic = new Param();
authcBasic.setName("urls./**");
authcBasic.setValue("authcBasic");
AuthenicationProvider.addParam(ldapGroupContextFactory);
AuthenicationProvider.addParam(ldapMain);
AuthenicationProvider.addParam(ldapRealmContext);
AuthenicationProvider.addParam(ldapURL);
AuthenicationProvider.addParam(ldapUserTemplate);
AuthenicationProvider.addParam(authcBasic);
Service testService = new Service();
testService.setRole("test-service-role");
topology.addProvider(AuthenicationProvider);
topology.addProvider(identityProvider);
topology.addService(testService);
topology.setTimestamp(System.nanoTime());
return topology;
}