When i had the simulation for view"CreateTrip"
it had thrown "Not loggedIn Exception"
So added simulation for (Login) separately.
But identity.login is not invoking authenticator.authenticate method.(defined in component.xml)
Kindly help if you have come across this type of issues.
Iam using TESTNG plugin .
@Test
public void testCreateTrip() throws Exception {
new FacesRequest("/Login.xhtml") {
@Override
protected void updateModelValues() throws Exception {
setValue("#{identity.username}", "19600000");
setValue("#{identity.password}", "xx");
}
@Override
protected void invokeApplication() {
ConfigManager cm = new ConfigManager();
cm.createUserContext("en", "US");
ScopeType.EVENT.getContext().set("hibernateSession",
hibernateSession);
assert (Boolean) invokeMethod("#{authenticator.login}");
}
}.run();
new FacesRequest("/CreateTrip.xhtml") {
@Override
protected void processValidations() throws Exception {
List<TripBean> list = new ArrayList<TripBean>();
validateValue("#{trip.travelerId}",90);
TripAction trAction = new TripAction();
setField(trAction,"hibernateSession", hibernateSession);
setField(trAction, "tripSegments", list);
trAction.addTripSegment();
assert !isValidationFailure();
}
protected void updateModelValues() throws Exception {
setValue("#{trip.travelerId}", 90);
}
@Override
protected void invokeApplication() {
assert invokeMethod("#{tripAction.saveTrip()}").equals("success");
}
}.run();
}