Search in sources :

Example 1 with Version

use of com.google.appengine.api.log.LogQuery.Version in project appengine-java-standard by GoogleCloudPlatform.

the class LogServiceImplTest method testWithModuleVersions.

@Test
public void testWithModuleVersions() throws Exception {
    List<Version> versions = ImmutableList.of(new Version("default", "1"), new Version("module2", "1"));
    LogQuery query = LogQuery.Builder.withVersions(versions);
    getAllLogsForAppVersions(query, versions);
}
Also used : Version(com.google.appengine.api.log.LogQuery.Version) LogModuleVersion(com.google.apphosting.api.logservice.LogServicePb.LogModuleVersion) Test(org.junit.Test)

Example 2 with Version

use of com.google.appengine.api.log.LogQuery.Version in project appengine-java-standard by GoogleCloudPlatform.

the class LogServiceImplTest method testGetAllLogsForTwoAppVersions.

@Test
public void testGetAllLogsForTwoAppVersions() throws Exception {
    List<Version> versions = ImmutableList.of(new Version("default", "1"), new Version("default", "2"));
    LogQuery query = LogQuery.Builder.withMajorVersionIds(Lists.newArrayList("1", "2"));
    getAllLogsForAppVersions(query, versions);
}
Also used : Version(com.google.appengine.api.log.LogQuery.Version) LogModuleVersion(com.google.apphosting.api.logservice.LogServicePb.LogModuleVersion) Test(org.junit.Test)

Example 3 with Version

use of com.google.appengine.api.log.LogQuery.Version in project appengine-java-standard by GoogleCloudPlatform.

the class LogServiceImplTest method createLogReadRequest.

public LogReadRequest createLogReadRequest(Long startTime, Long endTime, Integer batchSize, List<Version> versions, List<String> requestIds) {
    LogReadRequest.Builder request = LogReadRequest.newBuilder().setAppId(APPLICATION_ID);
    if (startTime != null) {
        request.setStartTime(startTime);
    }
    if (endTime != null) {
        request.setEndTime(endTime);
    }
    if (batchSize != null) {
        batchSize = 20;
    }
    if (versions != null) {
        for (Version version : versions) {
            LogModuleVersion.Builder requestModuleVersion = request.addModuleVersionBuilder();
            if (!version.getModuleId().equals("default")) {
                requestModuleVersion.setModuleId(version.getModuleId());
            }
            requestModuleVersion.setVersionId(version.getVersionId());
        }
    } else {
        request.addModuleVersionBuilder().setVersionId(LogServiceImplTest.MAJOR_VERSION_ID);
    }
    if (requestIds != null) {
        for (String requestId : requestIds) {
            request.addRequestId(ByteString.copyFromUtf8(requestId));
        }
    }
    if (batchSize == null) {
        batchSize = LogService.DEFAULT_ITEMS_PER_FETCH;
    }
    return request.setCount(batchSize).setIncludeIncomplete(false).setIncludeAppLogs(false).build();
}
Also used : LogReadRequest(com.google.apphosting.api.logservice.LogServicePb.LogReadRequest) Version(com.google.appengine.api.log.LogQuery.Version) LogModuleVersion(com.google.apphosting.api.logservice.LogServicePb.LogModuleVersion) ByteString(com.google.protobuf.ByteString) LogModuleVersion(com.google.apphosting.api.logservice.LogServicePb.LogModuleVersion)

Aggregations

Version (com.google.appengine.api.log.LogQuery.Version)3 LogModuleVersion (com.google.apphosting.api.logservice.LogServicePb.LogModuleVersion)3 Test (org.junit.Test)2 LogReadRequest (com.google.apphosting.api.logservice.LogServicePb.LogReadRequest)1 ByteString (com.google.protobuf.ByteString)1