Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

duttarnab
Copy link
Collaborator

#360 - Create stress/load test which should cover all APIs with mocked OP
#360

We have written mocks for RegisterClient and TokenClient. and running test cases for RegisterSiteOperation and GetClientTokenOperation

Could you please verify if we are going in right direction. If yes then we can implement same for all the clients.

Copy link
Contributor

@yuriyz yuriyz left a 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) {
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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
*/

Copy link
Contributor

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() {
Copy link
Contributor

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 {
Copy link
Contributor

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.

@duttarnab
Copy link
Collaborator Author

Raised another PR #365 addressing this ticket.

@duttarnab duttarnab closed this Sep 9, 2019
@duttarnab duttarnab deleted the issue#360 branch September 22, 2019 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants