Skip to content

Conversation

ShriramKumar
Copy link
Contributor

No description provided.

@yahoocla
Copy link

Thank you for submitting this pull request, however I do not see a valid CLA on file for you. Before we can merge this request please visit https://yahoocla.herokuapp.com/ and agree to the terms. Thanks! 😄

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 98.792% when pulling c006877 on ShriramKumar:Pub/Sub into e791357 on yahoo:master.

@akshaisarma akshaisarma added this to the 0.2.0 milestone Aug 14, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 98.943% when pulling 8d7d9c5 on ShriramKumar:Pub/Sub into e791357 on yahoo:master.

akshaisarma
akshaisarma previously approved these changes Aug 14, 2017
pom.xml Outdated
<groupId>com.yahoo.bullet</groupId>
<artifactId>bullet-core</artifactId>
<version>0.1.3-SNAPSHOT</version>
<version>0.2.0</version>
Copy link
Member

Choose a reason for hiding this comment

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

It should be 0.2.0-SNAPSHOT. The release process strips it off when releasing.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 98.943% when pulling 11ab6fe on ShriramKumar:Pub/Sub into e791357 on yahoo:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 98.943% when pulling 2daacd6 on ShriramKumar:Pub/Sub into e791357 on yahoo:master.

akshaisarma
akshaisarma previously approved these changes Aug 14, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 98.878% when pulling 60e404c on ShriramKumar:Pub/Sub into e791357 on yahoo:master.

@@ -0,0 +1,55 @@
package com.yahoo.bullet.pubsub;

public abstract class Subscriber {
Copy link
Member

Choose a reason for hiding this comment

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

Use interface and default methods

private String id;
private String content;
private Metadata metadata;
private long sequenceNumber;
Copy link
Member

Choose a reason for hiding this comment

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

Use int, call it just sequence (it's clear it's a number) and can you move this to right after id?

* @param sequenceNumber is the sequence number associated with the message.
* @param metadata is the {@link Metadata} associated with the message.
*/
public PubSubMessage(String id, String content, long sequenceNumber, Metadata metadata) {
Copy link
Member

Choose a reason for hiding this comment

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

All constructors should just call this one with the right arguments

/**
* Constructor for a message having only content.
*
* @param id is the query ID associated with the message.
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't mention that this is the queryID everywhere. I think we should just a class javadoc that mentions how PubSubMessage can be used with id being a query id and sequence being multi-part atomic messages per query.

String messageContent = getRandomString();
String metadataContent = getRandomString();
Signal signal = Signal.ACKNOWLEDGE;
//Test creation with a sequence number.
Copy link
Member

Choose a reason for hiding this comment

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

Break it up into another test?

Assert.assertNotNull(message.getMetadata());
Assert.assertEquals(message.getMetadata().getSignal(), signal);
Assert.assertTrue(message.getMetadata().getContent().toString().equals(metadataContent));
//Test creation without a sequence number.
Copy link
Member

Choose a reason for hiding this comment

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

Another test

@Test
public void testCommitWithNoSequenceNumber() {
String randomID = UUID.randomUUID().toString();
Subscriber subscriber = Mockito.mock(Subscriber.class, Mockito.CALLS_REAL_METHODS);
Copy link
Member

Choose a reason for hiding this comment

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

If you test it, you don't have to mock it. Just create a minimal test implementation (can be in this file) and just call the default method if you need it.

@ShriramKumar
Copy link
Contributor Author

Ready for re-review.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 98.947% when pulling 76af69a on ShriramKumar:Pub/Sub into e791357 on yahoo:master.

@akshaisarma akshaisarma merged commit 2912443 into bullet-db:master Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants