Search in sources :

Example 6 with Capture

use of co.videofirst.vft.capture.model.capture.Capture in project vft-capture by videofirst.

the class DefaultUploadService method run.

// Methods from `Runnable`
@Override
public void run() {
    // capture's off the queue.
    while (true) {
        try {
            // Take off queue and update that upload
            Capture capture = queue.take();
            uploadToServer(capture);
        } catch (InterruptedException e) {
            log.warn("Interruption error", e);
        }
    }
}
Also used : Capture(co.videofirst.vft.capture.model.capture.Capture)

Example 7 with Capture

use of co.videofirst.vft.capture.model.capture.Capture in project vft-capture by videofirst.

the class FileSystemCaptureDaoTest method shouldSaveVideo.

@Test
public void shouldSaveVideo() throws IOException, JSONException {
    Capture capture = Capture.builder().started(ts1).finished(ts2).categories(ImmutableMap.of("organisation", "Google", "product", "Google Search", "module", "Web App")).feature("Login").scenario("Search by Country").folder("google-search/login/search-by-country/2018-01-30_17-33-47_a9kea").id("2018-01-30_17-33-47_a9kea").format("avi").capture(DisplayCapture.builder().x(1).y(2).width(3).height(4).build()).environment(ImmutableMap.of("os.arch", "amd64", "os.name", "Windows 10")).meta(ImmutableMap.of("version", "1.2.3-beta")).description("Awesome test").testStatus(TestPassStatus.error).testError("Awesome error").testLogs(asList(TestLog.builder().cat("browser").tier(L1).ts(ts3).log("awesome log 1").build(), TestLog.builder().cat("server").tier(L2).ts(ts4).log("awesome log 2").build())).build();
    target.save(capture);
    // Assert that capture meta-data was saved
    assertFolderExists(VftTesting.VFT_VIDEO_FOLDER, "google-search", "login", "search-by-country", "2018-01-30_17-33-47_a9kea");
    File file = new File(VftTesting.VFT_VIDEO_FOLDER, "google-search/login/search-by-country/2018-01-30_17-33-47_a9kea/2018-01-30_17-33-47_a9kea.json");
    assertThat(file).exists();
    String json = new String(Files.readAllBytes(file.toPath()));
    String expectedJson = "{\n" + "    'started': '2015-01-02T12:13:14',\n" + "    'finished': '2016-02-03T16:17:18',\n" + "    'categories': {\n" + "        'organisation': 'Google',\n" + "        'product': 'Google Search',\n" + "        'module': 'Web App'\n" + "    },\n" + "    'feature': 'Login',\n" + "    'scenario': 'Search by Country',\n" + "    'folder': 'google-search/login/search-by-country/2018-01-30_17-33-47_a9kea',\n" + "    'id': '2018-01-30_17-33-47_a9kea',\n" + "    'format': 'avi',\n" + "    'capture': { 'x': 1, 'y': 2, 'width': 3, 'height': 4 }, \n" + // optional
    "    'meta': { 'version': '1.2.3-beta' },\n" + "    'description': 'Awesome test',\n" + "    'environment': {\n" + "        'os.arch': 'amd64',\n" + "        'os.name': 'Windows 10'\n" + "    },\n" + "    'testStatus': 'error',\n" + "    'testError': 'Awesome error',\n" + "    'testLogs': [{\n" + "        'ts': '2017-03-04T19:20:21',\n" + "        'cat': 'browser',\n" + "        'tier': 'L1',\n" + "        'log': 'awesome log 1'\n" + "    }, {\n" + "        'ts': '2018-04-05T20:21:22',\n" + "        'cat': 'server',\n" + "        'tier': 'L2',\n" + "        'log': 'awesome log 2'\n" + "    }]\n" + "}";
    JSONAssert.assertEquals(expectedJson, json, true);
}
Also used : File(java.io.File) DisplayCapture(co.videofirst.vft.capture.model.display.DisplayCapture) Capture(co.videofirst.vft.capture.model.capture.Capture) Test(org.junit.Test)

Example 8 with Capture

use of co.videofirst.vft.capture.model.capture.Capture in project vft-capture by videofirst.

the class FileSystemCaptureDaoTest method shouldFindById.

@Test
public void shouldFindById() {
    String id = "2018-02-15_12-14-02_n3jwzb";
    Capture capture = target.findById(id);
    assertThat(capture.getId()).isEqualTo(id);
    assertThat(capture.getCategories()).containsExactly(entry("organisation", "Acme"), entry("product", "Moon Rocket"), entry("module", "UI"));
    assertThat(capture.getFeature()).isEqualTo("Bob Feature");
    assertThat(capture.getScenario()).isEqualTo("Dave Scenario");
    assertThat(capture.getStarted()).isEqualTo(LocalDateTime.of(2018, 2, 15, 12, 14, 02));
    assertThat(capture.getFinished()).isEqualTo(LocalDateTime.of(2018, 2, 15, 12, 14, 03));
    assertThat(capture.getFolder()).isEqualTo("acme/moon-rocket/ui/bob-feature/dave-scenario/2018-02-15_12-14-02_n3jwzb");
    assertThat(capture.getFormat()).isEqualTo("avi");
    assertThat(capture.getCapture()).isEqualTo(DisplayCapture.builder().x(0).y(0).width(1920).height(1200).build());
    assertThat(capture.getMeta()).isEmpty();
    assertThat(capture.getEnvironment()).containsExactly(entry("java.awt.graphicsenv", "sun.awt.Win32GraphicsEnvironment"));
    assertThat(capture.getTestStatus()).isEqualTo(TestPassStatus.fail);
}
Also used : DisplayCapture(co.videofirst.vft.capture.model.display.DisplayCapture) Capture(co.videofirst.vft.capture.model.capture.Capture) Test(org.junit.Test)

Aggregations

Capture (co.videofirst.vft.capture.model.capture.Capture)8 VideoOpenException (co.videofirst.vft.capture.exception.VideoOpenException)2 DisplayCapture (co.videofirst.vft.capture.model.display.DisplayCapture)2 File (java.io.File)2 Test (org.junit.Test)2 InvalidStateException (co.videofirst.vft.capture.exception.InvalidStateException)1 VideoUploadException (co.videofirst.vft.capture.exception.VideoUploadException)1 Upload (co.videofirst.vft.capture.model.capture.Upload)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 LocalDateTime (java.time.LocalDateTime)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1