/*
 * Copyright 2011 Splunk, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"): you may
 * not use this file except in compliance with the License. You may obtain
 * a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package com.splunk;

import org.junit.Test;

public class UploadTest extends SDKTestCase {
    @Test
    public void testOneshot() throws InterruptedException {
        // Slow down for CI to wait for splunkd.log to exist
        Thread.sleep(8000);

        String filename = locateSystemLog();
        if (System.getenv("SPLUNK_HOME") != null) {
            filename = System.getenv("SPLUNK_HOME") + "/var/log/splunk/splunkd.log";
        }

        service.getUploads().create(filename);
        
        for (Upload oneshot : service.getUploads().values()) {
            oneshot.getBytesIndexed();
            oneshot.getOffset();
            oneshot.getSize();
            oneshot.getSize();
            oneshot.getSourcesIndexed();
            oneshot.getSpoolTime();
        }
    }
}

@@ -635,16 +635,116 @@
 .Test;%0A%0A
+import java.io.File;%0Aimport java.io.FileWriter;%0Aimport java.io.IOException;%0Aimport java.util.Date;%0A%0A
 public c
@@ -833,18 +833,9 @@
 ws I
-nterrupted
+O
 Exce
@@ -854,86 +854,307 @@
     
-// Slow down for CI to wait for splunkd.log to exist%0A        Thread.sleep(8000
+String filename = locateSystemLog();%0A        if (System.getenv(%22TRAVIS_CI%22) != null) %7B%0A            File tempfile = File.createTempFile((new Date()).toString(), %22%22);%0A            tempfile.deleteOnExit();%0A%0A            FileWriter f = new FileWriter(tempfile, true);%0A            f.append(%22some data here%22
 );%0A%0A
@@ -1153,38 +1153,35 @@
 ere%22);%0A%0A        
-String
+   
  filename = loca
@@ -1172,39 +1172,48 @@
  filename = 
-locateSystemLog
+tempfile.getAbsolutePath
 ();%0A        
@@ -1203,32 +1203,47 @@
 ePath();%0A       
+ 
+%7D%0A        else
  if (System.gete
@@ -1366,17 +1366,16 @@
       %7D%0A
-%0A
         

fix uploadtest