-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#360 - Create stress/load test which should cover all APIs with mocked OP #361
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should introduce MockAppModule
and inject it in our test suite. Also lets avoid copy/pastes of code.
@@ -36,10 +37,10 @@ public Processor(ValidationService validationService) { | |||
this.validationService = validationService; | |||
} | |||
|
|||
public IOpResponse process(Command command) { | |||
public IOpResponse process(Command command, OpClientFactory opClientFactory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it, it should be taken from guice injector.
@@ -21,7 +23,12 @@ | |||
|
|||
private static final Logger LOG = LoggerFactory.getLogger(RestResource.class); | |||
|
|||
public RestResource() { | |||
|
|||
private static OpClientFactory opClientFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant.
@@ -34,5 +38,6 @@ protected void configure() { | |||
bind(DiscoveryService.class).in(Singleton.class); | |||
bind(ValidationService.class).in(Singleton.class); | |||
bind(StateService.class).in(Singleton.class); | |||
bind(OpClientFactory.class).to(OpClientFactoryImpl.class).in(Singleton.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct, now we need same but in TestGuiceModule
which bind to mock factory.
bind(OpClientFactory.class).to(MockOpClientFactory.class).in(Singleton.class);
super(command, injector, GetClientTokenParams.class); | ||
this.opClientFactory = opClientFactory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these references are redundant, add to BaseOperation
, it's responsibility of guice to construct it.
public OpClientFactory getOpClientFactory () {
return getInstance(OpClientFactory .class);
}
} | ||
|
||
@Override | ||
public IOpResponse execute(GetClientTokenParams params) { | ||
try { | ||
final AuthenticationMethod authenticationMethod = AuthenticationMethod.fromString(params.getAuthenticationMethod()); | ||
final String tokenEndpoint = getDiscoveryService().getConnectDiscoveryResponse(params.getOpHost(), params.getOpDiscoveryPath()).getTokenEndpoint(); | ||
final TokenClient tokenClient = new TokenClient(tokenEndpoint); | ||
//final TokenClient tokenClient = new TokenClient(tokenEndpoint); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant line
* @author Yuriy Zabrovarnyy | ||
* @version 0.9, 21/08/2013 | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run it with Test Guice Module
@Guice(modules = org.gluu.oxd.mock.MockAppModule.class)
} | ||
} | ||
|
||
private static void setOpClientFactory() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant file
@Parameters({"host", "opHost", "redirectUrls"}) | ||
@BeforeSuite | ||
public static void beforeSuite(String host, String opHost, String redirectUrls) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this is copy/paste from org.gluu.oxd.server.SetUpTest#beforeSuite
. Lets refactor existing code and avoid it.
Raised another PR #365 addressing this ticket. |
#360 - Create stress/load test which should cover all APIs with mocked OP
#360
We have written mocks for
RegisterClient
andTokenClient
. and running test cases forRegisterSiteOperation
andGetClientTokenOperation
Could you please verify if we are going in right direction. If yes then we can implement same for all the clients.