Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fixed javadoc code + add test for aerogear.ios.batchSize
Browse files Browse the repository at this point in the history
  • Loading branch information
lfryc committed Mar 17, 2016
1 parent c8dd6d6 commit 7c2f2c2
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public class MetricsCollector {
* Additionally when a variant was completed and there are no more variants to be completed for this variant,
* the {@link PushMessageCompletedEvent} CDI event is fired.
*
* @param variantMetricInformation the variant metrics info object
* @param event {@link TriggerMetricCollection} event dequeued from JMS
* @throws JMSException when JMS provider fails to dequeue messages that {@link MetricsCollector} pulls
*/
public void collectMetrics(@Observes @Dequeue TriggerMetricCollection event) throws JMSException {
final String pushMessageInformationId = event.getPushMessageInformationId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Event that triggers {@link MetricsCollector} processing.
*
* @see {@link org.jboss.aerogear.unifiedpush.message.jms.TriggerMetricCollectionConsumer}
* @see org.jboss.aerogear.unifiedpush.message.jms.TriggerMetricCollectionConsumer
*/
public class TriggerMetricCollection implements Serializable {

Expand Down Expand Up @@ -55,7 +55,7 @@ public void markAllVariantsProcessed() {
}

/**
* Returns true if all batches are known to be loaded
* @return true if all batches are known to be loaded; false otherwise
*/
public boolean areAllVariantsProcessed() {
return allVariantsProcessed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Event that triggers {@link MetricsCollector} processing.
*
* @see {@link org.jboss.aerogear.unifiedpush.message.jms.TriggerMetricCollectionConsumer}
* @see org.jboss.aerogear.unifiedpush.message.jms.TriggerVariantMetricCollectionConsumer
*/
public class TriggerVariantMetricCollection implements Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public class JmsClient {
/**
* Creates {@link JmsSender} utility that allows to specify how should be message sent and into which destination
*
* @param message msg to be send out
* @return the sender
* @param message the message to be send out
* @return the new sender object
*/
public JmsSender send(Serializable message) {
return new JmsSender(message);
Expand All @@ -59,7 +59,7 @@ public JmsSender send(Serializable message) {
/**
* Creates {@link JmsReceiver} utility that allows to specify how should be message received and from which destination
*
* @return the sender
* @return the new receiver object
*/
public JmsReceiver receive() {
return new JmsReceiver();
Expand All @@ -84,7 +84,7 @@ public JmsReceiver() {
/**
* Receives the message in transaction (i.e. use JmsXA connection factory).
*
* @return the receiver
* @return this receiver object
*/
public JmsReceiver inTransaction() {
this.transacted = true;
Expand All @@ -97,7 +97,7 @@ public JmsReceiver inTransaction() {
*
* @param selector specifies to query messages from a destination.
* @param args argument for the selector
* @return the receiver
* @return this receiver object
*
* @see String#format(String, Object...)
*/
Expand All @@ -109,7 +109,7 @@ public JmsReceiver withSelector(String selector, Object... args) {
/**
* Don't block and returns the message what is in the queue, if there is none queued, then returns null immediately.
*
* @return the receiver
* @return this receiver object
*/
public JmsReceiver noWait() {
this.wait = new NoWait();
Expand All @@ -120,7 +120,7 @@ public JmsReceiver noWait() {
* Waits specific number of milliseconds for a message to eventually appear in the queue, or returns null if there was no message queued in given interval.
*
* @param timeout wait until
* @return the receiver
* @return this receiver object
*/
public JmsReceiver withTimeout(long timeout) {
this.wait = new WaitSpecificTime(timeout);
Expand All @@ -130,8 +130,8 @@ public JmsReceiver withTimeout(long timeout) {
/**
* Sets the message acknowledgement mode.
*
* @param acknowledgeMode
* @return
* @param acknowledgeMode JMS acknowledge mode as in {@link Session}
* @return this receiver object
*/
public JmsReceiver withAcknowledgeMode(int acknowledgeMode) {
this.acknowledgeMode = acknowledgeMode;
Expand All @@ -141,7 +141,7 @@ public JmsReceiver withAcknowledgeMode(int acknowledgeMode) {
/**
* Won't close the connection automatically upon completion, allowing to reuse given connection.
*
* @return the receiver
* @return this receiver object
*/
public JmsReceiver noAutoClose() {
this.autoClose = false;
Expand All @@ -163,7 +163,7 @@ public void close() {
* Receives message from the given destination.
*
* @param destination where to receive from
* @return JMS object
* @return dequeued {@link ObjectMessage}
*/
public ObjectMessage from(Destination destination) {
try {
Expand Down Expand Up @@ -222,7 +222,7 @@ public JmsSender(Serializable message) {
/**
* Send the message in transaction (i.e. use JmsXA connection factory).
*
* @return the sender
* @return this sender object
*/
public JmsSender inTransaction() {
this.transacted = true;
Expand All @@ -233,8 +233,8 @@ public JmsSender inTransaction() {
* Sets the property that can be later used to query message by selector.
*
* @param name of property
* @param value of propery
* @return the sender
* @param value of property
* @return this sender object
*/
public JmsSender withProperty(String name, String value) {
if (value == null) {
Expand All @@ -246,6 +246,10 @@ public JmsSender withProperty(String name, String value) {

/**
* Sets the property that can be later used to query message by selector.
*
* @param name of property
* @param value of property
* @return this sender object
*/
public JmsSender withProperty(String name, Long value) {
if (value == null) {
Expand All @@ -262,7 +266,7 @@ public JmsSender withProperty(String name, Long value) {
* no matter what payload the another message has.
*
* @param duplicateDetectionId protection of ID for duplicate msgs
* @return the sender
* @return this sender object
*/
public JmsSender withDuplicateDetectionId(String duplicateDetectionId) {
if (duplicateDetectionId == null) {
Expand All @@ -274,6 +278,9 @@ public JmsSender withDuplicateDetectionId(String duplicateDetectionId) {

/**
* The message sent with given ID will be scheduled to be delivered after specified number of miliseconds.
*
* @param delayMs the delay in milliseconds
* @return this sender object
*/
public JmsSender withDelayedDelivery(Long delayMs) {
if (delayMs == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static WebArchive archive() {
private Instance<SenderConfiguration> senderConfiguration;

@Test
public void test() {
public void testAndroid() {
try {
System.setProperty("aerogear.android.batchSize", "999");
SenderConfiguration configuration = senderConfiguration.select(new SenderTypeLiteral(VariantType.ANDROID)).get();
Expand All @@ -59,4 +59,16 @@ public void test() {
System.clearProperty("aerogear.android.batchSize");
}
}

@Test
public void testIOS() {
try {
System.setProperty("aerogear.ios.batchSize", "1");
SenderConfiguration configuration = senderConfiguration.select(new SenderTypeLiteral(VariantType.IOS)).get();
assertEquals(3, configuration.batchesToLoad());
assertEquals(1, configuration.batchSize());
} finally {
System.clearProperty("aerogear.ios.batchSize");
}
}
}

0 comments on commit 7c2f2c2

Please sign in to comment.