Skip to content

Conversation

@Sanil15
Copy link
Contributor

@Sanil15 Sanil15 commented Sep 21, 2018

No description provided.

@Sanil15 Sanil15 changed the title Samza-1818: Cleaning up TestRunner Apis to incorporate LegacyTaskApplication and StreamApplication Samza-1818: Cleaning up TestRunner Apis to incorporate LegacyTaskApplication and SamzaApplication Sep 21, 2018
/**
* Constructs a new {@link TestRunner} from following components
* @param app samza job implementing {@link StreamApplication}
* @param app samza job implementing {@link SamzaApplication}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"app a {@link SamzaApplication}"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ Bump

Preconditions.checkState(
StreamTask.class.isAssignableFrom(taskClass) || AsyncStreamTask.class.isAssignableFrom(taskClass));
return new TestRunner(taskClass);
public static TestRunner of(LegacyTaskApplication taskApp) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need a separate API for LegacyTaskApplication? It should extend SamzaApplication too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I can just expose one TestRunner#of(SamzaApplication ...), but this makes it more obvious for Legacy users to use this.

}

/**
* Creates an instance of {@link TestRunner} for High Level/Fluent Samza Api
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/for High Level .../for a {@link SamzaApplication}/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure


TestRunner
.of(MyStreamTestTask.class)
.of(new LegacyTaskApplication(MyStreamTestTask.class.getName()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, please take a look at PR #642 , most of the changes here are already incorporated in that PR. Question here: any specific reason that you want to explicitly construct a LegacyTaskApplication here, instead of retaining the same API, but internally convert the MyStreamTestTask.class to a LegacyTaskApplication instance in TestRunner?

Copy link
Contributor Author

@Sanil15 Sanil15 Sep 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have three choices for Public Api

Option 1: TestRunner.of(SamzaApplication), TestRunner.of(AsyncStreamTask), TestRunner.of(StreamTask)

Option 2: TestRunner.of(SamzaApplication), TestRunner.of(LegacyTaskApplication),

Option 3: TestRunner.of(SamzaApplication), TestRunner.of(Class taskClass)

I prefer the option 2 makes it more straighforward for end user, option 3 is very generic and vague (which I want to remove)

I am ok with either Option 1 or Option 2. I will leave it up to the reviewers to suggest

Note: when i was read Samza-1818, i thought I am responsible for the refactor, if #642 gets merged first I can rebase the changes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the specific concern on option 3? Type safety? We can add that in the TestRunner.of() method as well. If your concern is that what end user will see as a supported implementation of application, we already support the legacy case that end user only implements the task class anyways and I don't think that will add additional confusion. In fact, exposing the constructor of LegacyTaskApplication is worse, since we don't expect users construct the LegacyTaskApplication at all in the supported APIs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will revert the changes

@asfgit asfgit closed this in d88a3cd Sep 28, 2018
* @param taskClass represent a class containing Samza job logic extending either {@link StreamTask} or {@link AsyncStreamTask}
* @param taskClass containing Samza job logic extending either {@link StreamTask} or {@link AsyncStreamTask}
*/
private TestRunner(Class taskClass) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method still required?

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.

3 participants