-
Notifications
You must be signed in to change notification settings - Fork 18
Add getCachedBulletRecordProvider to BulletConfig #95
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
Conversation
| public void merge(Config other) { | ||
| super.merge(other); | ||
| validate(); | ||
| provider = BulletRecordProvider.from(getAs(RECORD_PROVIDER_CLASS_NAME, String.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.
Good catch but it won't fix it if you do config.set(RECORD_PROVIDER_CLASS_NAME, somethingElse) and do getBulletRecordProvider().
I think the best way to fix it would be to make the getBulletRecordProvider do the check (provider == null || !provider.getClass.getName().equals(get(RECORD_PROVIDER_CLASS_NAME)) and init if so?
| BulletRecordProvider providerB = config.getCachedBulletRecordProvider(); | ||
|
|
||
| // Uses the same provider | ||
| Assert.assertEquals(providerA, providerB); |
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.
Do assertSame to be explicit
| // Default record provider is TypedAvroBulletRecordProvider | ||
| Assert.assertTrue(config.getBulletRecordProvider() instanceof TypedAvroBulletRecordProvider); | ||
|
|
||
| config.set(BulletConfig.RECORD_PROVIDER_CLASS_NAME, "com.yahoo.bullet.record.simple.TypedSimpleBulletRecordProvider"); |
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.
Import and use TypedSimpleBulletRecordProvider.getClass().getName()?
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.