diff --git a/splunk/src/main/java/com/splunk/SavedSearch.java b/splunk/src/main/java/com/splunk/SavedSearch.java index 96979316..b01fe17d 100644 --- a/splunk/src/main/java/com/splunk/SavedSearch.java +++ b/splunk/src/main/java/com/splunk/SavedSearch.java @@ -68,13 +68,13 @@ public Job dispatch() throws InterruptedException { * Runs the saved search using dispatch arguments. * * @param args Dispatch arguments:
* Generally, this command is a template search pipeline that is realized * with values from the saved search. To reference saved search field - * values, wrap them in "$". For example, use "$name$" to reference the + * values, wrap them in "$". For example, use "$name$" to reference the * saved search name, or use "$search$" to reference the search query. * * @return The search command (or pipeline). @@ -630,7 +652,7 @@ public String getActionSummaryIndexName() { *
* Generally, this command is a template search pipeline that is realized * with values from the saved search. To reference saved search field - * values, wrap them in "$". For example, use "$name$" to reference the + * values, wrap them in "$". For example, use "$name$" to reference the * saved search name, or use "$search$" to reference the search query. * * @return The search command (or pipeline). @@ -906,7 +928,7 @@ public int getDispatchMaxCount() { public int getDispatchMaxTime() { return getInteger("dispatch.max_time"); } - + /** * Returns how frequently Splunk runs the MapReduce reduce phase * on accumulated map values. @@ -928,7 +950,7 @@ public int getDispatchReduceFrequency() { public boolean getDispatchRtBackfill() { return getDispatchRealTimeBackfill(); } - + /** * Indicates whether to back fill the real-time window for this search. * This attribute only applies to real-time searches. @@ -1235,7 +1257,7 @@ public void setActionEmailCc(String cc) { *
* Generally, this command is a template search pipeline that is realized * with values from the saved search. To reference saved search field - * values, wrap them in "$". For example, use "$name$" to reference the + * values, wrap them in "$". For example, use "$name$" to reference the * saved search name, or use "$search$" to reference the search query. * * @param command The search command (or pipeline). @@ -1547,7 +1569,7 @@ public void setActionPopulateLookupTtl(String ttl) { *
* Generally, this command is a template search pipeline that is realized * with values from the saved search. To reference saved search field - * values, wrap them in "$". For example, use "$name$" to reference the + * values, wrap them in "$". For example, use "$name$" to reference the * saved search name, or use "$search$" to reference the search query. * * @param command The search command (or pipeline). @@ -1614,7 +1636,7 @@ public void setActionRssTtl(String ttl) { *
* Generally, this command is a template search pipeline that is realized * with values from the saved search. To reference saved search field - * values, wrap them in "$". For example, use "$name$" to reference the + * values, wrap them in "$". For example, use "$name$" to reference the * saved search name, or use "$search$" to reference the search query. * * @param command The search command (or pipeline). @@ -1702,7 +1724,7 @@ public void setActionSummaryIndexName(String name) { *
* Generally, this command is a template search pipeline that is realized
* with values from the saved search. To reference saved search field
- * values, wrap them in "$". For example, use "$name$" to reference the
+ * values, wrap them in "$". For example, use "$name$" to reference the
* saved search name, or use "$search$" to reference the search query.
*
* @param command The search command (or pipeline).
@@ -1954,7 +1976,7 @@ public void setDisabled(boolean disabled) {
public void setDispatchBuckets(String buckets) {
setDispatchBuckets(Integer.parseInt(buckets));
}
-
+
/**
* Sets the maximum number of timeline buckets.
*
@@ -2161,7 +2183,7 @@ public void setRequestUiDispatchView(String view) {
public void setRestartOnSearchpeerAdd(boolean restart) {
setRestartOnSearchPeerAdd(restart);
}
-
+
/**
* Sets whether a real-time search managed by the scheduler is
* restarted when a search peer becomes available for this saved search.
diff --git a/splunk/src/test/java/com/splunk/SavedSearchTest.java b/splunk/src/test/java/com/splunk/SavedSearchTest.java
index fcaf672b..dc45caa1 100644
--- a/splunk/src/test/java/com/splunk/SavedSearchTest.java
+++ b/splunk/src/test/java/com/splunk/SavedSearchTest.java
@@ -21,6 +21,8 @@
import org.junit.Before;
import org.junit.Test;
+import java.util.HashMap;
+
public class SavedSearchTest extends SDKTestCase {
SavedSearchCollection savedSearches;
String savedSearchName;
@@ -429,4 +431,34 @@ public boolean predicate() {
Assert.fail(e.toString());
}
}
+
+ @Test
+ public void testHistoryWithArgs(){
+ savedSearch.refresh();
+ Assert.assertEquals(0, savedSearch.history().length);
+ try {
+ Job job;
+ for(int i = 0 ; i < 31 ; i++){
+ job = savedSearch.dispatch();
+ while(!job.isReady()){
+ sleep(2);
+ }
+ }
+ //history without any argument, it will return max 30 jobs only.
+ Assert.assertEquals(30, savedSearch.history().length);
+
+ //history with argument 'count' set to '0' i.e it returns the whole history
+ HashMap