repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
---|---|---|---|---|---|---|
nebhale/JsonPath | src/main/java/com/nebhale/jsonpath/internal/component/IndexPathComponent.java | // Path: src/main/java/com/nebhale/jsonpath/internal/util/ArrayUtils.java
// public final class ArrayUtils {
//
// private static final String DELIMITERS = ", ";
//
// private ArrayUtils() {
// }
//
// public static int[] parseAsIntArray(String value) {
// StringTokenizer tokenizer = new StringTokenizer(value, DELIMITERS);
// int[] array = new int[tokenizer.countTokens()];
// for (int i = 0; i < array.length; i++) {
// array[i] = Integer.parseInt(tokenizer.nextToken());
// }
// return array;
// }
//
// public static String[] parseAsStringArray(String value) {
// StringTokenizer tokenizer = new StringTokenizer(value, DELIMITERS);
// String[] array = new String[tokenizer.countTokens()];
// for (int i = 0; i < array.length; i++) {
// array[i] = tokenizer.nextToken();
// }
// return array;
// }
// }
| import java.util.Arrays;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.nebhale.jsonpath.internal.util.ArrayUtils; | /*
* Copyright 2013 the original author or authors.
*
* 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.nebhale.jsonpath.internal.component;
/**
* A {@link PathComponent} that handles numeric indexed children
* <p />
*
* <strong>Concurrent Semantics</strong><br />
*
* Thread-safe
*/
public final class IndexPathComponent extends AbstractChainedPathComponent {
private final int[] indexes;
public IndexPathComponent(PathComponent delegate, String indexes) {
super(delegate); | // Path: src/main/java/com/nebhale/jsonpath/internal/util/ArrayUtils.java
// public final class ArrayUtils {
//
// private static final String DELIMITERS = ", ";
//
// private ArrayUtils() {
// }
//
// public static int[] parseAsIntArray(String value) {
// StringTokenizer tokenizer = new StringTokenizer(value, DELIMITERS);
// int[] array = new int[tokenizer.countTokens()];
// for (int i = 0; i < array.length; i++) {
// array[i] = Integer.parseInt(tokenizer.nextToken());
// }
// return array;
// }
//
// public static String[] parseAsStringArray(String value) {
// StringTokenizer tokenizer = new StringTokenizer(value, DELIMITERS);
// String[] array = new String[tokenizer.countTokens()];
// for (int i = 0; i < array.length; i++) {
// array[i] = tokenizer.nextToken();
// }
// return array;
// }
// }
// Path: src/main/java/com/nebhale/jsonpath/internal/component/IndexPathComponent.java
import java.util.Arrays;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
import com.nebhale.jsonpath.internal.util.ArrayUtils;
/*
* Copyright 2013 the original author or authors.
*
* 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.nebhale.jsonpath.internal.component;
/**
* A {@link PathComponent} that handles numeric indexed children
* <p />
*
* <strong>Concurrent Semantics</strong><br />
*
* Thread-safe
*/
public final class IndexPathComponent extends AbstractChainedPathComponent {
private final int[] indexes;
public IndexPathComponent(PathComponent delegate, String indexes) {
super(delegate); | this.indexes = ArrayUtils.parseAsIntArray(indexes); |
nebhale/JsonPath | src/test/java/com/nebhale/jsonpath/internal/component/AbstractChainedPathComponentTest.java | // Path: src/test/java/com/nebhale/jsonpath/testutils/JsonUtils.java
// public static final JsonNode NODE;
| import static com.nebhale.jsonpath.testutils.JsonUtils.NODE;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import org.junit.Test;
import com.fasterxml.jackson.databind.JsonNode; | /*
* Copyright 2013 the original author or authors.
*
* 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.nebhale.jsonpath.internal.component;
public final class AbstractChainedPathComponentTest {
private final PathComponent delegate = mock(PathComponent.class);
@Test
public void getWithDelegate() {
StubChainedPathComponent chainedPathComponent = new StubChainedPathComponent(this.delegate); | // Path: src/test/java/com/nebhale/jsonpath/testutils/JsonUtils.java
// public static final JsonNode NODE;
// Path: src/test/java/com/nebhale/jsonpath/internal/component/AbstractChainedPathComponentTest.java
import static com.nebhale.jsonpath.testutils.JsonUtils.NODE;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import org.junit.Test;
import com.fasterxml.jackson.databind.JsonNode;
/*
* Copyright 2013 the original author or authors.
*
* 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.nebhale.jsonpath.internal.component;
public final class AbstractChainedPathComponentTest {
private final PathComponent delegate = mock(PathComponent.class);
@Test
public void getWithDelegate() {
StubChainedPathComponent chainedPathComponent = new StubChainedPathComponent(this.delegate); | chainedPathComponent.get(NODE); |
googleapis/java-errorreporting | google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientTest.java | // Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListEventsPagedResponse
// extends AbstractPagedListResponse<
// ListEventsRequest,
// ListEventsResponse,
// ErrorEvent,
// ListEventsPage,
// ListEventsFixedSizeCollection> {
//
// public static ApiFuture<ListEventsPagedResponse> createAsync(
// PageContext<ListEventsRequest, ListEventsResponse, ErrorEvent> context,
// ApiFuture<ListEventsResponse> futureResponse) {
// ApiFuture<ListEventsPage> futurePage =
// ListEventsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage, input -> new ListEventsPagedResponse(input), MoreExecutors.directExecutor());
// }
//
// private ListEventsPagedResponse(ListEventsPage page) {
// super(page, ListEventsFixedSizeCollection.createEmptyCollection());
// }
// }
//
// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListGroupStatsPagedResponse
// extends AbstractPagedListResponse<
// ListGroupStatsRequest,
// ListGroupStatsResponse,
// ErrorGroupStats,
// ListGroupStatsPage,
// ListGroupStatsFixedSizeCollection> {
//
// public static ApiFuture<ListGroupStatsPagedResponse> createAsync(
// PageContext<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats> context,
// ApiFuture<ListGroupStatsResponse> futureResponse) {
// ApiFuture<ListGroupStatsPage> futurePage =
// ListGroupStatsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage,
// input -> new ListGroupStatsPagedResponse(input),
// MoreExecutors.directExecutor());
// }
//
// private ListGroupStatsPagedResponse(ListGroupStatsPage page) {
// super(page, ListGroupStatsFixedSizeCollection.createEmptyCollection());
// }
// }
| import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; | @Before
public void setUp() throws IOException {
mockServiceHelper.reset();
channelProvider = mockServiceHelper.createChannelProvider();
ErrorStatsServiceSettings settings =
ErrorStatsServiceSettings.newBuilder()
.setTransportChannelProvider(channelProvider)
.setCredentialsProvider(NoCredentialsProvider.create())
.build();
client = ErrorStatsServiceClient.create(settings);
}
@After
public void tearDown() throws Exception {
client.close();
}
@Test
public void listGroupStatsTest() throws Exception {
ErrorGroupStats responsesElement = ErrorGroupStats.newBuilder().build();
ListGroupStatsResponse expectedResponse =
ListGroupStatsResponse.newBuilder()
.setNextPageToken("")
.addAllErrorGroupStats(Arrays.asList(responsesElement))
.build();
mockErrorStatsService.addResponse(expectedResponse);
ProjectName projectName = ProjectName.of("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
| // Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListEventsPagedResponse
// extends AbstractPagedListResponse<
// ListEventsRequest,
// ListEventsResponse,
// ErrorEvent,
// ListEventsPage,
// ListEventsFixedSizeCollection> {
//
// public static ApiFuture<ListEventsPagedResponse> createAsync(
// PageContext<ListEventsRequest, ListEventsResponse, ErrorEvent> context,
// ApiFuture<ListEventsResponse> futureResponse) {
// ApiFuture<ListEventsPage> futurePage =
// ListEventsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage, input -> new ListEventsPagedResponse(input), MoreExecutors.directExecutor());
// }
//
// private ListEventsPagedResponse(ListEventsPage page) {
// super(page, ListEventsFixedSizeCollection.createEmptyCollection());
// }
// }
//
// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListGroupStatsPagedResponse
// extends AbstractPagedListResponse<
// ListGroupStatsRequest,
// ListGroupStatsResponse,
// ErrorGroupStats,
// ListGroupStatsPage,
// ListGroupStatsFixedSizeCollection> {
//
// public static ApiFuture<ListGroupStatsPagedResponse> createAsync(
// PageContext<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats> context,
// ApiFuture<ListGroupStatsResponse> futureResponse) {
// ApiFuture<ListGroupStatsPage> futurePage =
// ListGroupStatsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage,
// input -> new ListGroupStatsPagedResponse(input),
// MoreExecutors.directExecutor());
// }
//
// private ListGroupStatsPagedResponse(ListGroupStatsPage page) {
// super(page, ListGroupStatsFixedSizeCollection.createEmptyCollection());
// }
// }
// Path: google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientTest.java
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@Before
public void setUp() throws IOException {
mockServiceHelper.reset();
channelProvider = mockServiceHelper.createChannelProvider();
ErrorStatsServiceSettings settings =
ErrorStatsServiceSettings.newBuilder()
.setTransportChannelProvider(channelProvider)
.setCredentialsProvider(NoCredentialsProvider.create())
.build();
client = ErrorStatsServiceClient.create(settings);
}
@After
public void tearDown() throws Exception {
client.close();
}
@Test
public void listGroupStatsTest() throws Exception {
ErrorGroupStats responsesElement = ErrorGroupStats.newBuilder().build();
ListGroupStatsResponse expectedResponse =
ListGroupStatsResponse.newBuilder()
.setNextPageToken("")
.addAllErrorGroupStats(Arrays.asList(responsesElement))
.build();
mockErrorStatsService.addResponse(expectedResponse);
ProjectName projectName = ProjectName.of("[PROJECT]");
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
| ListGroupStatsPagedResponse pagedListResponse = client.listGroupStats(projectName, timeRange); |
googleapis/java-errorreporting | google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientTest.java | // Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListEventsPagedResponse
// extends AbstractPagedListResponse<
// ListEventsRequest,
// ListEventsResponse,
// ErrorEvent,
// ListEventsPage,
// ListEventsFixedSizeCollection> {
//
// public static ApiFuture<ListEventsPagedResponse> createAsync(
// PageContext<ListEventsRequest, ListEventsResponse, ErrorEvent> context,
// ApiFuture<ListEventsResponse> futureResponse) {
// ApiFuture<ListEventsPage> futurePage =
// ListEventsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage, input -> new ListEventsPagedResponse(input), MoreExecutors.directExecutor());
// }
//
// private ListEventsPagedResponse(ListEventsPage page) {
// super(page, ListEventsFixedSizeCollection.createEmptyCollection());
// }
// }
//
// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListGroupStatsPagedResponse
// extends AbstractPagedListResponse<
// ListGroupStatsRequest,
// ListGroupStatsResponse,
// ErrorGroupStats,
// ListGroupStatsPage,
// ListGroupStatsFixedSizeCollection> {
//
// public static ApiFuture<ListGroupStatsPagedResponse> createAsync(
// PageContext<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats> context,
// ApiFuture<ListGroupStatsResponse> futureResponse) {
// ApiFuture<ListGroupStatsPage> futurePage =
// ListGroupStatsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage,
// input -> new ListGroupStatsPagedResponse(input),
// MoreExecutors.directExecutor());
// }
//
// private ListGroupStatsPagedResponse(ListGroupStatsPage page) {
// super(page, ListGroupStatsFixedSizeCollection.createEmptyCollection());
// }
// }
| import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test; | }
@Test
public void listGroupStatsExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockErrorStatsService.addException(exception);
try {
String projectName = "projectName-940047036";
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
client.listGroupStats(projectName, timeRange);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void listEventsTest() throws Exception {
ErrorEvent responsesElement = ErrorEvent.newBuilder().build();
ListEventsResponse expectedResponse =
ListEventsResponse.newBuilder()
.setNextPageToken("")
.addAllErrorEvents(Arrays.asList(responsesElement))
.build();
mockErrorStatsService.addResponse(expectedResponse);
ProjectName projectName = ProjectName.of("[PROJECT]");
String groupId = "groupId293428218";
| // Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListEventsPagedResponse
// extends AbstractPagedListResponse<
// ListEventsRequest,
// ListEventsResponse,
// ErrorEvent,
// ListEventsPage,
// ListEventsFixedSizeCollection> {
//
// public static ApiFuture<ListEventsPagedResponse> createAsync(
// PageContext<ListEventsRequest, ListEventsResponse, ErrorEvent> context,
// ApiFuture<ListEventsResponse> futureResponse) {
// ApiFuture<ListEventsPage> futurePage =
// ListEventsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage, input -> new ListEventsPagedResponse(input), MoreExecutors.directExecutor());
// }
//
// private ListEventsPagedResponse(ListEventsPage page) {
// super(page, ListEventsFixedSizeCollection.createEmptyCollection());
// }
// }
//
// Path: google-cloud-errorreporting/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClient.java
// public static class ListGroupStatsPagedResponse
// extends AbstractPagedListResponse<
// ListGroupStatsRequest,
// ListGroupStatsResponse,
// ErrorGroupStats,
// ListGroupStatsPage,
// ListGroupStatsFixedSizeCollection> {
//
// public static ApiFuture<ListGroupStatsPagedResponse> createAsync(
// PageContext<ListGroupStatsRequest, ListGroupStatsResponse, ErrorGroupStats> context,
// ApiFuture<ListGroupStatsResponse> futureResponse) {
// ApiFuture<ListGroupStatsPage> futurePage =
// ListGroupStatsPage.createEmptyPage().createPageAsync(context, futureResponse);
// return ApiFutures.transform(
// futurePage,
// input -> new ListGroupStatsPagedResponse(input),
// MoreExecutors.directExecutor());
// }
//
// private ListGroupStatsPagedResponse(ListGroupStatsPage page) {
// super(page, ListGroupStatsFixedSizeCollection.createEmptyCollection());
// }
// }
// Path: google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceClientTest.java
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListEventsPagedResponse;
import static com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClient.ListGroupStatsPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.testing.LocalChannelProvider;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.api.gax.grpc.testing.MockServiceHelper;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.InvalidArgumentException;
import com.google.common.collect.Lists;
import com.google.protobuf.AbstractMessage;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import javax.annotation.Generated;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
}
@Test
public void listGroupStatsExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockErrorStatsService.addException(exception);
try {
String projectName = "projectName-940047036";
QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
client.listGroupStats(projectName, timeRange);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
@Test
public void listEventsTest() throws Exception {
ErrorEvent responsesElement = ErrorEvent.newBuilder().build();
ListEventsResponse expectedResponse =
ListEventsResponse.newBuilder()
.setNextPageToken("")
.addAllErrorEvents(Arrays.asList(responsesElement))
.build();
mockErrorStatsService.addResponse(expectedResponse);
ProjectName projectName = ProjectName.of("[PROJECT]");
String groupId = "groupId293428218";
| ListEventsPagedResponse pagedListResponse = client.listEvents(projectName, groupId); |
googleapis/java-errorreporting | google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/MockErrorGroupServiceImpl.java | // Path: grpc-google-cloud-error-reporting-v1beta1/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceGrpc.java
// public abstract static class ErrorGroupServiceImplBase implements io.grpc.BindableService {
//
// /**
// *
// *
// * <pre>
// * Get the specified group.
// * </pre>
// */
// public void getGroup(
// com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest request,
// io.grpc.stub.StreamObserver<com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetGroupMethod(), responseObserver);
// }
//
// /**
// *
// *
// * <pre>
// * Replace the data for the specified group.
// * Fails if the group does not exist.
// * </pre>
// */
// public void updateGroup(
// com.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest request,
// io.grpc.stub.StreamObserver<com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getUpdateGroupMethod(), responseObserver);
// }
//
// @java.lang.Override
// public final io.grpc.ServerServiceDefinition bindService() {
// return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
// .addMethod(
// getGetGroupMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>(
// this, METHODID_GET_GROUP)))
// .addMethod(
// getUpdateGroupMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>(
// this, METHODID_UPDATE_GROUP)))
// .build();
// }
// }
| import com.google.api.core.BetaApi;
import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupServiceGrpc.ErrorGroupServiceImplBase;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated; | /*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.google.devtools.clouderrorreporting.v1beta1;
@BetaApi
@Generated("by gapic-generator-java") | // Path: grpc-google-cloud-error-reporting-v1beta1/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorGroupServiceGrpc.java
// public abstract static class ErrorGroupServiceImplBase implements io.grpc.BindableService {
//
// /**
// *
// *
// * <pre>
// * Get the specified group.
// * </pre>
// */
// public void getGroup(
// com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest request,
// io.grpc.stub.StreamObserver<com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetGroupMethod(), responseObserver);
// }
//
// /**
// *
// *
// * <pre>
// * Replace the data for the specified group.
// * Fails if the group does not exist.
// * </pre>
// */
// public void updateGroup(
// com.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest request,
// io.grpc.stub.StreamObserver<com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getUpdateGroupMethod(), responseObserver);
// }
//
// @java.lang.Override
// public final io.grpc.ServerServiceDefinition bindService() {
// return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
// .addMethod(
// getGetGroupMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.GetGroupRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>(
// this, METHODID_GET_GROUP)))
// .addMethod(
// getUpdateGroupMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.UpdateGroupRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ErrorGroup>(
// this, METHODID_UPDATE_GROUP)))
// .build();
// }
// }
// Path: google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/MockErrorGroupServiceImpl.java
import com.google.api.core.BetaApi;
import com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupServiceGrpc.ErrorGroupServiceImplBase;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated;
/*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.google.devtools.clouderrorreporting.v1beta1;
@BetaApi
@Generated("by gapic-generator-java") | public class MockErrorGroupServiceImpl extends ErrorGroupServiceImplBase { |
googleapis/java-errorreporting | google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/MockErrorStatsServiceImpl.java | // Path: grpc-google-cloud-error-reporting-v1beta1/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceGrpc.java
// public abstract static class ErrorStatsServiceImplBase implements io.grpc.BindableService {
//
// /**
// *
// *
// * <pre>
// * Lists the specified groups.
// * </pre>
// */
// public void listGroupStats(
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getListGroupStatsMethod(), responseObserver);
// }
//
// /**
// *
// *
// * <pre>
// * Lists the specified events.
// * </pre>
// */
// public void listEvents(
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListEventsMethod(), responseObserver);
// }
//
// /**
// *
// *
// * <pre>
// * Deletes all error events of a given project.
// * </pre>
// */
// public void deleteEvents(
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getDeleteEventsMethod(), responseObserver);
// }
//
// @java.lang.Override
// public final io.grpc.ServerServiceDefinition bindService() {
// return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
// .addMethod(
// getListGroupStatsMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse>(
// this, METHODID_LIST_GROUP_STATS)))
// .addMethod(
// getListEventsMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse>(
// this, METHODID_LIST_EVENTS)))
// .addMethod(
// getDeleteEventsMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest,
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse>(
// this, METHODID_DELETE_EVENTS)))
// .build();
// }
// }
| import com.google.api.core.BetaApi;
import com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceGrpc.ErrorStatsServiceImplBase;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated; | /*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.google.devtools.clouderrorreporting.v1beta1;
@BetaApi
@Generated("by gapic-generator-java") | // Path: grpc-google-cloud-error-reporting-v1beta1/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ErrorStatsServiceGrpc.java
// public abstract static class ErrorStatsServiceImplBase implements io.grpc.BindableService {
//
// /**
// *
// *
// * <pre>
// * Lists the specified groups.
// * </pre>
// */
// public void listGroupStats(
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getListGroupStatsMethod(), responseObserver);
// }
//
// /**
// *
// *
// * <pre>
// * Lists the specified events.
// * </pre>
// */
// public void listEvents(
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListEventsMethod(), responseObserver);
// }
//
// /**
// *
// *
// * <pre>
// * Deletes all error events of a given project.
// * </pre>
// */
// public void deleteEvents(
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getDeleteEventsMethod(), responseObserver);
// }
//
// @java.lang.Override
// public final io.grpc.ServerServiceDefinition bindService() {
// return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
// .addMethod(
// getListGroupStatsMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ListGroupStatsResponse>(
// this, METHODID_LIST_GROUP_STATS)))
// .addMethod(
// getListEventsMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ListEventsResponse>(
// this, METHODID_LIST_EVENTS)))
// .addMethod(
// getDeleteEventsMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsRequest,
// com.google.devtools.clouderrorreporting.v1beta1.DeleteEventsResponse>(
// this, METHODID_DELETE_EVENTS)))
// .build();
// }
// }
// Path: google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/MockErrorStatsServiceImpl.java
import com.google.api.core.BetaApi;
import com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceGrpc.ErrorStatsServiceImplBase;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated;
/*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.google.devtools.clouderrorreporting.v1beta1;
@BetaApi
@Generated("by gapic-generator-java") | public class MockErrorStatsServiceImpl extends ErrorStatsServiceImplBase { |
googleapis/java-errorreporting | google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/MockReportErrorsServiceImpl.java | // Path: grpc-google-cloud-error-reporting-v1beta1/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceGrpc.java
// public abstract static class ReportErrorsServiceImplBase implements io.grpc.BindableService {
//
// /**
// *
// *
// * <pre>
// * Report an individual error event and record the event to a log.
// * This endpoint accepts **either** an OAuth token,
// * **or** an [API key](https://support.google.com/cloud/answer/6158862)
// * for authentication. To use an API key, append it to the URL as the value of
// * a `key` parameter. For example:
// * `POST
// * https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456`
// * **Note:** [Error Reporting](/error-reporting) is a global service built
// * on Cloud Logging and doesn't analyze logs stored
// * in regional log buckets or logs routed to other Google Cloud projects.
// * For more information, see
// * [Using Error Reporting with regionalized
// * logs](/error-reporting/docs/regionalization).
// * </pre>
// */
// public void reportErrorEvent(
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getReportErrorEventMethod(), responseObserver);
// }
//
// @java.lang.Override
// public final io.grpc.ServerServiceDefinition bindService() {
// return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
// .addMethod(
// getReportErrorEventMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse>(
// this, METHODID_REPORT_ERROR_EVENT)))
// .build();
// }
// }
| import com.google.api.core.BetaApi;
import com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceGrpc.ReportErrorsServiceImplBase;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated; | /*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.google.devtools.clouderrorreporting.v1beta1;
@BetaApi
@Generated("by gapic-generator-java") | // Path: grpc-google-cloud-error-reporting-v1beta1/src/main/java/com/google/devtools/clouderrorreporting/v1beta1/ReportErrorsServiceGrpc.java
// public abstract static class ReportErrorsServiceImplBase implements io.grpc.BindableService {
//
// /**
// *
// *
// * <pre>
// * Report an individual error event and record the event to a log.
// * This endpoint accepts **either** an OAuth token,
// * **or** an [API key](https://support.google.com/cloud/answer/6158862)
// * for authentication. To use an API key, append it to the URL as the value of
// * a `key` parameter. For example:
// * `POST
// * https://clouderrorreporting.googleapis.com/v1beta1/{projectName}/events:report?key=123ABC456`
// * **Note:** [Error Reporting](/error-reporting) is a global service built
// * on Cloud Logging and doesn't analyze logs stored
// * in regional log buckets or logs routed to other Google Cloud projects.
// * For more information, see
// * [Using Error Reporting with regionalized
// * logs](/error-reporting/docs/regionalization).
// * </pre>
// */
// public void reportErrorEvent(
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest request,
// io.grpc.stub.StreamObserver<
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse>
// responseObserver) {
// io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
// getReportErrorEventMethod(), responseObserver);
// }
//
// @java.lang.Override
// public final io.grpc.ServerServiceDefinition bindService() {
// return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
// .addMethod(
// getReportErrorEventMethod(),
// io.grpc.stub.ServerCalls.asyncUnaryCall(
// new MethodHandlers<
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventRequest,
// com.google.devtools.clouderrorreporting.v1beta1.ReportErrorEventResponse>(
// this, METHODID_REPORT_ERROR_EVENT)))
// .build();
// }
// }
// Path: google-cloud-errorreporting/src/test/java/com/google/devtools/clouderrorreporting/v1beta1/MockReportErrorsServiceImpl.java
import com.google.api.core.BetaApi;
import com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceGrpc.ReportErrorsServiceImplBase;
import com.google.protobuf.AbstractMessage;
import io.grpc.stub.StreamObserver;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import javax.annotation.Generated;
/*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.google.devtools.clouderrorreporting.v1beta1;
@BetaApi
@Generated("by gapic-generator-java") | public class MockReportErrorsServiceImpl extends ReportErrorsServiceImplBase { |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/SegmentTemplate.java | // Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.support.Utils;
import java.util.Arrays;
import java.util.List;
import java.util.Objects; | this.startNumber = startNumber;
this.timescale = timescale;
this.presentationTimeOffset = presentationTimeOffset;
this.indexRange = indexRange;
this.indexRangeExact = indexRangeExact;
this.availabilityTimeOffset = availabilityTimeOffset;
this.availabilityTimeComplete = availabilityTimeComplete;
}
@SuppressWarnings("unused")
private SegmentTemplate() {
this.segmentTimeline = null;
this.bitstreamswitchingElement = null;
this.initializationElement = null;
this.representationIndex = null;
this.media = null;
this.index = null;
this.initialization = null;
this.bitstreamSwitching = null;
this.duration = null;
this.startNumber = null;
this.timescale = null;
this.presentationTimeOffset = null;
this.indexRange = null;
this.indexRangeExact = null;
this.availabilityTimeOffset = null;
this.availabilityTimeComplete = null;
}
public List<Segment> getSegmentTimeline() { | // Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/SegmentTemplate.java
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.support.Utils;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
this.startNumber = startNumber;
this.timescale = timescale;
this.presentationTimeOffset = presentationTimeOffset;
this.indexRange = indexRange;
this.indexRangeExact = indexRangeExact;
this.availabilityTimeOffset = availabilityTimeOffset;
this.availabilityTimeComplete = availabilityTimeComplete;
}
@SuppressWarnings("unused")
private SegmentTemplate() {
this.segmentTimeline = null;
this.bitstreamswitchingElement = null;
this.initializationElement = null;
this.representationIndex = null;
this.media = null;
this.index = null;
this.initialization = null;
this.bitstreamSwitching = null;
this.duration = null;
this.startNumber = null;
this.timescale = null;
this.presentationTimeOffset = null;
this.indexRange = null;
this.indexRangeExact = null;
this.availabilityTimeOffset = null;
this.availabilityTimeComplete = null;
}
public List<Segment> getSegmentTimeline() { | return Utils.unmodifiableList(segmentTimeline); |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/EventStream.java | // Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | private final String value;
@JacksonXmlProperty(isAttribute = true)
private final Long timescale;
@JacksonXmlProperty(isAttribute = true)
private final String messageData;
private EventStream(List<Event> events, String href, ActuateType actuate, String schemeIdUri, String value, Long timescale, String messageData) {
this.events = events;
this.href = href;
this.actuate = actuate;
this.schemeIdUri = schemeIdUri;
this.value = value;
this.timescale = timescale;
this.messageData = messageData;
}
@SuppressWarnings("unused")
private EventStream() {
this.events = null;
this.href = null;
this.actuate = null;
this.schemeIdUri = null;
this.value = null;
this.timescale = null;
this.messageData = null;
}
public List<Event> getEvents() { | // Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/EventStream.java
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
private final String value;
@JacksonXmlProperty(isAttribute = true)
private final Long timescale;
@JacksonXmlProperty(isAttribute = true)
private final String messageData;
private EventStream(List<Event> events, String href, ActuateType actuate, String schemeIdUri, String value, Long timescale, String messageData) {
this.events = events;
this.href = href;
this.actuate = actuate;
this.schemeIdUri = schemeIdUri;
this.value = value;
this.timescale = timescale;
this.messageData = messageData;
}
@SuppressWarnings("unused")
private EventStream() {
this.events = null;
this.href = null;
this.actuate = null;
this.schemeIdUri = null;
this.value = null;
this.timescale = null;
this.messageData = null;
}
public List<Event> getEvents() { | return Utils.unmodifiableList(events); |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/RepresentationBase.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"framePackings",
"audioChannelConfigurations",
"contentProtections",
"essentialProperties",
"supplementalProperties",
"inbandEventStreams"
})
public abstract class RepresentationBase {
@JacksonXmlProperty(localName = "FramePacking", namespace = MPD.NAMESPACE) | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/RepresentationBase.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"framePackings",
"audioChannelConfigurations",
"contentProtections",
"essentialProperties",
"supplementalProperties",
"inbandEventStreams"
})
public abstract class RepresentationBase {
@JacksonXmlProperty(localName = "FramePacking", namespace = MPD.NAMESPACE) | private final List<Descriptor> framePackings; |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/RepresentationBase.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | this.startWithSAP = startWithSAP;
this.maxPlayoutRate = maxPlayoutRate;
this.codingDependency = codingDependency;
this.scanType = scanType;
}
RepresentationBase() {
this.framePackings = null;
this.audioChannelConfigurations = null;
this.contentProtections = null;
this.essentialProperties = null;
this.supplementalProperties = null;
this.inbandEventStreams = null;
this.profiles = null;
this.width = null;
this.height = null;
this.sar = null;
this.frameRate = null;
this.audioSamplingRate = null;
this.mimeType = null;
this.segmentProfiles = null;
this.codecs = null;
this.maximumSAPPeriod = null;
this.startWithSAP = null;
this.maxPlayoutRate = null;
this.codingDependency = null;
this.scanType = null;
}
public List<Descriptor> getFramePackings() { | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/RepresentationBase.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
this.startWithSAP = startWithSAP;
this.maxPlayoutRate = maxPlayoutRate;
this.codingDependency = codingDependency;
this.scanType = scanType;
}
RepresentationBase() {
this.framePackings = null;
this.audioChannelConfigurations = null;
this.contentProtections = null;
this.essentialProperties = null;
this.supplementalProperties = null;
this.inbandEventStreams = null;
this.profiles = null;
this.width = null;
this.height = null;
this.sar = null;
this.frameRate = null;
this.audioSamplingRate = null;
this.mimeType = null;
this.segmentProfiles = null;
this.codecs = null;
this.maximumSAPPeriod = null;
this.startWithSAP = null;
this.maxPlayoutRate = null;
this.codingDependency = null;
this.scanType = null;
}
public List<Descriptor> getFramePackings() { | return Utils.unmodifiableList(framePackings); |
carlanton/mpd-tools | parser/src/test/java/io/lindstrom/mpd/support/ProfilesSerializerTest.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/Profile.java
// public enum Profile {
// /**
// * MPEG-DASH Full profile.
// */
// MPEG_DASH_FULL("urn:mpeg:dash:profile:full:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format On Demand profile.
// */
// MPEG_DASH_ON_DEMAND("urn:mpeg:dash:profile:isoff-on-demand:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format live profile.
// */
// MPEG_DASH_LIVE("urn:mpeg:dash:profile:isoff-live:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format main profile.
// */
// MPEG_DASH_MAIN("urn:mpeg:dash:profile:isoff-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS main profile.
// */
// MPEG_DASH_MP2TS("urn:mpeg:dash:profile:mp2t-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS simple profile.
// */
// MPEG_DASH_MP2TS_SIMPLE("urn:mpeg:dash:profile:mp2t-simple:2011"),
//
// /**
// * 3GP-DASH Release-10 profile.
// */
// MPEG_DASH_3GP("urn:3GPP:PSS:profile:DASH10"),
//
// /**
// * HbbTV 2.0 DASH profiles.
// */
// HBBTV201("urn:dvb:dash:profile:dvb-dash:2014"),
//
// /**
// * HbbTV 1.5 DASH profiles.
// */
// HBBTV15("urn:hbbtv:dash:profile:isoff-live:2012");
//
// private final String identifier;
//
// Profile(String identifier) {
// this.identifier = identifier;
// }
//
// @Override
// public String toString() {
// return identifier;
// }
//
// public static Profile fromIdentifier(String identifier) {
// for (Profile profile : values()) {
// if (profile.identifier.equals(identifier)) {
// return profile;
// }
// }
// throw new IllegalArgumentException();
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/data/Profiles.java
// @JsonSerialize(using = ProfilesSerializer.class)
// @JsonDeserialize(using = ProfilesDeserializer.class)
// public class Profiles {
// private final List<Profile> profiles;
// private final List<String> interoperabilityPointsAndExtensions;
//
// public Profiles(List<Profile> profiles, List<String> interoperabilityPointsAndExtensions) {
// this.profiles = profiles;
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// }
//
// Profiles() {
// this.profiles = null;
// this.interoperabilityPointsAndExtensions = null;
// }
//
// public List<Profile> getProfiles() {
// return Utils.unmodifiableList(profiles);
// }
//
// public List<String> getInteroperabilityPointsAndExtensions() {
// return Utils.unmodifiableList(interoperabilityPointsAndExtensions);
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// Profiles profiles1 = (Profiles) o;
// return Objects.equals(profiles, profiles1.profiles) &&
// Objects.equals(interoperabilityPointsAndExtensions, profiles1.interoperabilityPointsAndExtensions);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(profiles, interoperabilityPointsAndExtensions);
// }
//
// @Override
// public String toString() {
// return "Profiles{" +
// "profiles=" + profiles +
// ", interoperabilityPointsAndExtensions=" + interoperabilityPointsAndExtensions +
// '}';
// }
//
// public Builder buildUpon() {
// return new Builder()
// .withProfiles(profiles)
// .withInteroperabilityPointsAndExtensions(interoperabilityPointsAndExtensions);
// }
//
// public static Builder builder() {
// return new Builder();
// }
//
// public static class Builder {
// private List<Profile> profiles;
// private List<String> interoperabilityPointsAndExtensions;
//
// public Builder withProfiles(List<Profile> profiles) {
// this.profiles = profiles;
// return this;
// }
//
// public Builder withInteroperabilityPointsAndExtensions(List<String> interoperabilityPointsAndExtensions) {
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// return this;
// }
//
// public Profiles build() {
// return new Profiles(profiles, interoperabilityPointsAndExtensions);
// }
// }
// }
| import io.lindstrom.mpd.data.Profile;
import io.lindstrom.mpd.data.Profiles;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals; | package io.lindstrom.mpd.support;
public class ProfilesSerializerTest extends ObjectMapperTestBase<Profiles> {
@BeforeEach
public void ProfilesSerializerTest() {
initObjectMapperTestBase(Profiles.class, new ProfilesSerializer(), new ProfilesDeserializer());
}
@Test
public void serialize1() throws Exception { | // Path: parser/src/main/java/io/lindstrom/mpd/data/Profile.java
// public enum Profile {
// /**
// * MPEG-DASH Full profile.
// */
// MPEG_DASH_FULL("urn:mpeg:dash:profile:full:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format On Demand profile.
// */
// MPEG_DASH_ON_DEMAND("urn:mpeg:dash:profile:isoff-on-demand:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format live profile.
// */
// MPEG_DASH_LIVE("urn:mpeg:dash:profile:isoff-live:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format main profile.
// */
// MPEG_DASH_MAIN("urn:mpeg:dash:profile:isoff-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS main profile.
// */
// MPEG_DASH_MP2TS("urn:mpeg:dash:profile:mp2t-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS simple profile.
// */
// MPEG_DASH_MP2TS_SIMPLE("urn:mpeg:dash:profile:mp2t-simple:2011"),
//
// /**
// * 3GP-DASH Release-10 profile.
// */
// MPEG_DASH_3GP("urn:3GPP:PSS:profile:DASH10"),
//
// /**
// * HbbTV 2.0 DASH profiles.
// */
// HBBTV201("urn:dvb:dash:profile:dvb-dash:2014"),
//
// /**
// * HbbTV 1.5 DASH profiles.
// */
// HBBTV15("urn:hbbtv:dash:profile:isoff-live:2012");
//
// private final String identifier;
//
// Profile(String identifier) {
// this.identifier = identifier;
// }
//
// @Override
// public String toString() {
// return identifier;
// }
//
// public static Profile fromIdentifier(String identifier) {
// for (Profile profile : values()) {
// if (profile.identifier.equals(identifier)) {
// return profile;
// }
// }
// throw new IllegalArgumentException();
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/data/Profiles.java
// @JsonSerialize(using = ProfilesSerializer.class)
// @JsonDeserialize(using = ProfilesDeserializer.class)
// public class Profiles {
// private final List<Profile> profiles;
// private final List<String> interoperabilityPointsAndExtensions;
//
// public Profiles(List<Profile> profiles, List<String> interoperabilityPointsAndExtensions) {
// this.profiles = profiles;
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// }
//
// Profiles() {
// this.profiles = null;
// this.interoperabilityPointsAndExtensions = null;
// }
//
// public List<Profile> getProfiles() {
// return Utils.unmodifiableList(profiles);
// }
//
// public List<String> getInteroperabilityPointsAndExtensions() {
// return Utils.unmodifiableList(interoperabilityPointsAndExtensions);
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// Profiles profiles1 = (Profiles) o;
// return Objects.equals(profiles, profiles1.profiles) &&
// Objects.equals(interoperabilityPointsAndExtensions, profiles1.interoperabilityPointsAndExtensions);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(profiles, interoperabilityPointsAndExtensions);
// }
//
// @Override
// public String toString() {
// return "Profiles{" +
// "profiles=" + profiles +
// ", interoperabilityPointsAndExtensions=" + interoperabilityPointsAndExtensions +
// '}';
// }
//
// public Builder buildUpon() {
// return new Builder()
// .withProfiles(profiles)
// .withInteroperabilityPointsAndExtensions(interoperabilityPointsAndExtensions);
// }
//
// public static Builder builder() {
// return new Builder();
// }
//
// public static class Builder {
// private List<Profile> profiles;
// private List<String> interoperabilityPointsAndExtensions;
//
// public Builder withProfiles(List<Profile> profiles) {
// this.profiles = profiles;
// return this;
// }
//
// public Builder withInteroperabilityPointsAndExtensions(List<String> interoperabilityPointsAndExtensions) {
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// return this;
// }
//
// public Profiles build() {
// return new Profiles(profiles, interoperabilityPointsAndExtensions);
// }
// }
// }
// Path: parser/src/test/java/io/lindstrom/mpd/support/ProfilesSerializerTest.java
import io.lindstrom.mpd.data.Profile;
import io.lindstrom.mpd.data.Profiles;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertEquals;
package io.lindstrom.mpd.support;
public class ProfilesSerializerTest extends ObjectMapperTestBase<Profiles> {
@BeforeEach
public void ProfilesSerializerTest() {
initObjectMapperTestBase(Profiles.class, new ProfilesSerializer(), new ProfilesDeserializer());
}
@Test
public void serialize1() throws Exception { | Profiles profiles = new Profiles(Arrays.asList(Profile.MPEG_DASH_LIVE, Profile.HBBTV15), |
carlanton/mpd-tools | validator/src/main/java/io/lindstrom/mpd/validator/rules/RoleValidator.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
| import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.Arrays;
import java.util.List; | package io.lindstrom.mpd.validator.rules;
public class RoleValidator {
/*
*
* R13.*: Check the conformance of Role
*
*/
private static final List<String> VALID_ROLES = Arrays.asList(
"caption",
"subtitle",
"main",
"alternate",
"supplementary",
"commentary",
"dub"
);
@ValidationRule("if ((@schemeIdUri = 'urn:mpeg:dash:role:2011') and " +
"not(@value = 'caption' or @value = 'subtitle' or @value = 'main' or " +
"@value = 'alternate' or @value = 'supplementary' or @value = 'commentary' or @value = 'dub')) then false else true()") | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
// Path: validator/src/main/java/io/lindstrom/mpd/validator/rules/RoleValidator.java
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.Arrays;
import java.util.List;
package io.lindstrom.mpd.validator.rules;
public class RoleValidator {
/*
*
* R13.*: Check the conformance of Role
*
*/
private static final List<String> VALID_ROLES = Arrays.asList(
"caption",
"subtitle",
"main",
"alternate",
"supplementary",
"commentary",
"dub"
);
@ValidationRule("if ((@schemeIdUri = 'urn:mpeg:dash:role:2011') and " +
"not(@value = 'caption' or @value = 'subtitle' or @value = 'main' or " +
"@value = 'alternate' or @value = 'supplementary' or @value = 'commentary' or @value = 'dub')) then false else true()") | private static Violation ruleR130(Descriptor role) { |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/Representation.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | @JacksonXmlProperty(localName = "BaseURL", namespace = MPD.NAMESPACE)
private final List<BaseURL> baseURLs;
@JacksonXmlProperty(localName = "SubRepresentation", namespace = MPD.NAMESPACE)
private final List<SubRepresentation> subRepresentations;
@JacksonXmlProperty(localName = "SegmentBase", namespace = MPD.NAMESPACE)
private final SegmentBase segmentBase;
@JacksonXmlProperty(localName = "SegmentList", namespace = MPD.NAMESPACE)
private final SegmentList segmentList;
@JacksonXmlProperty(localName = "SegmentTemplate", namespace = MPD.NAMESPACE)
private final SegmentTemplate segmentTemplate;
@JacksonXmlProperty(isAttribute = true)
private final String id;
@JacksonXmlProperty(isAttribute = true)
private final long bandwidth;
@JacksonXmlProperty(isAttribute = true)
private final Long qualityRanking;
@JacksonXmlProperty(isAttribute = true)
private final String dependencyId;
@JacksonXmlProperty(isAttribute = true)
private final String mediaStreamStructureId;
| // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/Representation.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
@JacksonXmlProperty(localName = "BaseURL", namespace = MPD.NAMESPACE)
private final List<BaseURL> baseURLs;
@JacksonXmlProperty(localName = "SubRepresentation", namespace = MPD.NAMESPACE)
private final List<SubRepresentation> subRepresentations;
@JacksonXmlProperty(localName = "SegmentBase", namespace = MPD.NAMESPACE)
private final SegmentBase segmentBase;
@JacksonXmlProperty(localName = "SegmentList", namespace = MPD.NAMESPACE)
private final SegmentList segmentList;
@JacksonXmlProperty(localName = "SegmentTemplate", namespace = MPD.NAMESPACE)
private final SegmentTemplate segmentTemplate;
@JacksonXmlProperty(isAttribute = true)
private final String id;
@JacksonXmlProperty(isAttribute = true)
private final long bandwidth;
@JacksonXmlProperty(isAttribute = true)
private final Long qualityRanking;
@JacksonXmlProperty(isAttribute = true)
private final String dependencyId;
@JacksonXmlProperty(isAttribute = true)
private final String mediaStreamStructureId;
| private Representation(List<Descriptor> framePackings, List<Descriptor> audioChannelConfigurations, List<Descriptor> contentProtections, List<Descriptor> essentialProperties, List<Descriptor> supplementalProperties, List<EventStream> inbandEventStreams, String profiles, Long width, Long height, Ratio sar, FrameRate frameRate, String audioSamplingRate, String mimeType, String segmentProfiles, String codecs, Double maximumSAPPeriod, Long startWithSAP, Double maxPlayoutRate, Boolean codingDependency, VideoScanType scanType, List<BaseURL> baseURLs, List<SubRepresentation> subRepresentations, SegmentBase segmentBase, SegmentList segmentList, SegmentTemplate segmentTemplate, String id, long bandwidth, Long qualityRanking, String dependencyId, String mediaStreamStructureId) { |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/Representation.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; |
private Representation(List<Descriptor> framePackings, List<Descriptor> audioChannelConfigurations, List<Descriptor> contentProtections, List<Descriptor> essentialProperties, List<Descriptor> supplementalProperties, List<EventStream> inbandEventStreams, String profiles, Long width, Long height, Ratio sar, FrameRate frameRate, String audioSamplingRate, String mimeType, String segmentProfiles, String codecs, Double maximumSAPPeriod, Long startWithSAP, Double maxPlayoutRate, Boolean codingDependency, VideoScanType scanType, List<BaseURL> baseURLs, List<SubRepresentation> subRepresentations, SegmentBase segmentBase, SegmentList segmentList, SegmentTemplate segmentTemplate, String id, long bandwidth, Long qualityRanking, String dependencyId, String mediaStreamStructureId) {
super(framePackings, audioChannelConfigurations, contentProtections, essentialProperties, supplementalProperties, inbandEventStreams, profiles, width, height, sar, frameRate, audioSamplingRate, mimeType, segmentProfiles, codecs, maximumSAPPeriod, startWithSAP, maxPlayoutRate, codingDependency, scanType);
this.baseURLs = baseURLs;
this.subRepresentations = subRepresentations;
this.segmentBase = segmentBase;
this.segmentList = segmentList;
this.segmentTemplate = segmentTemplate;
this.id = id;
this.bandwidth = bandwidth;
this.qualityRanking = qualityRanking;
this.dependencyId = dependencyId;
this.mediaStreamStructureId = mediaStreamStructureId;
}
@SuppressWarnings("unused")
private Representation() {
this.baseURLs = null;
this.subRepresentations = null;
this.segmentBase = null;
this.segmentList = null;
this.segmentTemplate = null;
this.id = null;
this.bandwidth = 0;
this.qualityRanking = null;
this.dependencyId = null;
this.mediaStreamStructureId = null;
}
public List<BaseURL> getBaseURLs() { | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/Representation.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
private Representation(List<Descriptor> framePackings, List<Descriptor> audioChannelConfigurations, List<Descriptor> contentProtections, List<Descriptor> essentialProperties, List<Descriptor> supplementalProperties, List<EventStream> inbandEventStreams, String profiles, Long width, Long height, Ratio sar, FrameRate frameRate, String audioSamplingRate, String mimeType, String segmentProfiles, String codecs, Double maximumSAPPeriod, Long startWithSAP, Double maxPlayoutRate, Boolean codingDependency, VideoScanType scanType, List<BaseURL> baseURLs, List<SubRepresentation> subRepresentations, SegmentBase segmentBase, SegmentList segmentList, SegmentTemplate segmentTemplate, String id, long bandwidth, Long qualityRanking, String dependencyId, String mediaStreamStructureId) {
super(framePackings, audioChannelConfigurations, contentProtections, essentialProperties, supplementalProperties, inbandEventStreams, profiles, width, height, sar, frameRate, audioSamplingRate, mimeType, segmentProfiles, codecs, maximumSAPPeriod, startWithSAP, maxPlayoutRate, codingDependency, scanType);
this.baseURLs = baseURLs;
this.subRepresentations = subRepresentations;
this.segmentBase = segmentBase;
this.segmentList = segmentList;
this.segmentTemplate = segmentTemplate;
this.id = id;
this.bandwidth = bandwidth;
this.qualityRanking = qualityRanking;
this.dependencyId = dependencyId;
this.mediaStreamStructureId = mediaStreamStructureId;
}
@SuppressWarnings("unused")
private Representation() {
this.baseURLs = null;
this.subRepresentations = null;
this.segmentBase = null;
this.segmentList = null;
this.segmentTemplate = null;
this.id = null;
this.bandwidth = 0;
this.qualityRanking = null;
this.dependencyId = null;
this.mediaStreamStructureId = null;
}
public List<BaseURL> getBaseURLs() { | return Utils.unmodifiableList(baseURLs); |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/SubRepresentation.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
public class SubRepresentation extends RepresentationBase {
@JacksonXmlProperty(isAttribute = true)
private final Long level;
@JacksonXmlProperty(isAttribute = true)
private final String dependencyLevel;
@JacksonXmlProperty(isAttribute = true)
private final Long bandwidth;
@JacksonXmlProperty(isAttribute = true)
private final String contentComponent;
| // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/SubRepresentation.java
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
public class SubRepresentation extends RepresentationBase {
@JacksonXmlProperty(isAttribute = true)
private final Long level;
@JacksonXmlProperty(isAttribute = true)
private final String dependencyLevel;
@JacksonXmlProperty(isAttribute = true)
private final Long bandwidth;
@JacksonXmlProperty(isAttribute = true)
private final String contentComponent;
| private SubRepresentation(List<Descriptor> framePackings, List<Descriptor> audioChannelConfigurations, List<Descriptor> contentProtections, List<Descriptor> essentialProperties, List<Descriptor> supplementalProperties, List<EventStream> inbandEventStreams, String profiles, Long width, Long height, Ratio sar, FrameRate frameRate, String audioSamplingRate, String mimeType, String segmentProfiles, String codecs, Double maximumSAPPeriod, Long startWithSAP, Double maxPlayoutRate, Boolean codingDependency, VideoScanType scanType, Long level, String dependencyLevel, Long bandwidth, String contentComponent) { |
carlanton/mpd-tools | validator/src/main/java/io/lindstrom/mpd/validator/rules/RepresentationValidator.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
| import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; | return Violation.empty();
}
public static List<Violation> validate(MPD mpd, Period period, AdaptationSet adaptationSet, Representation representation) {
List<Violation> violations = new ArrayList<>();
violations.addAll(Arrays.asList(
ruleR501(adaptationSet, representation),
ruleR502(adaptationSet, representation),
ruleR51(mpd, period, adaptationSet, representation),
ruleR52(representation),
ruleRD50(mpd, adaptationSet),
ruleRD51(mpd, adaptationSet, representation),
ruleRD52(mpd, adaptationSet, representation),
ruleRD53(mpd, adaptationSet, representation),
ruleRD54(mpd, adaptationSet, representation)
));
if (representation.getSegmentTemplate() != null) {
violations.addAll(SegmentTemplateValidator.validate(mpd, representation.getSegmentTemplate()));
}
if (representation.getSegmentList() != null) {
violations.addAll(SegmentListValidator.validate(mpd, representation.getSegmentList()));
}
if (representation.getSegmentBase() != null) {
violations.addAll(SegmentBaseValidator.validate(mpd, representation.getSegmentBase()));
}
| // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
// Path: validator/src/main/java/io/lindstrom/mpd/validator/rules/RepresentationValidator.java
import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
return Violation.empty();
}
public static List<Violation> validate(MPD mpd, Period period, AdaptationSet adaptationSet, Representation representation) {
List<Violation> violations = new ArrayList<>();
violations.addAll(Arrays.asList(
ruleR501(adaptationSet, representation),
ruleR502(adaptationSet, representation),
ruleR51(mpd, period, adaptationSet, representation),
ruleR52(representation),
ruleRD50(mpd, adaptationSet),
ruleRD51(mpd, adaptationSet, representation),
ruleRD52(mpd, adaptationSet, representation),
ruleRD53(mpd, adaptationSet, representation),
ruleRD54(mpd, adaptationSet, representation)
));
if (representation.getSegmentTemplate() != null) {
violations.addAll(SegmentTemplateValidator.validate(mpd, representation.getSegmentTemplate()));
}
if (representation.getSegmentList() != null) {
violations.addAll(SegmentListValidator.validate(mpd, representation.getSegmentList()));
}
if (representation.getSegmentBase() != null) {
violations.addAll(SegmentBaseValidator.validate(mpd, representation.getSegmentBase()));
}
| for (Descriptor framePacking : representation.getFramePackings()) { |
carlanton/mpd-tools | validator/src/main/java/io/lindstrom/mpd/validator/rules/AdaptationSetValidator.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
| import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors; | ruleR33(adaptationSet),
ruleR34(adaptationSet),
ruleR35(adaptationSet),
ruleR36(adaptationSet),
ruleR37(adaptationSet),
ruleR38(adaptationSet),
ruleR39(adaptationSet),
ruleRD30(adaptationSet, mpd),
ruleRD31(adaptationSet, mpd),
ruleRD32(adaptationSet, mpd),
ruleRD33(adaptationSet, mpd),
ruleRD34(adaptationSet, mpd),
ruleRD35(adaptationSet, mpd),
ruleRD36(adaptationSet, mpd),
ruleRD37(adaptationSet, mpd),
ruleRD38(adaptationSet),
ruleR40(adaptationSet)));
if (adaptationSet.getSegmentTemplate() != null) {
violations.addAll(SegmentTemplateValidator.validate(mpd, adaptationSet.getSegmentTemplate()));
}
if (adaptationSet.getSegmentBase() != null) {
violations.addAll(SegmentBaseValidator.validate(mpd, adaptationSet.getSegmentBase()));
}
if (adaptationSet.getSegmentList() != null) {
violations.addAll(SegmentListValidator.validate(mpd, adaptationSet.getSegmentList()));
}
| // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
// Path: validator/src/main/java/io/lindstrom/mpd/validator/rules/AdaptationSetValidator.java
import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
ruleR33(adaptationSet),
ruleR34(adaptationSet),
ruleR35(adaptationSet),
ruleR36(adaptationSet),
ruleR37(adaptationSet),
ruleR38(adaptationSet),
ruleR39(adaptationSet),
ruleRD30(adaptationSet, mpd),
ruleRD31(adaptationSet, mpd),
ruleRD32(adaptationSet, mpd),
ruleRD33(adaptationSet, mpd),
ruleRD34(adaptationSet, mpd),
ruleRD35(adaptationSet, mpd),
ruleRD36(adaptationSet, mpd),
ruleRD37(adaptationSet, mpd),
ruleRD38(adaptationSet),
ruleR40(adaptationSet)));
if (adaptationSet.getSegmentTemplate() != null) {
violations.addAll(SegmentTemplateValidator.validate(mpd, adaptationSet.getSegmentTemplate()));
}
if (adaptationSet.getSegmentBase() != null) {
violations.addAll(SegmentBaseValidator.validate(mpd, adaptationSet.getSegmentBase()));
}
if (adaptationSet.getSegmentList() != null) {
violations.addAll(SegmentListValidator.validate(mpd, adaptationSet.getSegmentList()));
}
| for (Descriptor framePacking : adaptationSet.getFramePackings()) { |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/support/ProfilesDeserializer.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/Profile.java
// public enum Profile {
// /**
// * MPEG-DASH Full profile.
// */
// MPEG_DASH_FULL("urn:mpeg:dash:profile:full:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format On Demand profile.
// */
// MPEG_DASH_ON_DEMAND("urn:mpeg:dash:profile:isoff-on-demand:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format live profile.
// */
// MPEG_DASH_LIVE("urn:mpeg:dash:profile:isoff-live:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format main profile.
// */
// MPEG_DASH_MAIN("urn:mpeg:dash:profile:isoff-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS main profile.
// */
// MPEG_DASH_MP2TS("urn:mpeg:dash:profile:mp2t-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS simple profile.
// */
// MPEG_DASH_MP2TS_SIMPLE("urn:mpeg:dash:profile:mp2t-simple:2011"),
//
// /**
// * 3GP-DASH Release-10 profile.
// */
// MPEG_DASH_3GP("urn:3GPP:PSS:profile:DASH10"),
//
// /**
// * HbbTV 2.0 DASH profiles.
// */
// HBBTV201("urn:dvb:dash:profile:dvb-dash:2014"),
//
// /**
// * HbbTV 1.5 DASH profiles.
// */
// HBBTV15("urn:hbbtv:dash:profile:isoff-live:2012");
//
// private final String identifier;
//
// Profile(String identifier) {
// this.identifier = identifier;
// }
//
// @Override
// public String toString() {
// return identifier;
// }
//
// public static Profile fromIdentifier(String identifier) {
// for (Profile profile : values()) {
// if (profile.identifier.equals(identifier)) {
// return profile;
// }
// }
// throw new IllegalArgumentException();
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/data/Profiles.java
// @JsonSerialize(using = ProfilesSerializer.class)
// @JsonDeserialize(using = ProfilesDeserializer.class)
// public class Profiles {
// private final List<Profile> profiles;
// private final List<String> interoperabilityPointsAndExtensions;
//
// public Profiles(List<Profile> profiles, List<String> interoperabilityPointsAndExtensions) {
// this.profiles = profiles;
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// }
//
// Profiles() {
// this.profiles = null;
// this.interoperabilityPointsAndExtensions = null;
// }
//
// public List<Profile> getProfiles() {
// return Utils.unmodifiableList(profiles);
// }
//
// public List<String> getInteroperabilityPointsAndExtensions() {
// return Utils.unmodifiableList(interoperabilityPointsAndExtensions);
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// Profiles profiles1 = (Profiles) o;
// return Objects.equals(profiles, profiles1.profiles) &&
// Objects.equals(interoperabilityPointsAndExtensions, profiles1.interoperabilityPointsAndExtensions);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(profiles, interoperabilityPointsAndExtensions);
// }
//
// @Override
// public String toString() {
// return "Profiles{" +
// "profiles=" + profiles +
// ", interoperabilityPointsAndExtensions=" + interoperabilityPointsAndExtensions +
// '}';
// }
//
// public Builder buildUpon() {
// return new Builder()
// .withProfiles(profiles)
// .withInteroperabilityPointsAndExtensions(interoperabilityPointsAndExtensions);
// }
//
// public static Builder builder() {
// return new Builder();
// }
//
// public static class Builder {
// private List<Profile> profiles;
// private List<String> interoperabilityPointsAndExtensions;
//
// public Builder withProfiles(List<Profile> profiles) {
// this.profiles = profiles;
// return this;
// }
//
// public Builder withInteroperabilityPointsAndExtensions(List<String> interoperabilityPointsAndExtensions) {
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// return this;
// }
//
// public Profiles build() {
// return new Profiles(profiles, interoperabilityPointsAndExtensions);
// }
// }
// }
| import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import io.lindstrom.mpd.data.Profile;
import io.lindstrom.mpd.data.Profiles;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List; | package io.lindstrom.mpd.support;
public class ProfilesDeserializer extends JsonDeserializer<Profiles> {
@Override
public Profiles deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String text = p.getText();
| // Path: parser/src/main/java/io/lindstrom/mpd/data/Profile.java
// public enum Profile {
// /**
// * MPEG-DASH Full profile.
// */
// MPEG_DASH_FULL("urn:mpeg:dash:profile:full:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format On Demand profile.
// */
// MPEG_DASH_ON_DEMAND("urn:mpeg:dash:profile:isoff-on-demand:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format live profile.
// */
// MPEG_DASH_LIVE("urn:mpeg:dash:profile:isoff-live:2011"),
//
// /**
// * MPEG-DASH ISO Base media file format main profile.
// */
// MPEG_DASH_MAIN("urn:mpeg:dash:profile:isoff-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS main profile.
// */
// MPEG_DASH_MP2TS("urn:mpeg:dash:profile:mp2t-main:2011"),
//
// /**
// * MPEG-DASH MPEG-2 TS simple profile.
// */
// MPEG_DASH_MP2TS_SIMPLE("urn:mpeg:dash:profile:mp2t-simple:2011"),
//
// /**
// * 3GP-DASH Release-10 profile.
// */
// MPEG_DASH_3GP("urn:3GPP:PSS:profile:DASH10"),
//
// /**
// * HbbTV 2.0 DASH profiles.
// */
// HBBTV201("urn:dvb:dash:profile:dvb-dash:2014"),
//
// /**
// * HbbTV 1.5 DASH profiles.
// */
// HBBTV15("urn:hbbtv:dash:profile:isoff-live:2012");
//
// private final String identifier;
//
// Profile(String identifier) {
// this.identifier = identifier;
// }
//
// @Override
// public String toString() {
// return identifier;
// }
//
// public static Profile fromIdentifier(String identifier) {
// for (Profile profile : values()) {
// if (profile.identifier.equals(identifier)) {
// return profile;
// }
// }
// throw new IllegalArgumentException();
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/data/Profiles.java
// @JsonSerialize(using = ProfilesSerializer.class)
// @JsonDeserialize(using = ProfilesDeserializer.class)
// public class Profiles {
// private final List<Profile> profiles;
// private final List<String> interoperabilityPointsAndExtensions;
//
// public Profiles(List<Profile> profiles, List<String> interoperabilityPointsAndExtensions) {
// this.profiles = profiles;
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// }
//
// Profiles() {
// this.profiles = null;
// this.interoperabilityPointsAndExtensions = null;
// }
//
// public List<Profile> getProfiles() {
// return Utils.unmodifiableList(profiles);
// }
//
// public List<String> getInteroperabilityPointsAndExtensions() {
// return Utils.unmodifiableList(interoperabilityPointsAndExtensions);
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// Profiles profiles1 = (Profiles) o;
// return Objects.equals(profiles, profiles1.profiles) &&
// Objects.equals(interoperabilityPointsAndExtensions, profiles1.interoperabilityPointsAndExtensions);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(profiles, interoperabilityPointsAndExtensions);
// }
//
// @Override
// public String toString() {
// return "Profiles{" +
// "profiles=" + profiles +
// ", interoperabilityPointsAndExtensions=" + interoperabilityPointsAndExtensions +
// '}';
// }
//
// public Builder buildUpon() {
// return new Builder()
// .withProfiles(profiles)
// .withInteroperabilityPointsAndExtensions(interoperabilityPointsAndExtensions);
// }
//
// public static Builder builder() {
// return new Builder();
// }
//
// public static class Builder {
// private List<Profile> profiles;
// private List<String> interoperabilityPointsAndExtensions;
//
// public Builder withProfiles(List<Profile> profiles) {
// this.profiles = profiles;
// return this;
// }
//
// public Builder withInteroperabilityPointsAndExtensions(List<String> interoperabilityPointsAndExtensions) {
// this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
// return this;
// }
//
// public Profiles build() {
// return new Profiles(profiles, interoperabilityPointsAndExtensions);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/support/ProfilesDeserializer.java
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import io.lindstrom.mpd.data.Profile;
import io.lindstrom.mpd.data.Profiles;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
package io.lindstrom.mpd.support;
public class ProfilesDeserializer extends JsonDeserializer<Profiles> {
@Override
public Profiles deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
String text = p.getText();
| List<Profile> profiles = new ArrayList<>(); |
carlanton/mpd-tools | validator/src/main/java/io/lindstrom/mpd/validator/rules/EventStreamValidator.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/EventStream.java
// public class EventStream {
// @JacksonXmlProperty(localName = "Event", namespace = MPD.NAMESPACE)
// private final List<Event> events;
//
// @JacksonXmlProperty(isAttribute = true, namespace = "http://www.w3.org/1999/xlink")
// private final String href;
//
// @JacksonXmlProperty(isAttribute = true, namespace = "http://www.w3.org/1999/xlink")
// private final ActuateType actuate;
//
// @JacksonXmlProperty(isAttribute = true)
// private final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// private final String value;
//
// @JacksonXmlProperty(isAttribute = true)
// private final Long timescale;
//
// @JacksonXmlProperty(isAttribute = true)
// private final String messageData;
//
// private EventStream(List<Event> events, String href, ActuateType actuate, String schemeIdUri, String value, Long timescale, String messageData) {
// this.events = events;
// this.href = href;
// this.actuate = actuate;
// this.schemeIdUri = schemeIdUri;
// this.value = value;
// this.timescale = timescale;
// this.messageData = messageData;
// }
//
// @SuppressWarnings("unused")
// private EventStream() {
// this.events = null;
// this.href = null;
// this.actuate = null;
// this.schemeIdUri = null;
// this.value = null;
// this.timescale = null;
// this.messageData = null;
// }
//
// public List<Event> getEvents() {
// return Utils.unmodifiableList(events);
// }
//
// public String getHref() {
// return href;
// }
//
// public ActuateType getActuate() {
// return actuate;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getValue() {
// return value;
// }
//
// public Long getTimescale() {
// return timescale;
// }
//
// public String getMessageData() {
// return messageData;
// }
//
// @Override
// public String toString() {
// return "EventStream{" +
// "events=" + events +
// ", href='" + href + '\'' +
// ", actuate=" + actuate +
// ", schemeIdUri='" + schemeIdUri + '\'' +
// ", value='" + value + '\'' +
// ", timescale=" + timescale +
// ", messageData='" + messageData + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// EventStream that = (EventStream) o;
// return Objects.equals(events, that.events) &&
// Objects.equals(href, that.href) &&
// actuate == that.actuate &&
// Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(value, that.value) &&
// Objects.equals(timescale, that.timescale) &&
// Objects.equals(messageData, that.messageData);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(events, href, actuate, schemeIdUri, value, timescale, messageData);
// }
//
// public Builder buildUpon() {
// return new Builder()
// .withEvents(events)
// .withHref(href)
// .withActuate(actuate)
// .withSchemeIdUri(schemeIdUri)
// .withValue(value)
// .withTimescale(timescale)
// .withMessageData(messageData);
// }
//
// public static Builder builder() {
// return new Builder();
// }
//
// public static class Builder {
// private List<Event> events;
// private String href;
// private ActuateType actuate;
// private String schemeIdUri;
// private String value;
// private Long timescale;
// private String messageData;
//
// public Builder withEvents(List<Event> events) {
// this.events = events;
// return this;
// }
//
// public Builder withHref(String href) {
// this.href = href;
// return this;
// }
//
// public Builder withActuate(ActuateType actuate) {
// this.actuate = actuate;
// return this;
// }
//
// public Builder withSchemeIdUri(String schemeIdUri) {
// this.schemeIdUri = schemeIdUri;
// return this;
// }
//
// public Builder withValue(String value) {
// this.value = value;
// return this;
// }
//
// public Builder withTimescale(Long timescale) {
// this.timescale = timescale;
// return this;
// }
//
// public Builder withMessageData(String messageData) {
// this.messageData = messageData;
// return this;
// }
//
// public EventStream build() {
// return new EventStream(events, href, actuate, schemeIdUri, value, timescale, messageData);
// }
// }
// }
| import io.lindstrom.mpd.data.EventStream;
import java.util.Arrays;
import java.util.List; | package io.lindstrom.mpd.validator.rules;
public class EventStreamValidator {
/*
*
* R16.*: Check the conformance of SegmentList
*
*/
@ValidationRule("if (@actuate and not(@href)) then false() else true()") | // Path: parser/src/main/java/io/lindstrom/mpd/data/EventStream.java
// public class EventStream {
// @JacksonXmlProperty(localName = "Event", namespace = MPD.NAMESPACE)
// private final List<Event> events;
//
// @JacksonXmlProperty(isAttribute = true, namespace = "http://www.w3.org/1999/xlink")
// private final String href;
//
// @JacksonXmlProperty(isAttribute = true, namespace = "http://www.w3.org/1999/xlink")
// private final ActuateType actuate;
//
// @JacksonXmlProperty(isAttribute = true)
// private final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// private final String value;
//
// @JacksonXmlProperty(isAttribute = true)
// private final Long timescale;
//
// @JacksonXmlProperty(isAttribute = true)
// private final String messageData;
//
// private EventStream(List<Event> events, String href, ActuateType actuate, String schemeIdUri, String value, Long timescale, String messageData) {
// this.events = events;
// this.href = href;
// this.actuate = actuate;
// this.schemeIdUri = schemeIdUri;
// this.value = value;
// this.timescale = timescale;
// this.messageData = messageData;
// }
//
// @SuppressWarnings("unused")
// private EventStream() {
// this.events = null;
// this.href = null;
// this.actuate = null;
// this.schemeIdUri = null;
// this.value = null;
// this.timescale = null;
// this.messageData = null;
// }
//
// public List<Event> getEvents() {
// return Utils.unmodifiableList(events);
// }
//
// public String getHref() {
// return href;
// }
//
// public ActuateType getActuate() {
// return actuate;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getValue() {
// return value;
// }
//
// public Long getTimescale() {
// return timescale;
// }
//
// public String getMessageData() {
// return messageData;
// }
//
// @Override
// public String toString() {
// return "EventStream{" +
// "events=" + events +
// ", href='" + href + '\'' +
// ", actuate=" + actuate +
// ", schemeIdUri='" + schemeIdUri + '\'' +
// ", value='" + value + '\'' +
// ", timescale=" + timescale +
// ", messageData='" + messageData + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// EventStream that = (EventStream) o;
// return Objects.equals(events, that.events) &&
// Objects.equals(href, that.href) &&
// actuate == that.actuate &&
// Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(value, that.value) &&
// Objects.equals(timescale, that.timescale) &&
// Objects.equals(messageData, that.messageData);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(events, href, actuate, schemeIdUri, value, timescale, messageData);
// }
//
// public Builder buildUpon() {
// return new Builder()
// .withEvents(events)
// .withHref(href)
// .withActuate(actuate)
// .withSchemeIdUri(schemeIdUri)
// .withValue(value)
// .withTimescale(timescale)
// .withMessageData(messageData);
// }
//
// public static Builder builder() {
// return new Builder();
// }
//
// public static class Builder {
// private List<Event> events;
// private String href;
// private ActuateType actuate;
// private String schemeIdUri;
// private String value;
// private Long timescale;
// private String messageData;
//
// public Builder withEvents(List<Event> events) {
// this.events = events;
// return this;
// }
//
// public Builder withHref(String href) {
// this.href = href;
// return this;
// }
//
// public Builder withActuate(ActuateType actuate) {
// this.actuate = actuate;
// return this;
// }
//
// public Builder withSchemeIdUri(String schemeIdUri) {
// this.schemeIdUri = schemeIdUri;
// return this;
// }
//
// public Builder withValue(String value) {
// this.value = value;
// return this;
// }
//
// public Builder withTimescale(Long timescale) {
// this.timescale = timescale;
// return this;
// }
//
// public Builder withMessageData(String messageData) {
// this.messageData = messageData;
// return this;
// }
//
// public EventStream build() {
// return new EventStream(events, href, actuate, schemeIdUri, value, timescale, messageData);
// }
// }
// }
// Path: validator/src/main/java/io/lindstrom/mpd/validator/rules/EventStreamValidator.java
import io.lindstrom.mpd.data.EventStream;
import java.util.Arrays;
import java.util.List;
package io.lindstrom.mpd.validator.rules;
public class EventStreamValidator {
/*
*
* R16.*: Check the conformance of SegmentList
*
*/
@ValidationRule("if (@actuate and not(@href)) then false() else true()") | private static Violation ruleR160(EventStream eventStream) { |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/Profiles.java | // Path: parser/src/main/java/io/lindstrom/mpd/support/ProfilesDeserializer.java
// public class ProfilesDeserializer extends JsonDeserializer<Profiles> {
// @Override
// public Profiles deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
// String text = p.getText();
//
// List<Profile> profiles = new ArrayList<>();
// List<String> others = new ArrayList<>();
//
// for (String identifier : text.split(",")) {
// identifier = identifier.trim();
//
// try {
// profiles.add(Profile.fromIdentifier(identifier));
// } catch (IllegalArgumentException e) {
// others.add(identifier);
// }
// }
//
// return new Profiles(profiles, others);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/ProfilesSerializer.java
// public class ProfilesSerializer extends JsonSerializer<Profiles> {
// @Override
// public void serialize(Profiles value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// List<String> list = new ArrayList<>();
// value.getProfiles().forEach(profile -> list.add(profile.toString()));
// list.addAll(value.getInteroperabilityPointsAndExtensions());
// gen.writeString(String.join(",", list));
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.lindstrom.mpd.support.ProfilesDeserializer;
import io.lindstrom.mpd.support.ProfilesSerializer;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
@JsonSerialize(using = ProfilesSerializer.class)
@JsonDeserialize(using = ProfilesDeserializer.class)
public class Profiles {
private final List<Profile> profiles;
private final List<String> interoperabilityPointsAndExtensions;
public Profiles(List<Profile> profiles, List<String> interoperabilityPointsAndExtensions) {
this.profiles = profiles;
this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
}
Profiles() {
this.profiles = null;
this.interoperabilityPointsAndExtensions = null;
}
public List<Profile> getProfiles() { | // Path: parser/src/main/java/io/lindstrom/mpd/support/ProfilesDeserializer.java
// public class ProfilesDeserializer extends JsonDeserializer<Profiles> {
// @Override
// public Profiles deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
// String text = p.getText();
//
// List<Profile> profiles = new ArrayList<>();
// List<String> others = new ArrayList<>();
//
// for (String identifier : text.split(",")) {
// identifier = identifier.trim();
//
// try {
// profiles.add(Profile.fromIdentifier(identifier));
// } catch (IllegalArgumentException e) {
// others.add(identifier);
// }
// }
//
// return new Profiles(profiles, others);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/ProfilesSerializer.java
// public class ProfilesSerializer extends JsonSerializer<Profiles> {
// @Override
// public void serialize(Profiles value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// List<String> list = new ArrayList<>();
// value.getProfiles().forEach(profile -> list.add(profile.toString()));
// list.addAll(value.getInteroperabilityPointsAndExtensions());
// gen.writeString(String.join(",", list));
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/Profiles.java
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.lindstrom.mpd.support.ProfilesDeserializer;
import io.lindstrom.mpd.support.ProfilesSerializer;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
@JsonSerialize(using = ProfilesSerializer.class)
@JsonDeserialize(using = ProfilesDeserializer.class)
public class Profiles {
private final List<Profile> profiles;
private final List<String> interoperabilityPointsAndExtensions;
public Profiles(List<Profile> profiles, List<String> interoperabilityPointsAndExtensions) {
this.profiles = profiles;
this.interoperabilityPointsAndExtensions = interoperabilityPointsAndExtensions;
}
Profiles() {
this.profiles = null;
this.interoperabilityPointsAndExtensions = null;
}
public List<Profile> getProfiles() { | return Utils.unmodifiableList(profiles); |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/Metrics.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
public class Metrics {
@JacksonXmlProperty(localName = "Reporting", namespace = MPD.NAMESPACE) | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/Metrics.java
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
public class Metrics {
@JacksonXmlProperty(localName = "Reporting", namespace = MPD.NAMESPACE) | private final List<Descriptor> reportings; |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/Metrics.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
public class Metrics {
@JacksonXmlProperty(localName = "Reporting", namespace = MPD.NAMESPACE)
private final List<Descriptor> reportings;
@JacksonXmlProperty(localName = "Range", namespace = MPD.NAMESPACE)
private final List<Range> ranges;
@JacksonXmlProperty(isAttribute = true)
private final String metrics;
private Metrics(List<Descriptor> reportings, List<Range> ranges, String metrics) {
this.reportings = reportings;
this.ranges = ranges;
this.metrics = metrics;
}
@SuppressWarnings("unused")
private Metrics() {
this.reportings = null;
this.ranges = null;
this.metrics = null;
}
public List<Descriptor> getReportings() { | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/Metrics.java
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
public class Metrics {
@JacksonXmlProperty(localName = "Reporting", namespace = MPD.NAMESPACE)
private final List<Descriptor> reportings;
@JacksonXmlProperty(localName = "Range", namespace = MPD.NAMESPACE)
private final List<Range> ranges;
@JacksonXmlProperty(isAttribute = true)
private final String metrics;
private Metrics(List<Descriptor> reportings, List<Range> ranges, String metrics) {
this.reportings = reportings;
this.ranges = ranges;
this.metrics = metrics;
}
@SuppressWarnings("unused")
private Metrics() {
this.reportings = null;
this.ranges = null;
this.metrics = null;
}
public List<Descriptor> getReportings() { | return Utils.unmodifiableList(reportings); |
carlanton/mpd-tools | parser/src/test/java/io/lindstrom/mpd/data/DataTypeTest.java | // Path: parser/src/main/java/io/lindstrom/mpd/MPDParser.java
// public class MPDParser {
//
// private final ObjectMapper objectMapper;
//
// public MPDParser() {
// this(defaultObjectMapper());
// }
//
// public MPDParser(ObjectMapper objectMapper) {
// this.objectMapper = objectMapper;
// }
//
// public MPD parse(InputStream inputStream) throws IOException {
// return objectMapper.readValue(inputStream, MPD.class);
// }
//
// public MPD parse(String content) throws IOException {
// return objectMapper.readValue(content, MPD.class);
// }
//
// public String writeAsString(MPD mpd) throws JsonProcessingException {
// return objectMapper.writeValueAsString(mpd);
// }
//
// public byte[] writeAsBytes(MPD mpd) throws JsonProcessingException {
// return objectMapper.writeValueAsBytes(mpd);
// }
//
// public static ObjectMapper defaultObjectMapper() {
// JacksonXmlModule module = new JacksonXmlModule();
// module.setDefaultUseWrapper(false);
// module.addSerializer(OffsetDateTime.class, new OffsetDateTimeSerializer())
// .addDeserializer(OffsetDateTime.class, new OffsetDateTimeDeserializer())
// .addSerializer(Duration.class, new DurationSerializer())
// .addDeserializer(Duration.class, new DurationDeserializer());
//
// return new XmlMapper(new XmlFactory(new WstxInputFactory(), new WstxPrefixedOutputFactory()), module)
// .enable(SerializationFeature.INDENT_OUTPUT)
// .setSerializationInclusion(JsonInclude.Include.NON_NULL)
// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
// .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true)
// .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
// .setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE);
// }
//
// private static class WstxPrefixedOutputFactory extends WstxOutputFactory {
// @Override
// protected XMLStreamWriter2 createSW(String enc, WriterConfig cfg, XmlWriter xw) {
// XMLStreamWriter2 streamWriter = super.createSW(enc, cfg, xw);
// try {
// streamWriter.setPrefix("xsi", "http://www.w3.org/2001/XMLSchema-instance");
// streamWriter.setPrefix("xlink", "http://www.w3.org/1999/xlink");
// streamWriter.setPrefix("cenc", "urn:mpeg:cenc:2013");
// streamWriter.setPrefix("mspr", "urn:microsoft:playready");
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// return streamWriter;
// }
// }
// }
| import io.lindstrom.mpd.MPDParser;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*; | package io.lindstrom.mpd.data;
public class DataTypeTest {
private static final String PACKAGE = DataTypeTest.class.getPackage().getName();
@Test
public void rebuildMPD() throws Exception { | // Path: parser/src/main/java/io/lindstrom/mpd/MPDParser.java
// public class MPDParser {
//
// private final ObjectMapper objectMapper;
//
// public MPDParser() {
// this(defaultObjectMapper());
// }
//
// public MPDParser(ObjectMapper objectMapper) {
// this.objectMapper = objectMapper;
// }
//
// public MPD parse(InputStream inputStream) throws IOException {
// return objectMapper.readValue(inputStream, MPD.class);
// }
//
// public MPD parse(String content) throws IOException {
// return objectMapper.readValue(content, MPD.class);
// }
//
// public String writeAsString(MPD mpd) throws JsonProcessingException {
// return objectMapper.writeValueAsString(mpd);
// }
//
// public byte[] writeAsBytes(MPD mpd) throws JsonProcessingException {
// return objectMapper.writeValueAsBytes(mpd);
// }
//
// public static ObjectMapper defaultObjectMapper() {
// JacksonXmlModule module = new JacksonXmlModule();
// module.setDefaultUseWrapper(false);
// module.addSerializer(OffsetDateTime.class, new OffsetDateTimeSerializer())
// .addDeserializer(OffsetDateTime.class, new OffsetDateTimeDeserializer())
// .addSerializer(Duration.class, new DurationSerializer())
// .addDeserializer(Duration.class, new DurationDeserializer());
//
// return new XmlMapper(new XmlFactory(new WstxInputFactory(), new WstxPrefixedOutputFactory()), module)
// .enable(SerializationFeature.INDENT_OUTPUT)
// .setSerializationInclusion(JsonInclude.Include.NON_NULL)
// .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
// .configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE, true)
// .setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)
// .setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE);
// }
//
// private static class WstxPrefixedOutputFactory extends WstxOutputFactory {
// @Override
// protected XMLStreamWriter2 createSW(String enc, WriterConfig cfg, XmlWriter xw) {
// XMLStreamWriter2 streamWriter = super.createSW(enc, cfg, xw);
// try {
// streamWriter.setPrefix("xsi", "http://www.w3.org/2001/XMLSchema-instance");
// streamWriter.setPrefix("xlink", "http://www.w3.org/1999/xlink");
// streamWriter.setPrefix("cenc", "urn:mpeg:cenc:2013");
// streamWriter.setPrefix("mspr", "urn:microsoft:playready");
// } catch (Exception e) {
// throw new RuntimeException(e);
// }
// return streamWriter;
// }
// }
// }
// Path: parser/src/test/java/io/lindstrom/mpd/data/DataTypeTest.java
import io.lindstrom.mpd.MPDParser;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.junit.jupiter.api.Test;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
package io.lindstrom.mpd.data;
public class DataTypeTest {
private static final String PACKAGE = DataTypeTest.class.getPackage().getName();
@Test
public void rebuildMPD() throws Exception { | MPD mpd = new MPDParser().parse(Files.newInputStream(Paths.get("src/test/resources/random.mpd"))); |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/ContentComponent.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"accessibility",
"role",
"rating",
"viewpoint",
"any"
})
public class ContentComponent {
@JacksonXmlProperty(localName = "Accessibility", namespace = MPD.NAMESPACE) | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/ContentComponent.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"accessibility",
"role",
"rating",
"viewpoint",
"any"
})
public class ContentComponent {
@JacksonXmlProperty(localName = "Accessibility", namespace = MPD.NAMESPACE) | private final List<Descriptor> accessibilities; |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/ContentComponent.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | @JacksonXmlProperty(isAttribute = true)
private final String contentType;
@JacksonXmlProperty(isAttribute = true)
private final Ratio par;
private ContentComponent(List<Descriptor> accessibilities, List<Descriptor> roles, List<Descriptor> ratings, List<Descriptor> viewpoints, Long id, String lang, String contentType, Ratio par) {
this.accessibilities = accessibilities;
this.roles = roles;
this.ratings = ratings;
this.viewpoints = viewpoints;
this.id = id;
this.lang = lang;
this.contentType = contentType;
this.par = par;
}
@SuppressWarnings("unused")
private ContentComponent() {
this.accessibilities = null;
this.roles = null;
this.ratings = null;
this.viewpoints = null;
this.id = null;
this.lang = null;
this.contentType = null;
this.par = null;
}
public List<Descriptor> getAccessibilities() { | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/ContentComponent.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
@JacksonXmlProperty(isAttribute = true)
private final String contentType;
@JacksonXmlProperty(isAttribute = true)
private final Ratio par;
private ContentComponent(List<Descriptor> accessibilities, List<Descriptor> roles, List<Descriptor> ratings, List<Descriptor> viewpoints, Long id, String lang, String contentType, Ratio par) {
this.accessibilities = accessibilities;
this.roles = roles;
this.ratings = ratings;
this.viewpoints = viewpoints;
this.id = id;
this.lang = lang;
this.contentType = contentType;
this.par = par;
}
@SuppressWarnings("unused")
private ContentComponent() {
this.accessibilities = null;
this.roles = null;
this.ratings = null;
this.viewpoints = null;
this.id = null;
this.lang = null;
this.contentType = null;
this.par = null;
}
public List<Descriptor> getAccessibilities() { | return Utils.unmodifiableList(accessibilities); |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/SegmentList.java | // Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects; | }
@SuppressWarnings("unused")
private SegmentList() {
this.initialization = null;
this.representationIndex = null;
this.segmentTimeline = null;
this.bitstreamswitchingElement = null;
this.segmentURLs = null;
this.duration = null;
this.startNumber = null;
this.href = null;
this.actuate = null;
this.timescale = null;
this.presentationTimeOffset = null;
this.indexRange = null;
this.indexRangeExact = null;
this.availabilityTimeOffset = null;
this.availabilityTimeComplete = null;
}
public URLType getInitialization() {
return initialization;
}
public URLType getRepresentationIndex() {
return representationIndex;
}
public List<Segment> getSegmentTimeline() { | // Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/SegmentList.java
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.support.Utils;
import java.util.List;
import java.util.Objects;
}
@SuppressWarnings("unused")
private SegmentList() {
this.initialization = null;
this.representationIndex = null;
this.segmentTimeline = null;
this.bitstreamswitchingElement = null;
this.segmentURLs = null;
this.duration = null;
this.startNumber = null;
this.href = null;
this.actuate = null;
this.timescale = null;
this.presentationTimeOffset = null;
this.indexRange = null;
this.indexRangeExact = null;
this.availabilityTimeOffset = null;
this.availabilityTimeComplete = null;
}
public URLType getInitialization() {
return initialization;
}
public URLType getRepresentationIndex() {
return representationIndex;
}
public List<Segment> getSegmentTimeline() { | return Utils.unmodifiableList(segmentTimeline); |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/Period.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"id",
"baseURLs",
"segmentBase",
"segmentList",
"segmentTemplate",
"assetIdentifier",
"eventStreams",
"adaptationSets",
"subsets",
"supplementalProperties"
})
public class Period {
@JacksonXmlProperty(localName = "BaseURL", namespace = MPD.NAMESPACE)
private final List<BaseURL> baseURLs;
@JacksonXmlProperty(localName = "SegmentBase", namespace = MPD.NAMESPACE)
private final SegmentBase segmentBase;
@JacksonXmlProperty(localName = "SegmentList", namespace = MPD.NAMESPACE)
private final SegmentList segmentList;
@JacksonXmlProperty(localName = "SegmentTemplate", namespace = MPD.NAMESPACE)
private final SegmentTemplate segmentTemplate;
@JacksonXmlProperty(localName = "AssetIdentifier", namespace = MPD.NAMESPACE) | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/Period.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"id",
"baseURLs",
"segmentBase",
"segmentList",
"segmentTemplate",
"assetIdentifier",
"eventStreams",
"adaptationSets",
"subsets",
"supplementalProperties"
})
public class Period {
@JacksonXmlProperty(localName = "BaseURL", namespace = MPD.NAMESPACE)
private final List<BaseURL> baseURLs;
@JacksonXmlProperty(localName = "SegmentBase", namespace = MPD.NAMESPACE)
private final SegmentBase segmentBase;
@JacksonXmlProperty(localName = "SegmentList", namespace = MPD.NAMESPACE)
private final SegmentList segmentList;
@JacksonXmlProperty(localName = "SegmentTemplate", namespace = MPD.NAMESPACE)
private final SegmentTemplate segmentTemplate;
@JacksonXmlProperty(localName = "AssetIdentifier", namespace = MPD.NAMESPACE) | private final Descriptor assetIdentifier; |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/Period.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.util.List;
import java.util.Objects; | this.subsets = subsets;
this.supplementalProperties = supplementalProperties;
this.href = href;
this.actuate = actuate;
this.id = id;
this.start = start;
this.duration = duration;
this.bitstreamSwitching = bitstreamSwitching;
}
@SuppressWarnings("unused")
private Period() {
this.baseURLs = null;
this.segmentBase = null;
this.segmentList = null;
this.segmentTemplate = null;
this.assetIdentifier = null;
this.eventStreams = null;
this.adaptationSets = null;
this.subsets = null;
this.supplementalProperties = null;
this.href = null;
this.actuate = null;
this.id = null;
this.start = null;
this.duration = null;
this.bitstreamSwitching = null;
}
public List<BaseURL> getBaseURLs() { | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/Period.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.util.List;
import java.util.Objects;
this.subsets = subsets;
this.supplementalProperties = supplementalProperties;
this.href = href;
this.actuate = actuate;
this.id = id;
this.start = start;
this.duration = duration;
this.bitstreamSwitching = bitstreamSwitching;
}
@SuppressWarnings("unused")
private Period() {
this.baseURLs = null;
this.segmentBase = null;
this.segmentList = null;
this.segmentTemplate = null;
this.assetIdentifier = null;
this.eventStreams = null;
this.adaptationSets = null;
this.subsets = null;
this.supplementalProperties = null;
this.href = null;
this.actuate = null;
this.id = null;
this.start = null;
this.duration = null;
this.bitstreamSwitching = null;
}
public List<BaseURL> getBaseURLs() { | return Utils.unmodifiableList(baseURLs); |
carlanton/mpd-tools | validator/src/main/java/io/lindstrom/mpd/validator/rules/MPDValidator.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
| import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors; | "(@schemeIdUri = 'urn:mpeg:dash:utc:http-iso:2014') or (@schemeIdUri = 'urn:mpeg:dash:utc:http-ntp:2014') or " +
"(@schemeIdUri = 'urn:mpeg:dash:utc:direct:2014')) then true() else false()")
private static Violation ruleR181(UTCTiming utcTiming) {
// We are using an enum here, so this test is not needed.
return Violation.empty();
}
public static List<Violation> validate(MPD mpd) {
List<Violation> violations = new ArrayList<>();
violations.addAll(Arrays.asList(
ruleR10(mpd),
ruleR11(mpd),
ruleR12(mpd),
ruleR14(mpd),
ruleR15(mpd),
ruleR16(mpd),
ruleR17(mpd),
ruleR18(mpd),
ruleR19(mpd),
ruleRD10(mpd),
ruleR110(mpd)));
for (Period period : mpd.getPeriods()) {
violations.addAll(PeriodValidator.validate(mpd, period));
}
for (UTCTiming utcTiming : mpd.getUtcTimings()) {
violations.add(ruleR181(utcTiming));
}
| // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
// Path: validator/src/main/java/io/lindstrom/mpd/validator/rules/MPDValidator.java
import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
"(@schemeIdUri = 'urn:mpeg:dash:utc:http-iso:2014') or (@schemeIdUri = 'urn:mpeg:dash:utc:http-ntp:2014') or " +
"(@schemeIdUri = 'urn:mpeg:dash:utc:direct:2014')) then true() else false()")
private static Violation ruleR181(UTCTiming utcTiming) {
// We are using an enum here, so this test is not needed.
return Violation.empty();
}
public static List<Violation> validate(MPD mpd) {
List<Violation> violations = new ArrayList<>();
violations.addAll(Arrays.asList(
ruleR10(mpd),
ruleR11(mpd),
ruleR12(mpd),
ruleR14(mpd),
ruleR15(mpd),
ruleR16(mpd),
ruleR17(mpd),
ruleR18(mpd),
ruleR19(mpd),
ruleRD10(mpd),
ruleR110(mpd)));
for (Period period : mpd.getPeriods()) {
violations.addAll(PeriodValidator.validate(mpd, period));
}
for (UTCTiming utcTiming : mpd.getUtcTimings()) {
violations.add(ruleR181(utcTiming));
}
| for (Descriptor descriptor : mpd.getSupplementalProperties()) { |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/MPD.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects; | package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"programInformations",
"baseURLs",
"locations",
"periods",
"metrics",
"essentialProperties",
"supplementalProperties",
"utcTimings"
})
@JacksonXmlRootElement(localName = "MPD", namespace = io.lindstrom.mpd.data.MPD.NAMESPACE)
public class MPD {
static final String NAMESPACE = "urn:mpeg:dash:schema:mpd:2011";
@JacksonXmlProperty(localName = "ProgramInformation", namespace = NAMESPACE)
private final List<ProgramInformation> programInformations;
@JacksonXmlProperty(localName = "BaseURL", namespace = NAMESPACE)
private final List<BaseURL> baseURLs;
@JacksonXmlProperty(localName = "Location", namespace = NAMESPACE)
private final List<String> locations;
@JacksonXmlProperty(localName = "Period", namespace = NAMESPACE)
private final List<Period> periods;
@JacksonXmlProperty(localName = "Metrics", namespace = NAMESPACE)
private final List<Metrics> metrics;
@JacksonXmlProperty(localName = "EssentialProperty", namespace = NAMESPACE) | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/MPD.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
package io.lindstrom.mpd.data;
@JsonPropertyOrder({
"programInformations",
"baseURLs",
"locations",
"periods",
"metrics",
"essentialProperties",
"supplementalProperties",
"utcTimings"
})
@JacksonXmlRootElement(localName = "MPD", namespace = io.lindstrom.mpd.data.MPD.NAMESPACE)
public class MPD {
static final String NAMESPACE = "urn:mpeg:dash:schema:mpd:2011";
@JacksonXmlProperty(localName = "ProgramInformation", namespace = NAMESPACE)
private final List<ProgramInformation> programInformations;
@JacksonXmlProperty(localName = "BaseURL", namespace = NAMESPACE)
private final List<BaseURL> baseURLs;
@JacksonXmlProperty(localName = "Location", namespace = NAMESPACE)
private final List<String> locations;
@JacksonXmlProperty(localName = "Period", namespace = NAMESPACE)
private final List<Period> periods;
@JacksonXmlProperty(localName = "Metrics", namespace = NAMESPACE)
private final List<Metrics> metrics;
@JacksonXmlProperty(localName = "EssentialProperty", namespace = NAMESPACE) | private final List<Descriptor> essentialProperties; |
carlanton/mpd-tools | parser/src/main/java/io/lindstrom/mpd/data/MPD.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
| import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects; | this.maxSubsegmentDuration = maxSubsegmentDuration;
}
@SuppressWarnings("unused")
private MPD() {
this.programInformations = null;
this.baseURLs = null;
this.locations = null;
this.periods = null;
this.metrics = null;
this.essentialProperties = null;
this.supplementalProperties = null;
this.utcTimings = null;
this.id = null;
this.profiles = null;
this.type = null;
this.availabilityStartTime = null;
this.availabilityEndTime = null;
this.publishTime = null;
this.mediaPresentationDuration = null;
this.minimumUpdatePeriod = null;
this.minBufferTime = null;
this.timeShiftBufferDepth = null;
this.suggestedPresentationDelay = null;
this.maxSegmentDuration = null;
this.maxSubsegmentDuration = null;
this.schemaLocation = null;
}
public List<ProgramInformation> getProgramInformations() { | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
//
// Path: parser/src/main/java/io/lindstrom/mpd/support/Utils.java
// public class Utils {
// public static <T> List<T> unmodifiableList(List<T> list) {
// if (list == null) {
// return List.of();
// } else {
// return List.copyOf(list);
// }
// }
//
// @SafeVarargs
// public static <T> List<T> varargsToList(T head, T ...tail) {
// if (tail.length == 0) {
// return List.of(head);
// } else {
// List<T> list = new ArrayList<>();
// list.add(head);
// list.addAll(List.of(tail));
// return List.copyOf(list);
// }
// }
// }
// Path: parser/src/main/java/io/lindstrom/mpd/data/MPD.java
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import io.lindstrom.mpd.support.Utils;
import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
this.maxSubsegmentDuration = maxSubsegmentDuration;
}
@SuppressWarnings("unused")
private MPD() {
this.programInformations = null;
this.baseURLs = null;
this.locations = null;
this.periods = null;
this.metrics = null;
this.essentialProperties = null;
this.supplementalProperties = null;
this.utcTimings = null;
this.id = null;
this.profiles = null;
this.type = null;
this.availabilityStartTime = null;
this.availabilityEndTime = null;
this.publishTime = null;
this.mediaPresentationDuration = null;
this.minimumUpdatePeriod = null;
this.minBufferTime = null;
this.timeShiftBufferDepth = null;
this.suggestedPresentationDelay = null;
this.maxSegmentDuration = null;
this.maxSubsegmentDuration = null;
this.schemaLocation = null;
}
public List<ProgramInformation> getProgramInformations() { | return Utils.unmodifiableList(programInformations); |
carlanton/mpd-tools | validator/src/main/java/io/lindstrom/mpd/validator/rules/PeriodValidator.java | // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
| import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors; | ruleR20(period),
ruleR21(mpd),
ruleR23(period),
ruleR24(period, mpd),
ruleR251(period),
ruleR252(period),
ruleRD20(period, mpd),
ruleRD21(period, mpd),
ruleR171(period)));
for (EventStream eventStream : period.getEventStreams()) {
violations.addAll(EventStreamValidator.validate(eventStream));
}
if (period.getSegmentTemplate() != null) {
violations.addAll(SegmentTemplateValidator.validate(mpd, period.getSegmentTemplate()));
}
if (period.getSegmentList() != null) {
violations.addAll(SegmentListValidator.validate(mpd, period.getSegmentList()));
}
if (period.getSegmentBase() != null) {
violations.addAll(SegmentBaseValidator.validate(mpd, period.getSegmentBase()));
}
for (AdaptationSet adaptationSet : period.getAdaptationSets()) {
violations.addAll(AdaptationSetValidator.validate(mpd, period, adaptationSet));
}
| // Path: parser/src/main/java/io/lindstrom/mpd/data/descriptor/Descriptor.java
// @JsonTypeInfo(
// use = JsonTypeInfo.Id.NAME,
// property = "schemeIdUri",
// include = JsonTypeInfo.As.EXISTING_PROPERTY,
// visible = true,
// defaultImpl = GenericDescriptor.class)
// @JsonSubTypes({
// @JsonSubTypes.Type(value = Role.class, name = Role.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = Mp4Protection.class, name = Mp4Protection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = PlayReadyContentProtection.class, name = PlayReadyContentProtection.SCHEME_ID_URI),
// @JsonSubTypes.Type(value = WidewineProtection.class, name = WidewineProtection.SCHEME_ID_URI)
// })
// public abstract class Descriptor {
// @JacksonXmlProperty(isAttribute = true)
// protected final String schemeIdUri;
//
// @JacksonXmlProperty(isAttribute = true)
// protected final String id;
//
// protected Descriptor(String schemeIdUri, String id) {
// this.schemeIdUri = schemeIdUri;
// this.id = id;
// }
//
// public String getSchemeIdUri() {
// return schemeIdUri;
// }
//
// public String getId() {
// return id;
// }
//
// @JsonIgnore
// public abstract String getValue();
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Descriptor)) return false;
// Descriptor that = (Descriptor) o;
// return Objects.equals(schemeIdUri, that.schemeIdUri) &&
// Objects.equals(id, that.id);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(schemeIdUri, id);
// }
// }
// Path: validator/src/main/java/io/lindstrom/mpd/validator/rules/PeriodValidator.java
import io.lindstrom.mpd.data.*;
import io.lindstrom.mpd.data.descriptor.Descriptor;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
ruleR20(period),
ruleR21(mpd),
ruleR23(period),
ruleR24(period, mpd),
ruleR251(period),
ruleR252(period),
ruleRD20(period, mpd),
ruleRD21(period, mpd),
ruleR171(period)));
for (EventStream eventStream : period.getEventStreams()) {
violations.addAll(EventStreamValidator.validate(eventStream));
}
if (period.getSegmentTemplate() != null) {
violations.addAll(SegmentTemplateValidator.validate(mpd, period.getSegmentTemplate()));
}
if (period.getSegmentList() != null) {
violations.addAll(SegmentListValidator.validate(mpd, period.getSegmentList()));
}
if (period.getSegmentBase() != null) {
violations.addAll(SegmentBaseValidator.validate(mpd, period.getSegmentBase()));
}
for (AdaptationSet adaptationSet : period.getAdaptationSets()) {
violations.addAll(AdaptationSetValidator.validate(mpd, period, adaptationSet));
}
| for (Descriptor supplementalProperty : mpd.getSupplementalProperties()) { |
Justice-love/tiger | tiger/src/main/java/org/eddy/tiger/context/AbstractContext.java | // Path: tiger/src/main/java/org/eddy/tiger/TigerBean.java
// public interface TigerBean<T> extends Bean<T> {
//
// boolean isRight(String name, Type type);
//
// boolean isConstructor();
//
// ConstructorInjectionPoint getConstructorInjectionPoint();
// }
| import java.lang.annotation.Annotation;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
import org.eddy.tiger.TigerBean; | /**
*
* @creatTime 上午10:56:43
* @author Eddy
*/
package org.eddy.tiger.context;
/**
* @author Eddy
*
*/
public abstract class AbstractContext implements Context {
private Class<? extends Annotation> scop;
/**
* 构造函数
*
* @creatTime 上午11:07:09
* @author Eddy
*/
public AbstractContext() {
}
/**
* 构造函数
*
* @creatTime 上午11:07:09
* @author Eddy
*/
public AbstractContext(Class<? extends Annotation> scop) {
this.scop = scop;
}
/**
* 通过bean name 获取bean
* @param name
* @return
* @creatTime 下午4:07:21
* @author Eddy
*/ | // Path: tiger/src/main/java/org/eddy/tiger/TigerBean.java
// public interface TigerBean<T> extends Bean<T> {
//
// boolean isRight(String name, Type type);
//
// boolean isConstructor();
//
// ConstructorInjectionPoint getConstructorInjectionPoint();
// }
// Path: tiger/src/main/java/org/eddy/tiger/context/AbstractContext.java
import java.lang.annotation.Annotation;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
import org.eddy.tiger.TigerBean;
/**
*
* @creatTime 上午10:56:43
* @author Eddy
*/
package org.eddy.tiger.context;
/**
* @author Eddy
*
*/
public abstract class AbstractContext implements Context {
private Class<? extends Annotation> scop;
/**
* 构造函数
*
* @creatTime 上午11:07:09
* @author Eddy
*/
public AbstractContext() {
}
/**
* 构造函数
*
* @creatTime 上午11:07:09
* @author Eddy
*/
public AbstractContext(Class<? extends Annotation> scop) {
this.scop = scop;
}
/**
* 通过bean name 获取bean
* @param name
* @return
* @creatTime 下午4:07:21
* @author Eddy
*/ | public abstract TigerBean<?> getByName(String name); |
Justice-love/tiger | tiger/src/main/java/org/eddy/tiger/TigerBean.java | // Path: tiger/src/main/java/org/eddy/tiger/point/ConstructorInjectionPoint.java
// public class ConstructorInjectionPoint extends AbstractInjectionPoint {
//
// /**
// * 构造函数
// * @param annotated
// * @creatTime 下午5:42:51
// * @author Eddy
// */
// public ConstructorInjectionPoint(Annotated annotated) {
// super(annotated, AbstractInjectionPoint.CLOSED);
// // TODO Auto-generated constructor stub
// }
//
// /* (non-Javadoc)
// * @see javax.enterprise.inject.spi.InjectionPoint#getMember()
// */
// @Override
// public Member getMember() {
// return ((AnnotatedConstructor<?>)super.annotated).getJavaMember();
// }
//
// }
| import javax.enterprise.inject.spi.Bean;
import org.eddy.tiger.point.ConstructorInjectionPoint;
import java.lang.reflect.Type; | /**
*
* @creatTime 上午11:38:55
* @author Eddy
*/
package org.eddy.tiger;
/**
* @author Eddy
*
*/
public interface TigerBean<T> extends Bean<T> {
boolean isRight(String name, Type type);
boolean isConstructor();
| // Path: tiger/src/main/java/org/eddy/tiger/point/ConstructorInjectionPoint.java
// public class ConstructorInjectionPoint extends AbstractInjectionPoint {
//
// /**
// * 构造函数
// * @param annotated
// * @creatTime 下午5:42:51
// * @author Eddy
// */
// public ConstructorInjectionPoint(Annotated annotated) {
// super(annotated, AbstractInjectionPoint.CLOSED);
// // TODO Auto-generated constructor stub
// }
//
// /* (non-Javadoc)
// * @see javax.enterprise.inject.spi.InjectionPoint#getMember()
// */
// @Override
// public Member getMember() {
// return ((AnnotatedConstructor<?>)super.annotated).getJavaMember();
// }
//
// }
// Path: tiger/src/main/java/org/eddy/tiger/TigerBean.java
import javax.enterprise.inject.spi.Bean;
import org.eddy.tiger.point.ConstructorInjectionPoint;
import java.lang.reflect.Type;
/**
*
* @creatTime 上午11:38:55
* @author Eddy
*/
package org.eddy.tiger;
/**
* @author Eddy
*
*/
public interface TigerBean<T> extends Bean<T> {
boolean isRight(String name, Type type);
boolean isConstructor();
| ConstructorInjectionPoint getConstructorInjectionPoint(); |
Justice-love/tiger | tiger/src/main/java/org/eddy/tiger/context/CreationalContextImpl.java | // Path: tiger/src/main/java/org/eddy/tiger/TigerBean.java
// public interface TigerBean<T> extends Bean<T> {
//
// boolean isRight(String name, Type type);
//
// boolean isConstructor();
//
// ConstructorInjectionPoint getConstructorInjectionPoint();
// }
| import java.util.HashSet;
import java.util.Set;
import org.eddy.tiger.TigerBean;
import java.lang.reflect.Type; | /**
*
* @creatTime 上午11:35:28
* @author Eddy
*/
package org.eddy.tiger.context;
/**
* @author Eddy
*
*/
public class CreationalContextImpl<T> implements TigerCreationalContext<T> {
private Set<T> incompleteInstances = new HashSet<>();
private AbstractContext context;
/**
* 构造函数
* @creatTime 上午9:18:42
* @author Eddy
*/
public CreationalContextImpl(AbstractContext context) {
this.context = context;
}
/*
* (non-Javadoc)
*
* @see
* javax.enterprise.context.spi.CreationalContext#push(java.lang.Object)
*/
@Override
public void push(T incompleteInstance) {
incompleteInstances.add(incompleteInstance);
}
/*
* (non-Javadoc)
*
* @see javax.enterprise.context.spi.CreationalContext#release()
*/
@Override
public void release() {
this.incompleteInstances.clear();
}
/*
* (non-Javadoc)
*
* @see org.eddy.tiger.context.TigerCreationalContext#get(java.lang.String)
*/
@Override
public T get(String name) {
for (T bean : incompleteInstances) { | // Path: tiger/src/main/java/org/eddy/tiger/TigerBean.java
// public interface TigerBean<T> extends Bean<T> {
//
// boolean isRight(String name, Type type);
//
// boolean isConstructor();
//
// ConstructorInjectionPoint getConstructorInjectionPoint();
// }
// Path: tiger/src/main/java/org/eddy/tiger/context/CreationalContextImpl.java
import java.util.HashSet;
import java.util.Set;
import org.eddy.tiger.TigerBean;
import java.lang.reflect.Type;
/**
*
* @creatTime 上午11:35:28
* @author Eddy
*/
package org.eddy.tiger.context;
/**
* @author Eddy
*
*/
public class CreationalContextImpl<T> implements TigerCreationalContext<T> {
private Set<T> incompleteInstances = new HashSet<>();
private AbstractContext context;
/**
* 构造函数
* @creatTime 上午9:18:42
* @author Eddy
*/
public CreationalContextImpl(AbstractContext context) {
this.context = context;
}
/*
* (non-Javadoc)
*
* @see
* javax.enterprise.context.spi.CreationalContext#push(java.lang.Object)
*/
@Override
public void push(T incompleteInstance) {
incompleteInstances.add(incompleteInstance);
}
/*
* (non-Javadoc)
*
* @see javax.enterprise.context.spi.CreationalContext#release()
*/
@Override
public void release() {
this.incompleteInstances.clear();
}
/*
* (non-Javadoc)
*
* @see org.eddy.tiger.context.TigerCreationalContext#get(java.lang.String)
*/
@Override
public T get(String name) {
for (T bean : incompleteInstances) { | if (((TigerBean<?>) bean).isRight(name, null)) { |
Justice-love/tiger | tiger/src/main/java/org/eddy/tiger/annotated/impl/AnnotatedTypeImpl.java | // Path: tiger/src/main/java/org/eddy/tiger/util/Reflects.java
// public class Reflects {
//
// /**
// * 获取当前class及父class的属性列表
// *
// * @param glass
// * @return
// * @creatTime 下午2:31:34
// * @author Eddy
// */
// public static Set<Field> getFields(Class<?> glass) {
// if (null == glass)
// throw new IllegalArgumentException("glass 为空!");
// Set<Field> result = new HashSet<>(Arrays.asList(glass.getDeclaredFields()));
// Class<?> currentClass = glass.getSuperclass();
// while (currentClass != null && !currentClass.equals(Object.class)) {
// result.addAll(Arrays.asList(currentClass.getDeclaredFields()));
// currentClass = currentClass.getSuperclass();
// }
// return result;
// }
//
// /**
// * 获取当前class及父class的构造器列表
// * @param glass
// * @return
// * @creatTime 下午2:57:50
// * @author Eddy
// */
// public static Set<Constructor<?>> getConstructors(Class<?> glass) {
// if (null == glass)
// throw new IllegalArgumentException("glass 为空!");
// Set<Constructor<?>> result = new HashSet<>(Arrays.asList(glass.getDeclaredConstructors()));
// Class<?> currentClass = glass.getSuperclass();
// while (currentClass != null && !currentClass.equals(Object.class)) {
// result.addAll(Arrays.asList(currentClass.getDeclaredConstructors()));
// currentClass = currentClass.getSuperclass();
// }
// return result;
// }
//
// /**
// * 获取当前class及父class的方法列表
// * @param glass
// * @return
// * @creatTime 下午3:02:00
// * @author Eddy
// */
// public static Set<Method> getMethods(Class<?> glass) {
// if (null == glass)
// throw new IllegalArgumentException("glass 为空!");
// Set<Method> result = new HashSet<>(Arrays.asList(glass.getDeclaredMethods()));
// Class<?> currentClass = glass.getSuperclass();
// while (currentClass != null && !currentClass.equals(Object.class)) {
// result.addAll(Arrays.asList(currentClass.getDeclaredMethods()));
// currentClass = currentClass.getSuperclass();
// }
// return result;
// }
//
// }
| import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.inject.Inject;
import javax.inject.Named;
import org.eddy.tiger.util.Reflects; | * @creatTime 下午8:07:16
* @author Eddy
*/
@SuppressWarnings("unused")
@Deprecated
private boolean named(Annotation[][] annos) {
for (Annotation[] ann : annos) {
if (named(ann)) return true;
}
return false;
}
/**
* 构造函数
* @creatTime 下午3:44:05
* @author Eddy
*/
public AnnotatedTypeImpl(Class<X> glass) {
this.beanClass = glass;
initFields();
initConstructor();
initMethods();
}
/**
*
* @creatTime 下午2:05:20
* @author Eddy
*/
private void initMethods() { | // Path: tiger/src/main/java/org/eddy/tiger/util/Reflects.java
// public class Reflects {
//
// /**
// * 获取当前class及父class的属性列表
// *
// * @param glass
// * @return
// * @creatTime 下午2:31:34
// * @author Eddy
// */
// public static Set<Field> getFields(Class<?> glass) {
// if (null == glass)
// throw new IllegalArgumentException("glass 为空!");
// Set<Field> result = new HashSet<>(Arrays.asList(glass.getDeclaredFields()));
// Class<?> currentClass = glass.getSuperclass();
// while (currentClass != null && !currentClass.equals(Object.class)) {
// result.addAll(Arrays.asList(currentClass.getDeclaredFields()));
// currentClass = currentClass.getSuperclass();
// }
// return result;
// }
//
// /**
// * 获取当前class及父class的构造器列表
// * @param glass
// * @return
// * @creatTime 下午2:57:50
// * @author Eddy
// */
// public static Set<Constructor<?>> getConstructors(Class<?> glass) {
// if (null == glass)
// throw new IllegalArgumentException("glass 为空!");
// Set<Constructor<?>> result = new HashSet<>(Arrays.asList(glass.getDeclaredConstructors()));
// Class<?> currentClass = glass.getSuperclass();
// while (currentClass != null && !currentClass.equals(Object.class)) {
// result.addAll(Arrays.asList(currentClass.getDeclaredConstructors()));
// currentClass = currentClass.getSuperclass();
// }
// return result;
// }
//
// /**
// * 获取当前class及父class的方法列表
// * @param glass
// * @return
// * @creatTime 下午3:02:00
// * @author Eddy
// */
// public static Set<Method> getMethods(Class<?> glass) {
// if (null == glass)
// throw new IllegalArgumentException("glass 为空!");
// Set<Method> result = new HashSet<>(Arrays.asList(glass.getDeclaredMethods()));
// Class<?> currentClass = glass.getSuperclass();
// while (currentClass != null && !currentClass.equals(Object.class)) {
// result.addAll(Arrays.asList(currentClass.getDeclaredMethods()));
// currentClass = currentClass.getSuperclass();
// }
// return result;
// }
//
// }
// Path: tiger/src/main/java/org/eddy/tiger/annotated/impl/AnnotatedTypeImpl.java
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.inject.Inject;
import javax.inject.Named;
import org.eddy.tiger.util.Reflects;
* @creatTime 下午8:07:16
* @author Eddy
*/
@SuppressWarnings("unused")
@Deprecated
private boolean named(Annotation[][] annos) {
for (Annotation[] ann : annos) {
if (named(ann)) return true;
}
return false;
}
/**
* 构造函数
* @creatTime 下午3:44:05
* @author Eddy
*/
public AnnotatedTypeImpl(Class<X> glass) {
this.beanClass = glass;
initFields();
initConstructor();
initMethods();
}
/**
*
* @creatTime 下午2:05:20
* @author Eddy
*/
private void initMethods() { | Set<Method> set = Reflects.getMethods(this.beanClass); |
tatools/sunshine | sunshine-testng/src/main/java/org/tatools/sunshine/testng/PreparedTestNGSuite.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java
// @EqualsAndHashCode
// @ToString
// public class FileSystemPathBase implements FileSystemPath {
//
// private final Path directory;
// private final String file;
//
// public FileSystemPathBase(String path) {
// this(Paths.get(path));
// }
//
// public FileSystemPathBase(String directory, String file) {
// this(Paths.get(directory), file);
// }
//
// public FileSystemPathBase(Path path) {
// this(path, "");
// }
//
// public FileSystemPathBase(Directory directory, String fsPath) {
// this(directory.path(), fsPath);
// }
//
// public FileSystemPathBase(Path directory, String file) {
// this.directory = directory;
// this.file = file;
// }
//
// @Override
// public final Path path() {
// return directory.resolve(file);
// }
//
// @Override
// public final boolean exist() {
// return Files.exists(path());
// }
// }
| import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.FileSystemPathBase; | package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public class PreparedTestNGSuite implements TestNGSuite {
private final FileSystemPath fileSystemPath;
public PreparedTestNGSuite(String path) { | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPathBase.java
// @EqualsAndHashCode
// @ToString
// public class FileSystemPathBase implements FileSystemPath {
//
// private final Path directory;
// private final String file;
//
// public FileSystemPathBase(String path) {
// this(Paths.get(path));
// }
//
// public FileSystemPathBase(String directory, String file) {
// this(Paths.get(directory), file);
// }
//
// public FileSystemPathBase(Path path) {
// this(path, "");
// }
//
// public FileSystemPathBase(Directory directory, String fsPath) {
// this(directory.path(), fsPath);
// }
//
// public FileSystemPathBase(Path directory, String file) {
// this.directory = directory;
// this.file = file;
// }
//
// @Override
// public final Path path() {
// return directory.resolve(file);
// }
//
// @Override
// public final boolean exist() {
// return Files.exists(path());
// }
// }
// Path: sunshine-testng/src/main/java/org/tatools/sunshine/testng/PreparedTestNGSuite.java
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.FileSystemPathBase;
package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public class PreparedTestNGSuite implements TestNGSuite {
private final FileSystemPath fileSystemPath;
public PreparedTestNGSuite(String path) { | this(new FileSystemPathBase(path)); |
tatools/sunshine | sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5KernelTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
| import java.util.ArrayList;
import lombok.EqualsAndHashCode;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.junit.platform.engine.TestExecutionResult;
import org.junit.platform.launcher.TestExecutionListener;
import org.junit.platform.launcher.TestIdentifier;
import org.tatools.sunshine.core.KernelException; | package org.tatools.sunshine.junit5;
/**
* @author Dmytro Serdiuk
* @version $Id$
*/
public class Junit5KernelTest {
@Test | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-junit5/src/test/java/org/tatools/sunshine/junit5/Junit5KernelTest.java
import java.util.ArrayList;
import lombok.EqualsAndHashCode;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
import org.junit.platform.engine.TestExecutionResult;
import org.junit.platform.launcher.TestExecutionListener;
import org.junit.platform.launcher.TestIdentifier;
import org.tatools.sunshine.core.KernelException;
package org.tatools.sunshine.junit5;
/**
* @author Dmytro Serdiuk
* @version $Id$
*/
public class Junit5KernelTest {
@Test | public void run() throws KernelException { |
tatools/sunshine | sunshine-core/src/test/java/org/tatools/sunshine/core/SunTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Status.java
// final class Fake implements Status {
// private final short c;
// private final int r;
// private final int f;
// private final int i;
//
// public Fake() {
// this((short) 0, 5, 0, 1);
// }
//
// public Fake(short code, int total, int failed, int ignored) {
// this.c = code;
// this.r = total;
// this.f = failed;
// this.i = ignored;
// }
//
// @Override
// public short code() {
// return this.c;
// }
//
// @Override
// public int runCount() {
// return this.r;
// }
//
// @Override
// public int failureCount() {
// return this.f;
// }
//
// @Override
// public int ignoreCount() {
// return this.i;
// }
// }
| import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import org.tatools.sunshine.core.Status.Fake; | package org.tatools.sunshine.core;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class SunTest {
@Rule public final ExpectedSystemExit exit = ExpectedSystemExit.none();
@Test
public void shine() {
exit.expectSystemExitWithStatus(0); | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Status.java
// final class Fake implements Status {
// private final short c;
// private final int r;
// private final int f;
// private final int i;
//
// public Fake() {
// this((short) 0, 5, 0, 1);
// }
//
// public Fake(short code, int total, int failed, int ignored) {
// this.c = code;
// this.r = total;
// this.f = failed;
// this.i = ignored;
// }
//
// @Override
// public short code() {
// return this.c;
// }
//
// @Override
// public int runCount() {
// return this.r;
// }
//
// @Override
// public int failureCount() {
// return this.f;
// }
//
// @Override
// public int ignoreCount() {
// return this.i;
// }
// }
// Path: sunshine-core/src/test/java/org/tatools/sunshine/core/SunTest.java
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import org.tatools.sunshine.core.Status.Fake;
package org.tatools.sunshine.core;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class SunTest {
@Rule public final ExpectedSystemExit exit = ExpectedSystemExit.none();
@Test
public void shine() {
exit.expectSystemExitWithStatus(0); | new Sun(new Kernel.Fake(new Fake())).shine(); |
tatools/sunshine | sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGSuite.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Suite.java
// public interface Suite<D> {
//
// /**
// * Returns tests from the suite.
// *
// * @return a test or tests
// * @throws SuiteException if some error occurs
// */
// D tests() throws SuiteException;
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.Suite;
import org.tatools.sunshine.core.SuiteException; | package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public interface TestNGSuite extends Suite<FileSystemPath> {
/**
* Return a TestNG tests file.
*
* @return an instance of {@link FileSystemPath}.
* @throws SuiteException if some error occurs
*/
@Override | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Suite.java
// public interface Suite<D> {
//
// /**
// * Returns tests from the suite.
// *
// * @return a test or tests
// * @throws SuiteException if some error occurs
// */
// D tests() throws SuiteException;
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-testng/src/main/java/org/tatools/sunshine/testng/TestNGSuite.java
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.Suite;
import org.tatools.sunshine.core.SuiteException;
package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public interface TestNGSuite extends Suite<FileSystemPath> {
/**
* Return a TestNG tests file.
*
* @return an instance of {@link FileSystemPath}.
* @throws SuiteException if some error occurs
*/
@Override | FileSystemPath tests() throws SuiteException; |
tatools/sunshine | sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
| import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex; | package org.tatools.sunshine.junit4;
/**
* The {@link Sunshine} class is a main class to run Junit 4 tests.
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) { | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
// Path: sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java
import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex;
package org.tatools.sunshine.junit4;
/**
* The {@link Sunshine} class is a main class to run Junit 4 tests.
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) { | new Sun(new Junit4Kernel(new JunitSuite(new VerboseRegex(new RegexCondition())))).shine(); |
tatools/sunshine | sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
| import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex; | package org.tatools.sunshine.junit4;
/**
* The {@link Sunshine} class is a main class to run Junit 4 tests.
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) { | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
// Path: sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java
import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex;
package org.tatools.sunshine.junit4;
/**
* The {@link Sunshine} class is a main class to run Junit 4 tests.
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) { | new Sun(new Junit4Kernel(new JunitSuite(new VerboseRegex(new RegexCondition())))).shine(); |
tatools/sunshine | sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
| import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex; | package org.tatools.sunshine.junit4;
/**
* The {@link Sunshine} class is a main class to run Junit 4 tests.
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) { | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
// Path: sunshine-junit4/src/main/java/org/tatools/sunshine/junit4/Sunshine.java
import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex;
package org.tatools.sunshine.junit4;
/**
* The {@link Sunshine} class is a main class to run Junit 4 tests.
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) { | new Sun(new Junit4Kernel(new JunitSuite(new VerboseRegex(new RegexCondition())))).shine(); |
tatools/sunshine | sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Condition.java
// @FunctionalInterface
// public interface Condition {
// /**
// * Allows verifying this condition on an identity. The identity is the full name of a class like
// * "io.github.my.FirstTest".
// *
// * @param identity a full name of a class
// * @return true if the rule passes otherwise false
// */
// boolean applicable(String identity);
//
// class Fake implements Condition {
// private final boolean answer;
//
// public Fake(boolean answer) {
// this.answer = answer;
// }
//
// @Override
// public boolean applicable(String identity) {
// return answer;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java
// public interface FileSystem {
// /**
// * Returns a list of files within given file system. An implementation may support recursive
// * search or not.
// *
// * @return a list of files
// * @throws FileSystemException if some error occurs
// */
// List<FileSystemPath> files() throws FileSystemException;
//
// class Fake implements FileSystem {
// private final List<FileSystemPath> files;
//
// public Fake(FileSystemPath... files) {
// this(Arrays.asList(files));
// }
//
// Fake(List<FileSystemPath> files) {
// this.files = files;
// }
//
// @Override
// public List<FileSystemPath> files() {
// return files;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import java.util.Collections;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.Condition;
import org.tatools.sunshine.core.FileSystem;
import org.tatools.sunshine.core.SuiteException; | package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class JunitSuiteTest {
@Test | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Condition.java
// @FunctionalInterface
// public interface Condition {
// /**
// * Allows verifying this condition on an identity. The identity is the full name of a class like
// * "io.github.my.FirstTest".
// *
// * @param identity a full name of a class
// * @return true if the rule passes otherwise false
// */
// boolean applicable(String identity);
//
// class Fake implements Condition {
// private final boolean answer;
//
// public Fake(boolean answer) {
// this.answer = answer;
// }
//
// @Override
// public boolean applicable(String identity) {
// return answer;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java
// public interface FileSystem {
// /**
// * Returns a list of files within given file system. An implementation may support recursive
// * search or not.
// *
// * @return a list of files
// * @throws FileSystemException if some error occurs
// */
// List<FileSystemPath> files() throws FileSystemException;
//
// class Fake implements FileSystem {
// private final List<FileSystemPath> files;
//
// public Fake(FileSystemPath... files) {
// this(Arrays.asList(files));
// }
//
// Fake(List<FileSystemPath> files) {
// this.files = files;
// }
//
// @Override
// public List<FileSystemPath> files() {
// return files;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java
import java.util.Collections;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.Condition;
import org.tatools.sunshine.core.FileSystem;
import org.tatools.sunshine.core.SuiteException;
package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class JunitSuiteTest {
@Test | public void testDefaultSuite() throws SuiteException { |
tatools/sunshine | sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Condition.java
// @FunctionalInterface
// public interface Condition {
// /**
// * Allows verifying this condition on an identity. The identity is the full name of a class like
// * "io.github.my.FirstTest".
// *
// * @param identity a full name of a class
// * @return true if the rule passes otherwise false
// */
// boolean applicable(String identity);
//
// class Fake implements Condition {
// private final boolean answer;
//
// public Fake(boolean answer) {
// this.answer = answer;
// }
//
// @Override
// public boolean applicable(String identity) {
// return answer;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java
// public interface FileSystem {
// /**
// * Returns a list of files within given file system. An implementation may support recursive
// * search or not.
// *
// * @return a list of files
// * @throws FileSystemException if some error occurs
// */
// List<FileSystemPath> files() throws FileSystemException;
//
// class Fake implements FileSystem {
// private final List<FileSystemPath> files;
//
// public Fake(FileSystemPath... files) {
// this(Arrays.asList(files));
// }
//
// Fake(List<FileSystemPath> files) {
// this.files = files;
// }
//
// @Override
// public List<FileSystemPath> files() {
// return files;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import java.util.Collections;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.Condition;
import org.tatools.sunshine.core.FileSystem;
import org.tatools.sunshine.core.SuiteException; | package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class JunitSuiteTest {
@Test
public void testDefaultSuite() throws SuiteException {
MatcherAssert.assertThat(
new JunitSuite(() -> Collections.emptyList()).tests(), Matchers.arrayWithSize(0));
}
@Test
public void testDefaultFileSystemAndTestsFilter() throws SuiteException {
MatcherAssert.assertThat( | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Condition.java
// @FunctionalInterface
// public interface Condition {
// /**
// * Allows verifying this condition on an identity. The identity is the full name of a class like
// * "io.github.my.FirstTest".
// *
// * @param identity a full name of a class
// * @return true if the rule passes otherwise false
// */
// boolean applicable(String identity);
//
// class Fake implements Condition {
// private final boolean answer;
//
// public Fake(boolean answer) {
// this.answer = answer;
// }
//
// @Override
// public boolean applicable(String identity) {
// return answer;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java
// public interface FileSystem {
// /**
// * Returns a list of files within given file system. An implementation may support recursive
// * search or not.
// *
// * @return a list of files
// * @throws FileSystemException if some error occurs
// */
// List<FileSystemPath> files() throws FileSystemException;
//
// class Fake implements FileSystem {
// private final List<FileSystemPath> files;
//
// public Fake(FileSystemPath... files) {
// this(Arrays.asList(files));
// }
//
// Fake(List<FileSystemPath> files) {
// this.files = files;
// }
//
// @Override
// public List<FileSystemPath> files() {
// return files;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java
import java.util.Collections;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.Condition;
import org.tatools.sunshine.core.FileSystem;
import org.tatools.sunshine.core.SuiteException;
package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class JunitSuiteTest {
@Test
public void testDefaultSuite() throws SuiteException {
MatcherAssert.assertThat(
new JunitSuite(() -> Collections.emptyList()).tests(), Matchers.arrayWithSize(0));
}
@Test
public void testDefaultFileSystemAndTestsFilter() throws SuiteException {
MatcherAssert.assertThat( | new JunitSuite(new FileSystem.Fake(), new Condition.Fake(false)).tests(), |
tatools/sunshine | sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Condition.java
// @FunctionalInterface
// public interface Condition {
// /**
// * Allows verifying this condition on an identity. The identity is the full name of a class like
// * "io.github.my.FirstTest".
// *
// * @param identity a full name of a class
// * @return true if the rule passes otherwise false
// */
// boolean applicable(String identity);
//
// class Fake implements Condition {
// private final boolean answer;
//
// public Fake(boolean answer) {
// this.answer = answer;
// }
//
// @Override
// public boolean applicable(String identity) {
// return answer;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java
// public interface FileSystem {
// /**
// * Returns a list of files within given file system. An implementation may support recursive
// * search or not.
// *
// * @return a list of files
// * @throws FileSystemException if some error occurs
// */
// List<FileSystemPath> files() throws FileSystemException;
//
// class Fake implements FileSystem {
// private final List<FileSystemPath> files;
//
// public Fake(FileSystemPath... files) {
// this(Arrays.asList(files));
// }
//
// Fake(List<FileSystemPath> files) {
// this.files = files;
// }
//
// @Override
// public List<FileSystemPath> files() {
// return files;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import java.util.Collections;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.Condition;
import org.tatools.sunshine.core.FileSystem;
import org.tatools.sunshine.core.SuiteException; | package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class JunitSuiteTest {
@Test
public void testDefaultSuite() throws SuiteException {
MatcherAssert.assertThat(
new JunitSuite(() -> Collections.emptyList()).tests(), Matchers.arrayWithSize(0));
}
@Test
public void testDefaultFileSystemAndTestsFilter() throws SuiteException {
MatcherAssert.assertThat( | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Condition.java
// @FunctionalInterface
// public interface Condition {
// /**
// * Allows verifying this condition on an identity. The identity is the full name of a class like
// * "io.github.my.FirstTest".
// *
// * @param identity a full name of a class
// * @return true if the rule passes otherwise false
// */
// boolean applicable(String identity);
//
// class Fake implements Condition {
// private final boolean answer;
//
// public Fake(boolean answer) {
// this.answer = answer;
// }
//
// @Override
// public boolean applicable(String identity) {
// return answer;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystem.java
// public interface FileSystem {
// /**
// * Returns a list of files within given file system. An implementation may support recursive
// * search or not.
// *
// * @return a list of files
// * @throws FileSystemException if some error occurs
// */
// List<FileSystemPath> files() throws FileSystemException;
//
// class Fake implements FileSystem {
// private final List<FileSystemPath> files;
//
// public Fake(FileSystemPath... files) {
// this(Arrays.asList(files));
// }
//
// Fake(List<FileSystemPath> files) {
// this.files = files;
// }
//
// @Override
// public List<FileSystemPath> files() {
// return files;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/JunitSuiteTest.java
import java.util.Collections;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.Condition;
import org.tatools.sunshine.core.FileSystem;
import org.tatools.sunshine.core.SuiteException;
package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class JunitSuiteTest {
@Test
public void testDefaultSuite() throws SuiteException {
MatcherAssert.assertThat(
new JunitSuite(() -> Collections.emptyList()).tests(), Matchers.arrayWithSize(0));
}
@Test
public void testDefaultFileSystemAndTestsFilter() throws SuiteException {
MatcherAssert.assertThat( | new JunitSuite(new FileSystem.Fake(), new Condition.Fake(false)).tests(), |
tatools/sunshine | sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.notification.RunListener;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException; | package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class Junit4KernelTest {
@Test | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.notification.RunListener;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class Junit4KernelTest {
@Test | public void run() throws KernelException { |
tatools/sunshine | sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.notification.RunListener;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException; | package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class Junit4KernelTest {
@Test
public void run() throws KernelException {
MatcherAssert.assertThat(
new Junit4Kernel(() -> new Class[] {}).status().code(),
Matchers.equalTo((short) 0));
}
@Test(expected = KernelException.class)
public void runWithFail() throws KernelException {
new Junit4Kernel(
() -> { | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-junit4/src/test/java/org/tatools/sunshine/junit4/Junit4KernelTest.java
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.junit.runner.Description;
import org.junit.runner.notification.RunListener;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
package org.tatools.sunshine.junit4;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class Junit4KernelTest {
@Test
public void run() throws KernelException {
MatcherAssert.assertThat(
new Junit4Kernel(() -> new Class[] {}).status().code(),
Matchers.equalTo((short) 0));
}
@Test(expected = KernelException.class)
public void runWithFail() throws KernelException {
new Junit4Kernel(
() -> { | throw new SuiteException("Fail"); |
tatools/sunshine | sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
| import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex; | package org.tatools.sunshine.testng;
/**
* The {@link Sunshine} class is a main class to run TestNG tests.
*
* <p>If no arguments will be provided, then Sunshine will try to find TestNG tests in the
* CLASSPATH.
*
* <p>If an argument will be provided, then Sunshine will run TestNG with given argument. The
* argument is a path to TestNG configuration file (XML or YAML).
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) {
if (args != null && args.length > 0) { | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
// Path: sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java
import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex;
package org.tatools.sunshine.testng;
/**
* The {@link Sunshine} class is a main class to run TestNG tests.
*
* <p>If no arguments will be provided, then Sunshine will try to find TestNG tests in the
* CLASSPATH.
*
* <p>If an argument will be provided, then Sunshine will run TestNG with given argument. The
* argument is a path to TestNG configuration file (XML or YAML).
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) {
if (args != null && args.length > 0) { | new Sun(new TestNGKernel(new PreparedTestNGSuite(args[0]))).shine(); |
tatools/sunshine | sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
| import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex; | package org.tatools.sunshine.testng;
/**
* The {@link Sunshine} class is a main class to run TestNG tests.
*
* <p>If no arguments will be provided, then Sunshine will try to find TestNG tests in the
* CLASSPATH.
*
* <p>If an argument will be provided, then Sunshine will run TestNG with given argument. The
* argument is a path to TestNG configuration file (XML or YAML).
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) {
if (args != null && args.length > 0) {
new Sun(new TestNGKernel(new PreparedTestNGSuite(args[0]))).shine();
} else {
new Sun(
new TestNGKernel(
new LoadableTestNGSuite( | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
// Path: sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java
import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex;
package org.tatools.sunshine.testng;
/**
* The {@link Sunshine} class is a main class to run TestNG tests.
*
* <p>If no arguments will be provided, then Sunshine will try to find TestNG tests in the
* CLASSPATH.
*
* <p>If an argument will be provided, then Sunshine will run TestNG with given argument. The
* argument is a path to TestNG configuration file (XML or YAML).
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) {
if (args != null && args.length > 0) {
new Sun(new TestNGKernel(new PreparedTestNGSuite(args[0]))).shine();
} else {
new Sun(
new TestNGKernel(
new LoadableTestNGSuite( | new VerboseRegex(new RegexCondition())))) |
tatools/sunshine | sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
| import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex; | package org.tatools.sunshine.testng;
/**
* The {@link Sunshine} class is a main class to run TestNG tests.
*
* <p>If no arguments will be provided, then Sunshine will try to find TestNG tests in the
* CLASSPATH.
*
* <p>If an argument will be provided, then Sunshine will run TestNG with given argument. The
* argument is a path to TestNG configuration file (XML or YAML).
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) {
if (args != null && args.length > 0) {
new Sun(new TestNGKernel(new PreparedTestNGSuite(args[0]))).shine();
} else {
new Sun(
new TestNGKernel(
new LoadableTestNGSuite( | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/RegexCondition.java
// @EqualsAndHashCode
// public class RegexCondition implements Condition {
//
// final Pattern regex;
//
// /**
// * Use a value of "tests-regex" system property as a regex pattern. If the system property is
// * not set, the "(.+)(Test)([\w\d]+)?" value is used.
// */
// public RegexCondition() {
// this(System.getProperty("tests-regex", "(.+)(Test)([\\w\\d]+)?"));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value to be complied in a {@link Pattern}
// */
// public RegexCondition(String regex) {
// this(Pattern.compile(regex));
// }
//
// /**
// * Construct the object with given regex.
// *
// * @param regex the value
// */
// public RegexCondition(Pattern regex) {
// this.regex = regex;
// }
//
// @Override
// public final boolean applicable(String identity) {
// return regex.matcher(identity).matches();
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/Sun.java
// public class Sun implements Star {
//
// private static final int SUNSHINE_ERROR = 12;
// private final Kernel<?> core;
//
// /**
// * Constructs the new instance.
// *
// * @param kernel the {@link Kernel}
// */
// public Sun(Kernel<?> kernel) {
// this.core = kernel;
// }
//
// /**
// * Retrieves a {@link Status} of encapsulated {@link Kernel}. If there are some errors in
// * suite's preparation, the execution will be aborted with exit code #{@value SUNSHINE_ERROR},
// * otherwise exit code will be provided by appropriate {@link Kernel}.
// */
// @Override
// public final void shine() {
// try {
// final Status status = this.core.status();
// System.out.println(
// new StringBuilder("\n===============================================\n")
// .append("Total tests run: ")
// .append(status.runCount())
// .append(", Failures: ")
// .append(status.failureCount())
// .append(", Skips: ")
// .append(status.ignoreCount())
// .append("\n===============================================\n"));
// System.exit(status.code());
// } catch (KernelException e) {
// e.printStackTrace(System.out);
// System.exit(Sun.SUNSHINE_ERROR);
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/VerboseRegex.java
// public class VerboseRegex implements Condition {
//
// private final RegexCondition regexCondition;
// private final boolean[] say = new boolean[] {true};
// private final PrintStream printer;
//
// /**
// * Construct the object.
// *
// * @param condition the condition
// */
// public VerboseRegex(RegexCondition condition) {
// this(condition, System.out);
// }
//
// /**
// * Construct the object.
// *
// * @param regexCondition the condition
// * @param printer a print stream
// */
// VerboseRegex(RegexCondition regexCondition, PrintStream printer) {
// this.regexCondition = regexCondition;
// this.printer = printer;
// }
//
// @Override
// public final boolean applicable(String identity) {
// if (say[0]) {
// this.printer.println(
// String.format(
// "The following pattern will be used for classes filtering: %s",
// this.regexCondition.regex.pattern()));
// Arrays.fill(say, false);
// }
// return this.regexCondition.applicable(identity);
// }
// }
// Path: sunshine-testng/src/main/java/org/tatools/sunshine/testng/Sunshine.java
import org.tatools.sunshine.core.RegexCondition;
import org.tatools.sunshine.core.Sun;
import org.tatools.sunshine.core.VerboseRegex;
package org.tatools.sunshine.testng;
/**
* The {@link Sunshine} class is a main class to run TestNG tests.
*
* <p>If no arguments will be provided, then Sunshine will try to find TestNG tests in the
* CLASSPATH.
*
* <p>If an argument will be provided, then Sunshine will run TestNG with given argument. The
* argument is a path to TestNG configuration file (XML or YAML).
*
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.1
*/
public final class Sunshine {
public static void main(String[] args) {
if (args != null && args.length > 0) {
new Sun(new TestNGKernel(new PreparedTestNGSuite(args[0]))).shine();
} else {
new Sun(
new TestNGKernel(
new LoadableTestNGSuite( | new VerboseRegex(new RegexCondition())))) |
tatools/sunshine | sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener; | package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class TestNGKernelTest {
@Test | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener;
package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class TestNGKernelTest {
@Test | public void status() throws KernelException { |
tatools/sunshine | sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener; | package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class TestNGKernelTest {
@Test
public void status() throws KernelException {
MatcherAssert.assertThat( | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener;
package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class TestNGKernelTest {
@Test
public void status() throws KernelException {
MatcherAssert.assertThat( | new TestNGKernel(() -> new FileSystemPath.Fake("src/test/resources/testng.xml")) |
tatools/sunshine | sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
| import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener; | package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class TestNGKernelTest {
@Test
public void status() throws KernelException {
MatcherAssert.assertThat(
new TestNGKernel(() -> new FileSystemPath.Fake("src/test/resources/testng.xml"))
.status()
.code(),
Matchers.equalTo((short) 0));
}
@Test(expected = KernelException.class)
public void runWithFail() throws KernelException {
new TestNGKernel(
() -> { | // Path: sunshine-core/src/main/java/org/tatools/sunshine/core/FileSystemPath.java
// public interface FileSystemPath {
// Path path();
//
// boolean exist();
//
// final class Fake implements FileSystemPath {
//
// private final Path path;
// private final boolean exist;
//
// public Fake() {
// this(Paths.get("."), false);
// }
//
// public Fake(String path) {
// this(Paths.get(path), false);
// }
//
// public Fake(String path, boolean exist) {
// this(Paths.get(path), exist);
// }
//
// public Fake(Path path, boolean exist) {
// this.path = path;
// this.exist = exist;
// }
//
// @Override
// public Path path() {
// return path;
// }
//
// @Override
// public boolean exist() {
// return exist;
// }
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/KernelException.java
// public class KernelException extends SunshineException {
// public KernelException(String message) {
// super(message);
// }
//
// public KernelException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public KernelException(Throwable cause) {
// super(cause);
// }
// }
//
// Path: sunshine-core/src/main/java/org/tatools/sunshine/core/SuiteException.java
// public class SuiteException extends SunshineException {
// public SuiteException(String message) {
// super(message);
// }
//
// public SuiteException(String message, Throwable cause) {
// super(message, cause);
// }
//
// public SuiteException(Throwable cause) {
// super(cause);
// }
// }
// Path: sunshine-testng/src/test/java/org/tatools/sunshine/testng/TestNGKernelTest.java
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.Test;
import org.tatools.sunshine.core.FileSystemPath;
import org.tatools.sunshine.core.KernelException;
import org.tatools.sunshine.core.SuiteException;
import org.testng.ISuite;
import org.testng.ISuiteListener;
package org.tatools.sunshine.testng;
/**
* @author Dmytro Serdiuk ([email protected])
* @version $Id$
* @since 0.2
*/
public class TestNGKernelTest {
@Test
public void status() throws KernelException {
MatcherAssert.assertThat(
new TestNGKernel(() -> new FileSystemPath.Fake("src/test/resources/testng.xml"))
.status()
.code(),
Matchers.equalTo((short) 0));
}
@Test(expected = KernelException.class)
public void runWithFail() throws KernelException {
new TestNGKernel(
() -> { | throw new SuiteException("Fail"); |
Alienturnedhuman/PearPlanner | src/Controller/StudyProfileController.java | // Path: src/Model/StudyProfile.java
// public class StudyProfile extends VersionControlEntity
// {
// // private data
// private ArrayList<Module> modules;
// private ArrayList<Milestone> milestones;
// private ArrayList<ExtensionApplication> extensions;
// private ArrayList<Event> calendar = new ArrayList<>();
// private int year;
// private int semesterNo;
// private boolean current;
//
// // public methods
//
// // getters:
// public Module[] getModules()
// {
// Module[] m = new Module[this.modules.size()];
// m = this.modules.toArray(m);
// return m;
// }
//
// public Milestone[] getMilestones()
// {
// Milestone[] m = new Milestone[this.milestones.size()];
// m = this.milestones.toArray(m);
// return m;
// }
//
// public ExtensionApplication[] getExtensions()
// {
// ExtensionApplication[] e = new ExtensionApplication[this.extensions.size()];
// e = this.extensions.toArray(e);
// return e;
// }
//
// /**
// * Returns a calendar containing all the Events of this Study Profile.
// *
// * @return ArrayList of Events
// */
// public ArrayList<Event> getCalendar()
// {
// return calendar;
// }
//
//
// public ArrayList<Task> getTasks()
// {
// ArrayList<Task> tasks = new ArrayList<>();
// this.modules.forEach(e -> e.getAssignments().forEach(ee -> tasks.addAll(ee.getTasks())));
// return tasks;
// }
//
// /**
// * Whether this StudyProfile is set as current.
// *
// * @return true if current, else otherwise.
// */
// public boolean isCurrent()
// {
// return current;
// }
//
// /**
// * Set/unset this StudyProfile as the current profile of the StudyPlanner.
// *
// * @param current
// */
// public void setCurrent(boolean current)
// {
// this.current = current;
// }
//
// /**
// * Add an Event to the calendar of this Study Profile.
// *
// * @param event Event to be added.
// */
// public void addEventToCalendar(Event event)
// {
// if (!calendar.contains(event))
// {
// calendar.add(event);
// }
// }
//
// public String getName()
// {
// return name;
// }
//
// public int getYear()
// {
// return year;
// }
//
// public int getSemesterNo()
// {
// return semesterNo;
// }
//
// /**
// * Whether this StudyProfile matches the given details.
// *
// * @param mYear year
// * @param mSemesterNo semester number
// * @return true if matches, false otherwise.
// */
// public boolean matches(int mYear, int mSemesterNo)
// {
// return mYear == year && mSemesterNo == semesterNo;
// }
//
// // Setters:
//
// /**
// * Adds a Milestone to this StudyProfile.
// *
// * @param milestone Milestone to be added.
// */
// public void addMilestone(Milestone milestone)
// {
// this.milestones.add(milestone);
// }
//
// /**
// * Removes a Milestone from this StudyProfile.
// *
// * @param milestone Milestone to be removed.
// * @return whether the Milestone was removed successfully.
// */
// public boolean removeMilestone(Milestone milestone)
// {
// return this.milestones.remove(milestone);
// }
//
// @Override
// public void open(MenuController.Window current)
// {
// try
// {
// MainController.ui.studyProfileDetails(this);
// } catch (IOException e)
// {
// UIManager.reportError("Unable to open View file");
// }
// }
//
// // constructors
// public StudyProfile(HubFile initialHubFile)
// {
// this.milestones = new ArrayList<>();
//
// this.modules = initialHubFile.getModules();
// this.extensions = initialHubFile.getExtensions();
//
// this.year = initialHubFile.getYear();
// this.semesterNo = initialHubFile.getSemester();
// this.version = initialHubFile.getVersion();
// this.name = initialHubFile.getSemesterName();
// this.details = initialHubFile.getSemesterDetails();
//
// this.current = false;
// }
// }
| import Model.StudyProfile;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.net.URL;
import java.util.ResourceBundle; | package Controller;
/**
* Created by Žilvinas on 10/05/2017.
*/
public class StudyProfileController implements Initializable
{ | // Path: src/Model/StudyProfile.java
// public class StudyProfile extends VersionControlEntity
// {
// // private data
// private ArrayList<Module> modules;
// private ArrayList<Milestone> milestones;
// private ArrayList<ExtensionApplication> extensions;
// private ArrayList<Event> calendar = new ArrayList<>();
// private int year;
// private int semesterNo;
// private boolean current;
//
// // public methods
//
// // getters:
// public Module[] getModules()
// {
// Module[] m = new Module[this.modules.size()];
// m = this.modules.toArray(m);
// return m;
// }
//
// public Milestone[] getMilestones()
// {
// Milestone[] m = new Milestone[this.milestones.size()];
// m = this.milestones.toArray(m);
// return m;
// }
//
// public ExtensionApplication[] getExtensions()
// {
// ExtensionApplication[] e = new ExtensionApplication[this.extensions.size()];
// e = this.extensions.toArray(e);
// return e;
// }
//
// /**
// * Returns a calendar containing all the Events of this Study Profile.
// *
// * @return ArrayList of Events
// */
// public ArrayList<Event> getCalendar()
// {
// return calendar;
// }
//
//
// public ArrayList<Task> getTasks()
// {
// ArrayList<Task> tasks = new ArrayList<>();
// this.modules.forEach(e -> e.getAssignments().forEach(ee -> tasks.addAll(ee.getTasks())));
// return tasks;
// }
//
// /**
// * Whether this StudyProfile is set as current.
// *
// * @return true if current, else otherwise.
// */
// public boolean isCurrent()
// {
// return current;
// }
//
// /**
// * Set/unset this StudyProfile as the current profile of the StudyPlanner.
// *
// * @param current
// */
// public void setCurrent(boolean current)
// {
// this.current = current;
// }
//
// /**
// * Add an Event to the calendar of this Study Profile.
// *
// * @param event Event to be added.
// */
// public void addEventToCalendar(Event event)
// {
// if (!calendar.contains(event))
// {
// calendar.add(event);
// }
// }
//
// public String getName()
// {
// return name;
// }
//
// public int getYear()
// {
// return year;
// }
//
// public int getSemesterNo()
// {
// return semesterNo;
// }
//
// /**
// * Whether this StudyProfile matches the given details.
// *
// * @param mYear year
// * @param mSemesterNo semester number
// * @return true if matches, false otherwise.
// */
// public boolean matches(int mYear, int mSemesterNo)
// {
// return mYear == year && mSemesterNo == semesterNo;
// }
//
// // Setters:
//
// /**
// * Adds a Milestone to this StudyProfile.
// *
// * @param milestone Milestone to be added.
// */
// public void addMilestone(Milestone milestone)
// {
// this.milestones.add(milestone);
// }
//
// /**
// * Removes a Milestone from this StudyProfile.
// *
// * @param milestone Milestone to be removed.
// * @return whether the Milestone was removed successfully.
// */
// public boolean removeMilestone(Milestone milestone)
// {
// return this.milestones.remove(milestone);
// }
//
// @Override
// public void open(MenuController.Window current)
// {
// try
// {
// MainController.ui.studyProfileDetails(this);
// } catch (IOException e)
// {
// UIManager.reportError("Unable to open View file");
// }
// }
//
// // constructors
// public StudyProfile(HubFile initialHubFile)
// {
// this.milestones = new ArrayList<>();
//
// this.modules = initialHubFile.getModules();
// this.extensions = initialHubFile.getExtensions();
//
// this.year = initialHubFile.getYear();
// this.semesterNo = initialHubFile.getSemester();
// this.version = initialHubFile.getVersion();
// this.name = initialHubFile.getSemesterName();
// this.details = initialHubFile.getSemesterDetails();
//
// this.current = false;
// }
// }
// Path: src/Controller/StudyProfileController.java
import Model.StudyProfile;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.stage.Stage;
import java.net.URL;
import java.util.ResourceBundle;
package Controller;
/**
* Created by Žilvinas on 10/05/2017.
*/
public class StudyProfileController implements Initializable
{ | private StudyProfile profile; |
Alienturnedhuman/PearPlanner | Test/Controller/StudyPlannerControllerTest.java | // Path: src/Model/Account.java
// public class Account implements Serializable
// {
// // private data
// private Person studentDetails;
// private String studentNumber;
//
// // public methods
//
// // getters
// public Person getStudentDetails()
// {
// return studentDetails;
// }
//
// public String getStudentNumber()
// {
// return studentNumber;
// }
//
// // setters
// public void setStudentDetails(Person newStudentDetails)
// {
// studentDetails = newStudentDetails;
// }
//
// public void setStudentNumber(String newStudentNumber)
// {
// studentNumber = newStudentNumber;
// }
//
// // constructors
// public Account(Person studentDetails, String studentNumber)
// {
// this.studentDetails = studentDetails;
// this.studentNumber = studentNumber;
// }
// }
| import Model.Account;
import Model.Person;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*; | package Controller;
/**
* Created by bijan on 08/05/2017.
*/
public class StudyPlannerControllerTest {
@Before
public void setUp() throws Exception
{ | // Path: src/Model/Account.java
// public class Account implements Serializable
// {
// // private data
// private Person studentDetails;
// private String studentNumber;
//
// // public methods
//
// // getters
// public Person getStudentDetails()
// {
// return studentDetails;
// }
//
// public String getStudentNumber()
// {
// return studentNumber;
// }
//
// // setters
// public void setStudentDetails(Person newStudentDetails)
// {
// studentDetails = newStudentDetails;
// }
//
// public void setStudentNumber(String newStudentNumber)
// {
// studentNumber = newStudentNumber;
// }
//
// // constructors
// public Account(Person studentDetails, String studentNumber)
// {
// this.studentDetails = studentDetails;
// this.studentNumber = studentNumber;
// }
// }
// Path: Test/Controller/StudyPlannerControllerTest.java
import Model.Account;
import Model.Person;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
package Controller;
/**
* Created by bijan on 08/05/2017.
*/
public class StudyPlannerControllerTest {
@Before
public void setUp() throws Exception
{ | Account a = new Account(new Person("Mr","Adrew",true),"100125464"); |
Alienturnedhuman/PearPlanner | Test/View/FXBase.java | // Path: src/Controller/AccountController.java
// public class AccountController implements Initializable
// {
// @FXML private TextField account_no;
// @FXML private TextField salutation;
// @FXML private TextField full_name;
// @FXML private TextField email;
// @FXML private CheckBox fam_last;
// @FXML private Button submit;
// @FXML private GridPane pane;
//
// private Account account;
// private boolean success = false;
//
// public Account getAccount()
// {
// return account;
// }
//
// public boolean isSuccess()
// {
// return success;
// }
//
// /**
// * Handle changes to the text fields
// */
// public void handleChange()
// {
// if (Person.validSalutation(this.salutation.getText().trim()) &&
// Person.validName(this.full_name.getText().trim()) &&
// (this.email.getText().trim().isEmpty() || Person.validEmail(this.email.getText().trim())) &&
// !account_no.getText().trim().isEmpty())
//
// this.submit.setDisable(false);
// }
//
// /**
// * Validate data in the Salutation field
// */
// public void validateSalutation()
// {
// if (!Person.validSalutation(this.salutation.getText().trim()))
// {
// this.salutation.setStyle("-fx-text-box-border:red;");
// this.submit.setDisable(true);
// } else
// {
// this.salutation.setStyle("");
// this.handleChange();
// }
// }
//
// /**
// * Validate data in the Name field
// */
// public void validateName()
// {
// if (!Person.validName(this.full_name.getText().trim()))
// {
// this.full_name.setStyle("-fx-text-box-border:red;");
// this.submit.setDisable(true);
// } else
// {
// this.full_name.setStyle("");
// this.handleChange();
// }
// }
//
// /**
// * Validate data in the Email field
// */
// public void validateEmail()
// {
// if (this.email.getText().trim().isEmpty() || Person.validEmail(this.email.getText().trim()))
// {
// this.email.setStyle("");
// this.handleChange();
// } else
// {
// this.email.setStyle("-fx-text-box-border:red;");
// this.submit.setDisable(true);
// }
// }
//
// /**
// * Validate data in the Account Number field
// */
// public void validateNumber()
// {
// if (account_no.getText().trim().isEmpty())
// this.submit.setDisable(true);
// else
// this.handleChange();
// }
//
// /**
// * Submit the form and create a new Account
// */
// public void handleSubmit()
// {
// Person p = new Person(this.salutation.getText().trim(), this.full_name.getText().trim(),
// this.fam_last.isSelected());
//
// if (!this.email.getText().trim().isEmpty())
// p.setEmail(this.email.getText().trim());
//
// this.account = new Account(p, this.account_no.getText().trim());
// this.success = true;
// Stage stage = (Stage) this.submit.getScene().getWindow();
// stage.close();
// }
//
// /**
// * Handle Quit button
// */
// public void handleQuit()
// {
// Stage stage = (Stage) this.submit.getScene().getWindow();
// stage.close();
// }
//
// @Override
// public void initialize(URL location, ResourceBundle resources)
// {
// Platform.runLater(() -> this.pane.requestFocus());
// }
// }
| import Controller.AccountController;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.MouseButton;
import javafx.stage.Stage;
import org.junit.After;
import org.testfx.api.FxToolkit;
import org.testfx.framework.junit.ApplicationTest;
import java.util.concurrent.TimeoutException; | package View;
/**
* PearPlanner
* Created by Team BRONZE on 08/05/2017
*/
public abstract class FXBase extends ApplicationTest {
@Override
public void start(Stage stage) throws Exception
{
| // Path: src/Controller/AccountController.java
// public class AccountController implements Initializable
// {
// @FXML private TextField account_no;
// @FXML private TextField salutation;
// @FXML private TextField full_name;
// @FXML private TextField email;
// @FXML private CheckBox fam_last;
// @FXML private Button submit;
// @FXML private GridPane pane;
//
// private Account account;
// private boolean success = false;
//
// public Account getAccount()
// {
// return account;
// }
//
// public boolean isSuccess()
// {
// return success;
// }
//
// /**
// * Handle changes to the text fields
// */
// public void handleChange()
// {
// if (Person.validSalutation(this.salutation.getText().trim()) &&
// Person.validName(this.full_name.getText().trim()) &&
// (this.email.getText().trim().isEmpty() || Person.validEmail(this.email.getText().trim())) &&
// !account_no.getText().trim().isEmpty())
//
// this.submit.setDisable(false);
// }
//
// /**
// * Validate data in the Salutation field
// */
// public void validateSalutation()
// {
// if (!Person.validSalutation(this.salutation.getText().trim()))
// {
// this.salutation.setStyle("-fx-text-box-border:red;");
// this.submit.setDisable(true);
// } else
// {
// this.salutation.setStyle("");
// this.handleChange();
// }
// }
//
// /**
// * Validate data in the Name field
// */
// public void validateName()
// {
// if (!Person.validName(this.full_name.getText().trim()))
// {
// this.full_name.setStyle("-fx-text-box-border:red;");
// this.submit.setDisable(true);
// } else
// {
// this.full_name.setStyle("");
// this.handleChange();
// }
// }
//
// /**
// * Validate data in the Email field
// */
// public void validateEmail()
// {
// if (this.email.getText().trim().isEmpty() || Person.validEmail(this.email.getText().trim()))
// {
// this.email.setStyle("");
// this.handleChange();
// } else
// {
// this.email.setStyle("-fx-text-box-border:red;");
// this.submit.setDisable(true);
// }
// }
//
// /**
// * Validate data in the Account Number field
// */
// public void validateNumber()
// {
// if (account_no.getText().trim().isEmpty())
// this.submit.setDisable(true);
// else
// this.handleChange();
// }
//
// /**
// * Submit the form and create a new Account
// */
// public void handleSubmit()
// {
// Person p = new Person(this.salutation.getText().trim(), this.full_name.getText().trim(),
// this.fam_last.isSelected());
//
// if (!this.email.getText().trim().isEmpty())
// p.setEmail(this.email.getText().trim());
//
// this.account = new Account(p, this.account_no.getText().trim());
// this.success = true;
// Stage stage = (Stage) this.submit.getScene().getWindow();
// stage.close();
// }
//
// /**
// * Handle Quit button
// */
// public void handleQuit()
// {
// Stage stage = (Stage) this.submit.getScene().getWindow();
// stage.close();
// }
//
// @Override
// public void initialize(URL location, ResourceBundle resources)
// {
// Platform.runLater(() -> this.pane.requestFocus());
// }
// }
// Path: Test/View/FXBase.java
import Controller.AccountController;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.input.KeyCode;
import javafx.scene.input.MouseButton;
import javafx.stage.Stage;
import org.junit.After;
import org.testfx.api.FxToolkit;
import org.testfx.framework.junit.ApplicationTest;
import java.util.concurrent.TimeoutException;
package View;
/**
* PearPlanner
* Created by Team BRONZE on 08/05/2017
*/
public abstract class FXBase extends ApplicationTest {
@Override
public void start(Stage stage) throws Exception
{
| AccountController accountControl = new AccountController(); |
Alienturnedhuman/PearPlanner | src/Controller/XMLcontroller.java | // Path: src/Model/MultilineString.java
// public class MultilineString implements Serializable
// {
// // private Data;
// private ArrayList<String> lines;
//
// // public methods
// public MultilineString clone()
// {
// return new MultilineString(this.getAsArray());
// }
//
// // getters
//
// /**
// * Returns the number of lines in this MultilineString
// *
// * @return number of lines
// */
// public int getLines()
// {
// return lines.size();
// }
//
// public ArrayList<String> getAsArrayList()
// {
// return lines;
// }
//
// public String[] getAsArray()
// {
// String r[] = new String[lines.size()];
// r = lines.toArray(r);
// return r;
// }
//
// public String getAsString()
// {
// return String.join("\n", getAsArray());
// }
//
// public MultilineString()
// {
// lines = new ArrayList<>();
// }
//
// public MultilineString(String mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString.split("\n")));
// }
//
// public MultilineString(String[] mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString));
// }
// }
//
// Path: src/Controller/MainController.java
// public static boolean isNumeric(String str)
// {
// try
// {
// double d = Double.parseDouble(str);
// } catch (NumberFormatException nfe)
// {
// return false;
// }
// return true;
// }
| import Model.MultilineString;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.HashMap;
import java.util.HashSet;
import static Controller.MainController.isNumeric; | package Controller;
/**
* Created by bendickson on 5/6/17.
*/
public class XMLcontroller
{
public enum ImportAs
{
BOOLEAN, STRING, INTEGER, DOUBLE, MULTILINESTRING, NODELIST
}
public class NodeReturn
{
private ImportAs importedAs;
private String stringValue;
private int integerValue;
private double doubleValue; | // Path: src/Model/MultilineString.java
// public class MultilineString implements Serializable
// {
// // private Data;
// private ArrayList<String> lines;
//
// // public methods
// public MultilineString clone()
// {
// return new MultilineString(this.getAsArray());
// }
//
// // getters
//
// /**
// * Returns the number of lines in this MultilineString
// *
// * @return number of lines
// */
// public int getLines()
// {
// return lines.size();
// }
//
// public ArrayList<String> getAsArrayList()
// {
// return lines;
// }
//
// public String[] getAsArray()
// {
// String r[] = new String[lines.size()];
// r = lines.toArray(r);
// return r;
// }
//
// public String getAsString()
// {
// return String.join("\n", getAsArray());
// }
//
// public MultilineString()
// {
// lines = new ArrayList<>();
// }
//
// public MultilineString(String mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString.split("\n")));
// }
//
// public MultilineString(String[] mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString));
// }
// }
//
// Path: src/Controller/MainController.java
// public static boolean isNumeric(String str)
// {
// try
// {
// double d = Double.parseDouble(str);
// } catch (NumberFormatException nfe)
// {
// return false;
// }
// return true;
// }
// Path: src/Controller/XMLcontroller.java
import Model.MultilineString;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.HashMap;
import java.util.HashSet;
import static Controller.MainController.isNumeric;
package Controller;
/**
* Created by bendickson on 5/6/17.
*/
public class XMLcontroller
{
public enum ImportAs
{
BOOLEAN, STRING, INTEGER, DOUBLE, MULTILINESTRING, NODELIST
}
public class NodeReturn
{
private ImportAs importedAs;
private String stringValue;
private int integerValue;
private double doubleValue; | private MultilineString multilineStringValue; |
Alienturnedhuman/PearPlanner | src/Controller/XMLcontroller.java | // Path: src/Model/MultilineString.java
// public class MultilineString implements Serializable
// {
// // private Data;
// private ArrayList<String> lines;
//
// // public methods
// public MultilineString clone()
// {
// return new MultilineString(this.getAsArray());
// }
//
// // getters
//
// /**
// * Returns the number of lines in this MultilineString
// *
// * @return number of lines
// */
// public int getLines()
// {
// return lines.size();
// }
//
// public ArrayList<String> getAsArrayList()
// {
// return lines;
// }
//
// public String[] getAsArray()
// {
// String r[] = new String[lines.size()];
// r = lines.toArray(r);
// return r;
// }
//
// public String getAsString()
// {
// return String.join("\n", getAsArray());
// }
//
// public MultilineString()
// {
// lines = new ArrayList<>();
// }
//
// public MultilineString(String mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString.split("\n")));
// }
//
// public MultilineString(String[] mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString));
// }
// }
//
// Path: src/Controller/MainController.java
// public static boolean isNumeric(String str)
// {
// try
// {
// double d = Double.parseDouble(str);
// } catch (NumberFormatException nfe)
// {
// return false;
// }
// return true;
// }
| import Model.MultilineString;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.HashMap;
import java.util.HashSet;
import static Controller.MainController.isNumeric; | }
}
public HashMap<String, NodeReturn> getSchemaValues(NodeList nodes, HashMap<String, ImportAs> schema)
{
HashMap<String, NodeReturn> r = new HashMap<>();
int i = -1;
int ii = nodes.getLength();
String nodeName;
String temp;
while (++i < ii)
{
if (nodes.item(i).getNodeType() == Node.ELEMENT_NODE)
{
nodeName = nodes.item(i).getNodeName();
if (schema.containsKey(nodeName) && !r.containsKey(nodeName))
{
switch (schema.get(nodeName))
{
case BOOLEAN:
r.put(nodeName, new NodeReturn(nodes.item(i).getTextContent().equals("true")));
break;
case STRING:
r.put(nodeName, new NodeReturn(nodes.item(i).getTextContent()));
break;
case MULTILINESTRING:
r.put(nodeName, new NodeReturn(new MultilineString(nodes.item(i).getTextContent())));
break;
case INTEGER:
temp = nodes.item(i).getTextContent(); | // Path: src/Model/MultilineString.java
// public class MultilineString implements Serializable
// {
// // private Data;
// private ArrayList<String> lines;
//
// // public methods
// public MultilineString clone()
// {
// return new MultilineString(this.getAsArray());
// }
//
// // getters
//
// /**
// * Returns the number of lines in this MultilineString
// *
// * @return number of lines
// */
// public int getLines()
// {
// return lines.size();
// }
//
// public ArrayList<String> getAsArrayList()
// {
// return lines;
// }
//
// public String[] getAsArray()
// {
// String r[] = new String[lines.size()];
// r = lines.toArray(r);
// return r;
// }
//
// public String getAsString()
// {
// return String.join("\n", getAsArray());
// }
//
// public MultilineString()
// {
// lines = new ArrayList<>();
// }
//
// public MultilineString(String mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString.split("\n")));
// }
//
// public MultilineString(String[] mString)
// {
// lines = new ArrayList<>(Arrays.asList(mString));
// }
// }
//
// Path: src/Controller/MainController.java
// public static boolean isNumeric(String str)
// {
// try
// {
// double d = Double.parseDouble(str);
// } catch (NumberFormatException nfe)
// {
// return false;
// }
// return true;
// }
// Path: src/Controller/XMLcontroller.java
import Model.MultilineString;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.util.HashMap;
import java.util.HashSet;
import static Controller.MainController.isNumeric;
}
}
public HashMap<String, NodeReturn> getSchemaValues(NodeList nodes, HashMap<String, ImportAs> schema)
{
HashMap<String, NodeReturn> r = new HashMap<>();
int i = -1;
int ii = nodes.getLength();
String nodeName;
String temp;
while (++i < ii)
{
if (nodes.item(i).getNodeType() == Node.ELEMENT_NODE)
{
nodeName = nodes.item(i).getNodeName();
if (schema.containsKey(nodeName) && !r.containsKey(nodeName))
{
switch (schema.get(nodeName))
{
case BOOLEAN:
r.put(nodeName, new NodeReturn(nodes.item(i).getTextContent().equals("true")));
break;
case STRING:
r.put(nodeName, new NodeReturn(nodes.item(i).getTextContent()));
break;
case MULTILINESTRING:
r.put(nodeName, new NodeReturn(new MultilineString(nodes.item(i).getTextContent())));
break;
case INTEGER:
temp = nodes.item(i).getTextContent(); | if (isNumeric(temp)) |
Alienturnedhuman/PearPlanner | src/Controller/AccountController.java | // Path: src/Model/Account.java
// public class Account implements Serializable
// {
// // private data
// private Person studentDetails;
// private String studentNumber;
//
// // public methods
//
// // getters
// public Person getStudentDetails()
// {
// return studentDetails;
// }
//
// public String getStudentNumber()
// {
// return studentNumber;
// }
//
// // setters
// public void setStudentDetails(Person newStudentDetails)
// {
// studentDetails = newStudentDetails;
// }
//
// public void setStudentNumber(String newStudentNumber)
// {
// studentNumber = newStudentNumber;
// }
//
// // constructors
// public Account(Person studentDetails, String studentNumber)
// {
// this.studentDetails = studentDetails;
// this.studentNumber = studentNumber;
// }
// }
| import Model.Account;
import Model.Person;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import java.net.URL;
import java.util.ResourceBundle; | package Controller;
/**
* Created by Zilvinas on 04/05/2017.
*/
public class AccountController implements Initializable
{
@FXML private TextField account_no;
@FXML private TextField salutation;
@FXML private TextField full_name;
@FXML private TextField email;
@FXML private CheckBox fam_last;
@FXML private Button submit;
@FXML private GridPane pane;
| // Path: src/Model/Account.java
// public class Account implements Serializable
// {
// // private data
// private Person studentDetails;
// private String studentNumber;
//
// // public methods
//
// // getters
// public Person getStudentDetails()
// {
// return studentDetails;
// }
//
// public String getStudentNumber()
// {
// return studentNumber;
// }
//
// // setters
// public void setStudentDetails(Person newStudentDetails)
// {
// studentDetails = newStudentDetails;
// }
//
// public void setStudentNumber(String newStudentNumber)
// {
// studentNumber = newStudentNumber;
// }
//
// // constructors
// public Account(Person studentDetails, String studentNumber)
// {
// this.studentDetails = studentDetails;
// this.studentNumber = studentNumber;
// }
// }
// Path: src/Controller/AccountController.java
import Model.Account;
import Model.Person;
import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import java.net.URL;
import java.util.ResourceBundle;
package Controller;
/**
* Created by Zilvinas on 04/05/2017.
*/
public class AccountController implements Initializable
{
@FXML private TextField account_no;
@FXML private TextField salutation;
@FXML private TextField full_name;
@FXML private TextField email;
@FXML private CheckBox fam_last;
@FXML private Button submit;
@FXML private GridPane pane;
| private Account account; |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithAnnotationsDisablePagingTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithAnnotationsDisablePaging.java
// @Model(value = "Sch.Bean2", idProperty = "id", paging = false, readMethod = "read",
// messageProperty = "theMessageProperty", disablePagingParameters = true)
// public class BeanWithAnnotationsDisablePaging extends Base {
//
// @Pattern(regexp = "[a-zA-Z]*")
// private String name;
//
// @ModelField(dateFormat = "c")
// private Date dob;
//
// @JsonIgnore
// private String password;
//
// @Size(max = 10, min = 2)
// private String accountNo;
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Date getDob() {
// return this.dob;
// }
//
// public void setDob(Date dob) {
// this.dob = dob;
// }
//
// public String getPassword() {
// return this.password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// @JsonIgnore
// public String getAccountNo() {
// return this.accountNo;
// }
//
// public void setAccountNo(String accountNo) {
// this.accountNo = accountNo;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
//
// ModelFieldBean field = new ModelFieldBean("id", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("dob", ModelType.DATE);
// field.setDateFormat("c");
// expectedFields.add(field);
//
// }
//
// }
| import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithAnnotationsDisablePaging; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithAnnotationsDisablePagingTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithAnnotationsDisablePaging.java
// @Model(value = "Sch.Bean2", idProperty = "id", paging = false, readMethod = "read",
// messageProperty = "theMessageProperty", disablePagingParameters = true)
// public class BeanWithAnnotationsDisablePaging extends Base {
//
// @Pattern(regexp = "[a-zA-Z]*")
// private String name;
//
// @ModelField(dateFormat = "c")
// private Date dob;
//
// @JsonIgnore
// private String password;
//
// @Size(max = 10, min = 2)
// private String accountNo;
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Date getDob() {
// return this.dob;
// }
//
// public void setDob(Date dob) {
// this.dob = dob;
// }
//
// public String getPassword() {
// return this.password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// @JsonIgnore
// public String getAccountNo() {
// return this.accountNo;
// }
//
// public void setAccountNo(String accountNo) {
// this.accountNo = accountNo;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
//
// ModelFieldBean field = new ModelFieldBean("id", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("dob", ModelType.DATE);
// field.setDateFormat("c");
// expectedFields.add(field);
//
// }
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithAnnotationsDisablePagingTest.java
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithAnnotationsDisablePaging;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithAnnotationsDisablePagingTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | GeneratorTestUtil.testGenerateJavascript(BeanWithAnnotationsDisablePaging.class, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithAnnotations3Test.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithAnnotations3.java
// @Model(value = "Sch.Bean3", idProperty = "id", readMethod = "read",
// messageProperty = "theMessageProperty", rootProperty = "theRootProperty",
// successProperty = "theSuccessProperty", totalProperty = "theTotalProperty")
// public class BeanWithAnnotations3 {
//
// private String id;
//
// private String name;
//
// public String getId() {
// return this.id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
// ModelFieldBean field = new ModelFieldBean("id", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
// }
//
// }
| import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithAnnotations3; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithAnnotations3Test {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithAnnotations3.java
// @Model(value = "Sch.Bean3", idProperty = "id", readMethod = "read",
// messageProperty = "theMessageProperty", rootProperty = "theRootProperty",
// successProperty = "theSuccessProperty", totalProperty = "theTotalProperty")
// public class BeanWithAnnotations3 {
//
// private String id;
//
// private String name;
//
// public String getId() {
// return this.id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
// ModelFieldBean field = new ModelFieldBean("id", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
// }
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithAnnotations3Test.java
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithAnnotations3;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithAnnotations3Test {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | GeneratorTestUtil.testGenerateJavascript(BeanWithAnnotations3.class, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithAnnotations2Test.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithAnnotations2.java
// @Model(value = "Sch.Bean2", idProperty = "id", paging = false, readMethod = "read",
// messageProperty = "theMessageProperty")
// public class BeanWithAnnotations2 extends Base {
//
// @Pattern(regexp = "[a-zA-Z]*")
// private String name;
//
// @ModelField(dateFormat = "c")
// private Date dob;
//
// @JsonIgnore
// private String password;
//
// @Size(max = 10, min = 2)
// private String accountNo;
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Date getDob() {
// return this.dob;
// }
//
// public void setDob(Date dob) {
// this.dob = dob;
// }
//
// public String getPassword() {
// return this.password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// @JsonIgnore
// public String getAccountNo() {
// return this.accountNo;
// }
//
// public void setAccountNo(String accountNo) {
// this.accountNo = accountNo;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
//
// ModelFieldBean field = new ModelFieldBean("id", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("dob", ModelType.DATE);
// field.setDateFormat("c");
// expectedFields.add(field);
//
// }
//
// }
| import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithAnnotations2; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithAnnotations2Test {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithAnnotations2.java
// @Model(value = "Sch.Bean2", idProperty = "id", paging = false, readMethod = "read",
// messageProperty = "theMessageProperty")
// public class BeanWithAnnotations2 extends Base {
//
// @Pattern(regexp = "[a-zA-Z]*")
// private String name;
//
// @ModelField(dateFormat = "c")
// private Date dob;
//
// @JsonIgnore
// private String password;
//
// @Size(max = 10, min = 2)
// private String accountNo;
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Date getDob() {
// return this.dob;
// }
//
// public void setDob(Date dob) {
// this.dob = dob;
// }
//
// public String getPassword() {
// return this.password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// @JsonIgnore
// public String getAccountNo() {
// return this.accountNo;
// }
//
// public void setAccountNo(String accountNo) {
// this.accountNo = accountNo;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
//
// ModelFieldBean field = new ModelFieldBean("id", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("dob", ModelType.DATE);
// field.setDateFormat("c");
// expectedFields.add(field);
//
// }
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithAnnotations2Test.java
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithAnnotations2;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithAnnotations2Test {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | GeneratorTestUtil.testGenerateJavascript(BeanWithAnnotations2.class, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithCustomTypeTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithCustomType.java
// @Model(value = "Sch.BeanWithCustomType")
// public class BeanWithCustomType {
//
// private String id;
//
// @ModelField(type = ModelType.INTEGER)
// private int age;
//
// @ModelField(type = ModelType.STRING, customType = "city")
// private String city;
//
// @ModelField(customType = "email")
// private String email;
//
// @ModelField(customType = "creditcardnumber")
// private String creditcardnumber;
//
// public String getId() {
// return this.id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public int getAge() {
// return this.age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// public String getCity() {
// return this.city;
// }
//
// public void setCity(String city) {
// this.city = city;
// }
//
// public String getEmail() {
// return this.email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getCreditcardnumber() {
// return this.creditcardnumber;
// }
//
// public void setCreditcardnumber(String creditcardnumber) {
// this.creditcardnumber = creditcardnumber;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
// ModelFieldBean field = new ModelFieldBean("id", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("age", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("city", "city");
// expectedFields.add(field);
//
// field = new ModelFieldBean("email", "email");
// expectedFields.add(field);
//
// field = new ModelFieldBean("creditcardnumber", "creditcardnumber");
// expectedFields.add(field);
//
// }
//
// }
| import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithCustomType; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithCustomTypeTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/BeanWithCustomType.java
// @Model(value = "Sch.BeanWithCustomType")
// public class BeanWithCustomType {
//
// private String id;
//
// @ModelField(type = ModelType.INTEGER)
// private int age;
//
// @ModelField(type = ModelType.STRING, customType = "city")
// private String city;
//
// @ModelField(customType = "email")
// private String email;
//
// @ModelField(customType = "creditcardnumber")
// private String creditcardnumber;
//
// public String getId() {
// return this.id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public int getAge() {
// return this.age;
// }
//
// public void setAge(int age) {
// this.age = age;
// }
//
// public String getCity() {
// return this.city;
// }
//
// public void setCity(String city) {
// this.city = city;
// }
//
// public String getEmail() {
// return this.email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getCreditcardnumber() {
// return this.creditcardnumber;
// }
//
// public void setCreditcardnumber(String creditcardnumber) {
// this.creditcardnumber = creditcardnumber;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
// ModelFieldBean field = new ModelFieldBean("id", ModelType.STRING);
// expectedFields.add(field);
//
// field = new ModelFieldBean("age", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("city", "city");
// expectedFields.add(field);
//
// field = new ModelFieldBean("email", "email");
// expectedFields.add(field);
//
// field = new ModelFieldBean("creditcardnumber", "creditcardnumber");
// expectedFields.add(field);
//
// }
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorBeanWithCustomTypeTest.java
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.BeanWithCustomType;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorBeanWithCustomTypeTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | GeneratorTestUtil.testGenerateJavascript(BeanWithCustomType.class, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorPartialApiTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/PartialApi.java
// @Model(value = "App.PartialApi", readMethod = "read", destroyMethod = "destroy")
// public class PartialApi {
// private int id;
//
// private String name;
//
// public int getId() {
// return this.id;
// }
//
// public void setId(int id) {
// this.id = id;
// }
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
//
// ModelFieldBean field = new ModelFieldBean("id", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
//
// }
// }
| import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.PartialApi; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorPartialApiTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/PartialApi.java
// @Model(value = "App.PartialApi", readMethod = "read", destroyMethod = "destroy")
// public class PartialApi {
// private int id;
//
// private String name;
//
// public int getId() {
// return this.id;
// }
//
// public void setId(int id) {
// this.id = id;
// }
//
// public String getName() {
// return this.name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public static List<ModelFieldBean> expectedFields = new ArrayList<>();
//
// static {
//
// ModelFieldBean field = new ModelFieldBean("id", ModelType.INTEGER);
// expectedFields.add(field);
//
// field = new ModelFieldBean("name", ModelType.STRING);
// expectedFields.add(field);
//
// }
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorPartialApiTest.java
import static org.assertj.core.api.Assertions.assertThat;
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.PartialApi;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorPartialApiTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testWithQuotes() { | GeneratorTestUtil.testGenerateJavascript(PartialApi.class, "PartialApi", true, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorInterfaceTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/User.java
// @Model
// public interface User {
//
// @ModelField
// UUID getId();
//
// @NotEmpty
// @Email
// @Size(max = 128)
// String getEmail();
//
// }
| import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.User; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorInterfaceTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testInterfaceExtJs4() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/User.java
// @Model
// public interface User {
//
// @ModelField
// UUID getId();
//
// @NotEmpty
// @Email
// @Size(max = 128)
// String getEmail();
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorInterfaceTest.java
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.User;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorInterfaceTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testInterfaceExtJs4() { | ModelBean modelBean = ModelGenerator.createModel(User.class, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorDataOptionsTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAll.java
// @Model(value = "User", allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAll {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAllAndPartial.java
// @Model(value = "User",
// partialDataOptions = @PartialDataOptions(associated = true, critical = false),
// allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAllAndPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsPartial.java
// @Model(value = "User", partialDataOptions = @PartialDataOptions(associated = true))
// public class UserDataOptionsPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
| import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAll;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAllAndPartial;
import ch.rasc.extclassgenerator.bean.UserDataOptionsPartial; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorDataOptionsTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testAllDataOptionsExtJs4() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAll.java
// @Model(value = "User", allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAll {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAllAndPartial.java
// @Model(value = "User",
// partialDataOptions = @PartialDataOptions(associated = true, critical = false),
// allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAllAndPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsPartial.java
// @Model(value = "User", partialDataOptions = @PartialDataOptions(associated = true))
// public class UserDataOptionsPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorDataOptionsTest.java
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAll;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAllAndPartial;
import ch.rasc.extclassgenerator.bean.UserDataOptionsPartial;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorDataOptionsTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testAllDataOptionsExtJs4() { | ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsAll.class, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorDataOptionsTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAll.java
// @Model(value = "User", allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAll {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAllAndPartial.java
// @Model(value = "User",
// partialDataOptions = @PartialDataOptions(associated = true, critical = false),
// allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAllAndPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsPartial.java
// @Model(value = "User", partialDataOptions = @PartialDataOptions(associated = true))
// public class UserDataOptionsPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
| import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAll;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAllAndPartial;
import ch.rasc.extclassgenerator.bean.UserDataOptionsPartial; |
GeneratorTestUtil.compareExtJs4Code("UserDataOptionsAll", code, false, false);
}
@Test
public void testAllDataOptionsExtJs5() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsAll.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.EXTJS5);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareExtJs5Code("UserDataOptionsAll", code, false, false);
}
@Test
public void testAllDataOptionsTouch2() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsAll.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.TOUCH2);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareTouch2Code("UserDataOptionsAll", code, false, false);
}
@Test
public void testPartialDataOptionsExtJs4() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAll.java
// @Model(value = "User", allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAll {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAllAndPartial.java
// @Model(value = "User",
// partialDataOptions = @PartialDataOptions(associated = true, critical = false),
// allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAllAndPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsPartial.java
// @Model(value = "User", partialDataOptions = @PartialDataOptions(associated = true))
// public class UserDataOptionsPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorDataOptionsTest.java
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAll;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAllAndPartial;
import ch.rasc.extclassgenerator.bean.UserDataOptionsPartial;
GeneratorTestUtil.compareExtJs4Code("UserDataOptionsAll", code, false, false);
}
@Test
public void testAllDataOptionsExtJs5() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsAll.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.EXTJS5);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareExtJs5Code("UserDataOptionsAll", code, false, false);
}
@Test
public void testAllDataOptionsTouch2() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsAll.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.TOUCH2);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareTouch2Code("UserDataOptionsAll", code, false, false);
}
@Test
public void testPartialDataOptionsExtJs4() { | ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsPartial.class, |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorDataOptionsTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAll.java
// @Model(value = "User", allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAll {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAllAndPartial.java
// @Model(value = "User",
// partialDataOptions = @PartialDataOptions(associated = true, critical = false),
// allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAllAndPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsPartial.java
// @Model(value = "User", partialDataOptions = @PartialDataOptions(associated = true))
// public class UserDataOptionsPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
| import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAll;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAllAndPartial;
import ch.rasc.extclassgenerator.bean.UserDataOptionsPartial; | GeneratorTestUtil.compareExtJs4Code("UserDataOptionsPartial", code, false, false);
}
@Test
public void testPartialDataOptionsExtJs5() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsPartial.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.EXTJS5);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareExtJs5Code("UserDataOptionsPartial", code, false, false);
}
@Test
public void testPartialDataOptionsTouch2() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsPartial.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.TOUCH2);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareTouch2Code("UserDataOptionsPartial", code, false, false);
}
@Test
public void testAllAndPartialDataOptionsExtJs4() {
ModelBean modelBean = ModelGenerator | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAll.java
// @Model(value = "User", allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAll {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsAllAndPartial.java
// @Model(value = "User",
// partialDataOptions = @PartialDataOptions(associated = true, critical = false),
// allDataOptions = @AllDataOptions(associated = true))
// public class UserDataOptionsAllAndPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
//
// Path: src/test/java/ch/rasc/extclassgenerator/bean/UserDataOptionsPartial.java
// @Model(value = "User", partialDataOptions = @PartialDataOptions(associated = true))
// public class UserDataOptionsPartial {
//
// @ModelField
// public UUID id;
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public String email;
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorDataOptionsTest.java
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAll;
import ch.rasc.extclassgenerator.bean.UserDataOptionsAllAndPartial;
import ch.rasc.extclassgenerator.bean.UserDataOptionsPartial;
GeneratorTestUtil.compareExtJs4Code("UserDataOptionsPartial", code, false, false);
}
@Test
public void testPartialDataOptionsExtJs5() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsPartial.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.EXTJS5);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareExtJs5Code("UserDataOptionsPartial", code, false, false);
}
@Test
public void testPartialDataOptionsTouch2() {
ModelBean modelBean = ModelGenerator.createModel(UserDataOptionsPartial.class,
IncludeValidation.ALL);
OutputConfig outputConfig = new OutputConfig();
outputConfig.setOutputFormat(OutputFormat.TOUCH2);
outputConfig.setDebug(false);
String code = ModelGenerator.generateJavascript(modelBean, outputConfig);
GeneratorTestUtil.compareTouch2Code("UserDataOptionsPartial", code, false, false);
}
@Test
public void testAllAndPartialDataOptionsExtJs4() {
ModelBean modelBean = ModelGenerator | .createModel(UserDataOptionsAllAndPartial.class, IncludeValidation.ALL); |
ralscha/extclassgenerator | src/test/java/ch/rasc/extclassgenerator/ModelGeneratorMethodTest.java | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserClass.java
// @Model
// public class UserClass {
//
// private UUID id;
//
// private String email;
//
// @ModelField
// public UUID getId() {
// return this.id;
// }
//
// public void setId(UUID id) {
// this.id = id;
// }
//
// public String getEmail() {
// return this.email;
// }
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public void setEmail(String email) {
// this.email = email;
// }
//
// }
| import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserClass; | /**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorMethodTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testInterfaceExtJs4() { | // Path: src/test/java/ch/rasc/extclassgenerator/bean/UserClass.java
// @Model
// public class UserClass {
//
// private UUID id;
//
// private String email;
//
// @ModelField
// public UUID getId() {
// return this.id;
// }
//
// public void setId(UUID id) {
// this.id = id;
// }
//
// public String getEmail() {
// return this.email;
// }
//
// @NotEmpty
// @Email
// @Size(max = 128)
// public void setEmail(String email) {
// this.email = email;
// }
//
// }
// Path: src/test/java/ch/rasc/extclassgenerator/ModelGeneratorMethodTest.java
import org.junit.Before;
import org.junit.Test;
import ch.rasc.extclassgenerator.bean.UserClass;
/**
* Copyright 2013-2018 the original author or authors.
*
* 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 ch.rasc.extclassgenerator;
public class ModelGeneratorMethodTest {
@Before
public void clearCaches() {
ModelGenerator.clearCaches();
}
@Test
public void testInterfaceExtJs4() { | ModelBean modelBean = ModelGenerator.createModel(UserClass.class, |
spotify/trickle | src/test/java/com/spotify/trickle/NodeExecutionFallbackTest.java | // Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import org.junit.Before;
import org.junit.Test;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; | currentCallInfo = new CallInfo(currentNodeInfo, NO_PARAMS);
fallback = new NodeExecutionFallback<String>(graphBuilder, currentCall, traverseState);
}
@Test
public void shouldNotWrapGraphExecutionException() throws Exception {
Throwable expected = new GraphExecutionException(null, currentCallInfo, NO_CALLS);
ListenableFuture<String> future = fallback.create(expected);
try {
future.get();
fail("expected an exception");
} catch (ExecutionException e) {
assertThat(e.getCause(), equalTo(expected));
}
}
@Test
public void shouldWrapGeneralException() throws Exception {
Throwable expected = new RuntimeException("expected");
ListenableFuture<String> future = fallback.create(expected);
try {
future.get();
fail("expected an exception");
} catch (ExecutionException e) {
assertThat(e.getCause(), not(equalTo(expected))); | // Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/NodeExecutionFallbackTest.java
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import org.junit.Before;
import org.junit.Test;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
currentCallInfo = new CallInfo(currentNodeInfo, NO_PARAMS);
fallback = new NodeExecutionFallback<String>(graphBuilder, currentCall, traverseState);
}
@Test
public void shouldNotWrapGraphExecutionException() throws Exception {
Throwable expected = new GraphExecutionException(null, currentCallInfo, NO_CALLS);
ListenableFuture<String> future = fallback.create(expected);
try {
future.get();
fail("expected an exception");
} catch (ExecutionException e) {
assertThat(e.getCause(), equalTo(expected));
}
}
@Test
public void shouldWrapGeneralException() throws Exception {
Throwable expected = new RuntimeException("expected");
ListenableFuture<String> future = fallback.create(expected);
try {
future.get();
fail("expected an exception");
} catch (ExecutionException e) {
assertThat(e.getCause(), not(equalTo(expected))); | assertThat(e, hasAncestor(expected)); |
spotify/trickle | src/test/java/com/spotify/trickle/TrickleTest.java | // Path: src/main/java/com/spotify/trickle/Fallbacks.java
// public static <T> AsyncFunction<Throwable, T> always(@Nullable final T value) {
// return new AsyncFunction<Throwable, T>() {
// @Nullable
// @Override
// public ListenableFuture<T> apply(@Nullable Throwable input) {
// return immediateFuture(value);
// }
// };
// }
//
// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Fallbacks.always;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | /*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Integration-level Trickle tests.
*/
public class TrickleTest {
Func0<String> node1;
SettableFuture<String> future1;
ListeningExecutorService executorService;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() throws Exception {
future1 = SettableFuture.create();
node1 = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
return future1;
}
};
executorService = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
}
@After
public void shutdown() {
executorService.shutdown();
}
@Test
public void shouldConstructSingleNodeGraph() throws Exception { | // Path: src/main/java/com/spotify/trickle/Fallbacks.java
// public static <T> AsyncFunction<Throwable, T> always(@Nullable final T value) {
// return new AsyncFunction<Throwable, T>() {
// @Nullable
// @Override
// public ListenableFuture<T> apply(@Nullable Throwable input) {
// return immediateFuture(value);
// }
// };
// }
//
// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/TrickleTest.java
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Fallbacks.always;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
/*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Integration-level Trickle tests.
*/
public class TrickleTest {
Func0<String> node1;
SettableFuture<String> future1;
ListeningExecutorService executorService;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() throws Exception {
future1 = SettableFuture.create();
node1 = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
return future1;
}
};
executorService = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());
}
@After
public void shutdown() {
executorService.shutdown();
}
@Test
public void shouldConstructSingleNodeGraph() throws Exception { | Graph<String> graph = call(node1); |
spotify/trickle | src/test/java/com/spotify/trickle/TrickleTest.java | // Path: src/main/java/com/spotify/trickle/Fallbacks.java
// public static <T> AsyncFunction<Throwable, T> always(@Nullable final T value) {
// return new AsyncFunction<Throwable, T>() {
// @Nullable
// @Override
// public ListenableFuture<T> apply(@Nullable Throwable input) {
// return immediateFuture(value);
// }
// };
// }
//
// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Fallbacks.always;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | @Test
public void shouldForwardValues() throws Exception {
Func0<String> first = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
return immediateFuture("hi there!");
}
};
Func1<String, Integer> second = new Func1<String, Integer>() {
@Override
public ListenableFuture<Integer> run(String arg) {
return immediateFuture(arg.length());
}
};
Graph<String> g1 = call(first);
Graph<Integer> graph = call(second).with(g1);
assertThat(graph.run().get(), equalTo("hi there!".length()));
}
@Test
public void shouldReturnDefaultForFailedCallWithDefault() throws Exception {
Func0<String> node = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
throw new RuntimeException("expected");
}
};
| // Path: src/main/java/com/spotify/trickle/Fallbacks.java
// public static <T> AsyncFunction<Throwable, T> always(@Nullable final T value) {
// return new AsyncFunction<Throwable, T>() {
// @Nullable
// @Override
// public ListenableFuture<T> apply(@Nullable Throwable input) {
// return immediateFuture(value);
// }
// };
// }
//
// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/TrickleTest.java
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Fallbacks.always;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@Test
public void shouldForwardValues() throws Exception {
Func0<String> first = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
return immediateFuture("hi there!");
}
};
Func1<String, Integer> second = new Func1<String, Integer>() {
@Override
public ListenableFuture<Integer> run(String arg) {
return immediateFuture(arg.length());
}
};
Graph<String> g1 = call(first);
Graph<Integer> graph = call(second).with(g1);
assertThat(graph.run().get(), equalTo("hi there!".length()));
}
@Test
public void shouldReturnDefaultForFailedCallWithDefault() throws Exception {
Func0<String> node = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
throw new RuntimeException("expected");
}
};
| Graph<String> graph = call(node).fallback(always("fallback response")); |
spotify/trickle | src/test/java/com/spotify/trickle/TrickleTest.java | // Path: src/main/java/com/spotify/trickle/Fallbacks.java
// public static <T> AsyncFunction<Throwable, T> always(@Nullable final T value) {
// return new AsyncFunction<Throwable, T>() {
// @Nullable
// @Override
// public ListenableFuture<T> apply(@Nullable Throwable input) {
// return immediateFuture(value);
// }
// };
// }
//
// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Fallbacks.always;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | .bind(input2, "hum")
.bind(input3, "häpp")
.bind(input4, "Luis")
.run().get();
assertThat(result, equalTo("hey, 1, hey, ho, hum, häpp, Luis, 2"));
}
@Test
public void shouldPropagateExceptionsToResultFuture() throws Exception {
final RuntimeException expected = new RuntimeException("expected");
Func1<String, String> node1 = new Func1<String, String>() {
@Override
public ListenableFuture<String> run(String arg) {
return immediateFailedFuture(expected);
}
};
Func2<String, String, String> node2 = new Func2<String, String, String>() {
@Override
public ListenableFuture<String> run(String arg1, String arg2) {
return immediateFuture(arg1 + ", " + arg2 + ", 2");
}
};
Input<String> input = Input.named("in");
Graph<String> g1 = call(node1).with(input);
Graph<String> g = call(node2).with(g1, input);
thrown.expect(Exception.class); | // Path: src/main/java/com/spotify/trickle/Fallbacks.java
// public static <T> AsyncFunction<Throwable, T> always(@Nullable final T value) {
// return new AsyncFunction<Throwable, T>() {
// @Nullable
// @Override
// public ListenableFuture<T> apply(@Nullable Throwable input) {
// return immediateFuture(value);
// }
// };
// }
//
// Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/TrickleTest.java
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Fallbacks.always;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
.bind(input2, "hum")
.bind(input3, "häpp")
.bind(input4, "Luis")
.run().get();
assertThat(result, equalTo("hey, 1, hey, ho, hum, häpp, Luis, 2"));
}
@Test
public void shouldPropagateExceptionsToResultFuture() throws Exception {
final RuntimeException expected = new RuntimeException("expected");
Func1<String, String> node1 = new Func1<String, String>() {
@Override
public ListenableFuture<String> run(String arg) {
return immediateFailedFuture(expected);
}
};
Func2<String, String, String> node2 = new Func2<String, String, String>() {
@Override
public ListenableFuture<String> run(String arg1, String arg2) {
return immediateFuture(arg1 + ", " + arg2 + ", 2");
}
};
Input<String> input = Input.named("in");
Graph<String> g1 = call(node1).with(input);
Graph<String> g = call(node2).with(g1, input);
thrown.expect(Exception.class); | thrown.expectCause(hasAncestor(expected)); |
spotify/trickle | src/test/java/com/spotify/trickle/TrickleErrorHandlingTest.java | // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail; | /*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Tests of error handling/troubleshooting support.
*/
public class TrickleErrorHandlingTest {
private static final String INPUT_TO_FAILING_NODE = "report name and length";
private Input<String> debugInfoInput;
private Graph<Integer> debugInfoLength;
private Graph<String> debugInfoReport;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() throws Exception {
debugInfoInput = Input.named("weirdName");
}
@Test
public void shouldReportFailingNodeWithDebugOff() throws Exception {
RuntimeException expected = new RuntimeException("expected");
Graph<String> g = | // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/TrickleErrorHandlingTest.java
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
/*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Tests of error handling/troubleshooting support.
*/
public class TrickleErrorHandlingTest {
private static final String INPUT_TO_FAILING_NODE = "report name and length";
private Input<String> debugInfoInput;
private Graph<Integer> debugInfoLength;
private Graph<String> debugInfoReport;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() throws Exception {
debugInfoInput = Input.named("weirdName");
}
@Test
public void shouldReportFailingNodeWithDebugOff() throws Exception {
RuntimeException expected = new RuntimeException("expected");
Graph<String> g = | call(failingFunction(expected)).with(setupDebugInfoGraph()).named("the node that fails") |
spotify/trickle | src/test/java/com/spotify/trickle/TrickleErrorHandlingTest.java | // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail; | RuntimeException expected = new RuntimeException("expected");
Graph<String> g =
call(failingFunction(expected)).with(setupDebugInfoGraph()).named("the node that fails")
.bind(debugInfoInput, "fail me").debug(false);
thrown.expectMessage("the node that fails");
thrown.expectMessage(INPUT_TO_FAILING_NODE);
g.run().get();
}
@Test
public void shouldReportFailingNodeWithDebugOn() throws Exception {
RuntimeException expected = new RuntimeException("expected");
Graph<String> g =
call(failingFunction(expected)).with(setupDebugInfoGraph()).named("the node that fails")
.bind(debugInfoInput, "fail me").debug(true);
thrown.expectMessage("the node that fails");
thrown.expectMessage(INPUT_TO_FAILING_NODE);
g.run().get();
}
@Test
public void shouldReportOriginalExceptionOnFailureWithDebugOff() throws Exception {
RuntimeException expected = new RuntimeException("expected");
Graph<String> g = call(failingFunction(expected)).with(setupDebugInfoGraph()).named("failure")
.bind(debugInfoInput, "fail me").debug(false);
| // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/TrickleErrorHandlingTest.java
import com.google.common.base.Function;
import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import static com.google.common.collect.Lists.newArrayList;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;
import static com.spotify.trickle.Util.hasAncestor;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
RuntimeException expected = new RuntimeException("expected");
Graph<String> g =
call(failingFunction(expected)).with(setupDebugInfoGraph()).named("the node that fails")
.bind(debugInfoInput, "fail me").debug(false);
thrown.expectMessage("the node that fails");
thrown.expectMessage(INPUT_TO_FAILING_NODE);
g.run().get();
}
@Test
public void shouldReportFailingNodeWithDebugOn() throws Exception {
RuntimeException expected = new RuntimeException("expected");
Graph<String> g =
call(failingFunction(expected)).with(setupDebugInfoGraph()).named("the node that fails")
.bind(debugInfoInput, "fail me").debug(true);
thrown.expectMessage("the node that fails");
thrown.expectMessage(INPUT_TO_FAILING_NODE);
g.run().get();
}
@Test
public void shouldReportOriginalExceptionOnFailureWithDebugOff() throws Exception {
RuntimeException expected = new RuntimeException("expected");
Graph<String> g = call(failingFunction(expected)).with(setupDebugInfoGraph()).named("failure")
.bind(debugInfoInput, "fail me").debug(false);
| thrown.expect(hasAncestor(expected)); |
spotify/trickle | src/main/java/com/spotify/trickle/NodeExecutionFallback.java | // Path: src/main/java/com/spotify/trickle/GraphExceptionWrapper.java
// public static Throwable wrapException(Throwable t,
// TraverseState.FutureCallInformation currentCall,
// TraverseState traverseState) {
// return new GraphExecutionException(t, asCallInfo(currentCall), callInfos(traverseState));
// }
| import com.google.common.util.concurrent.FutureFallback;
import com.google.common.util.concurrent.ListenableFuture;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.spotify.trickle.GraphExceptionWrapper.wrapException; | /*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Fallback that handles errors when executing a graph node.
*/
class NodeExecutionFallback<R> implements FutureFallback<R> {
private final TraverseState.FutureCallInformation currentCall;
private final TraverseState state;
private final GraphBuilder<R> graph;
public NodeExecutionFallback(GraphBuilder<R> graph,
TraverseState.FutureCallInformation currentCall,
TraverseState state) {
this.currentCall = checkNotNull(currentCall);
this.state = checkNotNull(state);
this.graph = checkNotNull(graph);
}
@Override
public ListenableFuture<R> create(Throwable t) {
if (graph.getFallback().isPresent()) {
try {
return graph.getFallback().get().apply(t);
} catch (Exception e) {
return immediateFailedFuture(wrapIfNeeded(e));
}
}
return immediateFailedFuture(wrapIfNeeded(t));
}
private Throwable wrapIfNeeded(Throwable t) {
if (t instanceof GraphExecutionException) {
return t;
}
| // Path: src/main/java/com/spotify/trickle/GraphExceptionWrapper.java
// public static Throwable wrapException(Throwable t,
// TraverseState.FutureCallInformation currentCall,
// TraverseState traverseState) {
// return new GraphExecutionException(t, asCallInfo(currentCall), callInfos(traverseState));
// }
// Path: src/main/java/com/spotify/trickle/NodeExecutionFallback.java
import com.google.common.util.concurrent.FutureFallback;
import com.google.common.util.concurrent.ListenableFuture;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.spotify.trickle.GraphExceptionWrapper.wrapException;
/*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Fallback that handles errors when executing a graph node.
*/
class NodeExecutionFallback<R> implements FutureFallback<R> {
private final TraverseState.FutureCallInformation currentCall;
private final TraverseState state;
private final GraphBuilder<R> graph;
public NodeExecutionFallback(GraphBuilder<R> graph,
TraverseState.FutureCallInformation currentCall,
TraverseState state) {
this.currentCall = checkNotNull(currentCall);
this.state = checkNotNull(state);
this.graph = checkNotNull(graph);
}
@Override
public ListenableFuture<R> create(Throwable t) {
if (graph.getFallback().isPresent()) {
try {
return graph.getFallback().get().apply(t);
} catch (Exception e) {
return immediateFailedFuture(wrapIfNeeded(e));
}
}
return immediateFailedFuture(wrapIfNeeded(t));
}
private Throwable wrapIfNeeded(Throwable t) {
if (t instanceof GraphExecutionException) {
return t;
}
| return wrapException(t, currentCall, state); |
spotify/trickle | src/test/java/com/spotify/trickle/TrickleApiTest.java | // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
| import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call; | /*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Integration-level Trickle tests.
*/
public class TrickleApiTest {
public static final String DUPLICATE_BINDING_FOR_INPUT = "Duplicate binding for input";
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void shouldThrowForMissingInput() throws Exception {
Func1<String, String> node1 = new Func1<String, String>() {
@Override
public ListenableFuture<String> run(String arg) {
return immediateFuture(arg + ", 1");
}
};
Input<String> input = Input.named("somethingWeirdd");
| // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
// Path: src/test/java/com/spotify/trickle/TrickleApiTest.java
import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;
/*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
/**
* Integration-level Trickle tests.
*/
public class TrickleApiTest {
public static final String DUPLICATE_BINDING_FOR_INPUT = "Duplicate binding for input";
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void shouldThrowForMissingInput() throws Exception {
Func1<String, String> node1 = new Func1<String, String>() {
@Override
public ListenableFuture<String> run(String arg) {
return immediateFuture(arg + ", 1");
}
};
Input<String> input = Input.named("somethingWeirdd");
| Graph<String> g = call(node1).with(input); |
spotify/trickle | src/test/java/com/spotify/trickle/GraphExceptionWrapperTest.java | // Path: src/main/java/com/spotify/trickle/GraphExceptionWrapper.java
// public static Throwable wrapException(Throwable t,
// TraverseState.FutureCallInformation currentCall,
// TraverseState traverseState) {
// return new GraphExecutionException(t, asCallInfo(currentCall), callInfos(traverseState));
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.GraphExceptionWrapper.wrapException;
import static com.spotify.trickle.Util.hasAncestor;
import static java.util.Collections.emptyList;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat; | /*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public class GraphExceptionWrapperTest {
private static final List<NodeInfo> NO_ARGS = Collections.emptyList();
private static final List<ListenableFuture<?>> NO_VALUES = emptyList();
Throwable t;
TraverseState traverseState;
TraverseState.FutureCallInformation currentCall;
NodeInfo currentNodeInfo;
List<ListenableFuture<?>> currentNodeValues;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() throws Exception {
t = new RuntimeException("the original problem");
Map<Input<?>, Object> emptyMap = Collections.emptyMap();
traverseState = new TraverseState(emptyMap, MoreExecutors.sameThreadExecutor(), true);
List<? extends NodeInfo> currentNodeParameters = ImmutableList.of(
new FakeNodeInfo("arg1", Collections .<NodeInfo>emptyList()),
new FakeNodeInfo("argument 2", Collections .<NodeInfo>emptyList())
);
currentNodeInfo = new FakeNodeInfo("the node", currentNodeParameters);
currentNodeValues = ImmutableList.<ListenableFuture<?>>of(
immediateFuture("value 1"),
immediateFuture("andra värdet")
);
currentCall = new TraverseState.FutureCallInformation(currentNodeInfo, currentNodeValues);
}
@Test
public void shouldHaveOriginalExceptionAsCause() throws Exception { | // Path: src/main/java/com/spotify/trickle/GraphExceptionWrapper.java
// public static Throwable wrapException(Throwable t,
// TraverseState.FutureCallInformation currentCall,
// TraverseState traverseState) {
// return new GraphExecutionException(t, asCallInfo(currentCall), callInfos(traverseState));
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/GraphExceptionWrapperTest.java
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.GraphExceptionWrapper.wrapException;
import static com.spotify.trickle.Util.hasAncestor;
import static java.util.Collections.emptyList;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public class GraphExceptionWrapperTest {
private static final List<NodeInfo> NO_ARGS = Collections.emptyList();
private static final List<ListenableFuture<?>> NO_VALUES = emptyList();
Throwable t;
TraverseState traverseState;
TraverseState.FutureCallInformation currentCall;
NodeInfo currentNodeInfo;
List<ListenableFuture<?>> currentNodeValues;
@Rule
public ExpectedException thrown = ExpectedException.none();
@Before
public void setUp() throws Exception {
t = new RuntimeException("the original problem");
Map<Input<?>, Object> emptyMap = Collections.emptyMap();
traverseState = new TraverseState(emptyMap, MoreExecutors.sameThreadExecutor(), true);
List<? extends NodeInfo> currentNodeParameters = ImmutableList.of(
new FakeNodeInfo("arg1", Collections .<NodeInfo>emptyList()),
new FakeNodeInfo("argument 2", Collections .<NodeInfo>emptyList())
);
currentNodeInfo = new FakeNodeInfo("the node", currentNodeParameters);
currentNodeValues = ImmutableList.<ListenableFuture<?>>of(
immediateFuture("value 1"),
immediateFuture("andra värdet")
);
currentCall = new TraverseState.FutureCallInformation(currentNodeInfo, currentNodeValues);
}
@Test
public void shouldHaveOriginalExceptionAsCause() throws Exception { | assertThat(wrapException(t, currentCall, traverseState).getCause(), equalTo(t)); |
spotify/trickle | src/test/java/com/spotify/trickle/GraphExceptionWrapperTest.java | // Path: src/main/java/com/spotify/trickle/GraphExceptionWrapper.java
// public static Throwable wrapException(Throwable t,
// TraverseState.FutureCallInformation currentCall,
// TraverseState traverseState) {
// return new GraphExecutionException(t, asCallInfo(currentCall), callInfos(traverseState));
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
| import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.GraphExceptionWrapper.wrapException;
import static com.spotify.trickle.Util.hasAncestor;
import static java.util.Collections.emptyList;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat; |
assertThat(found1, is(true));
assertThat(found2, is(false));
}
@Test
public void shouldReportIncompleteInputs() throws Exception {
ListenableFuture<Object> element = SettableFuture.create();
List<ListenableFuture<?>> parameterValues = ImmutableList.of(
immediateFuture("hi"),
element
);
currentCall = new TraverseState.FutureCallInformation(currentNodeInfo, parameterValues);
String message = wrapException(t, currentCall, traverseState).getMessage();
assertThat(message, containsString("NOT TERMINATED FUTURE"));
}
@Test
public void shouldThrowForFailedInputs() throws Exception {
RuntimeException inputException = new RuntimeException("failing input");
List<ListenableFuture<?>> parameterValues = ImmutableList.of(
immediateFailedFuture(inputException),
immediateFuture("hi")
);
currentCall = new TraverseState.FutureCallInformation(currentNodeInfo, parameterValues);
| // Path: src/main/java/com/spotify/trickle/GraphExceptionWrapper.java
// public static Throwable wrapException(Throwable t,
// TraverseState.FutureCallInformation currentCall,
// TraverseState traverseState) {
// return new GraphExecutionException(t, asCallInfo(currentCall), callInfos(traverseState));
// }
//
// Path: src/test/java/com/spotify/trickle/Util.java
// static Matcher<Throwable> hasAncestor(final Throwable expected) {
// return new TypeSafeMatcher<Throwable>() {
// @Override
// protected boolean matchesSafely(Throwable item) {
// for (Throwable cause = item ; cause != null ; cause = cause.getCause()) {
// if (cause.equals(expected)) {
// return true;
// }
// }
//
// return false;
// }
//
// @Override
// public void describeTo(Description description) {
// description.appendText("with parent cause " + expected);
// }
// };
// }
// Path: src/test/java/com/spotify/trickle/GraphExceptionWrapperTest.java
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import static com.google.common.util.concurrent.Futures.immediateFailedFuture;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.GraphExceptionWrapper.wrapException;
import static com.spotify.trickle.Util.hasAncestor;
import static java.util.Collections.emptyList;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
assertThat(found1, is(true));
assertThat(found2, is(false));
}
@Test
public void shouldReportIncompleteInputs() throws Exception {
ListenableFuture<Object> element = SettableFuture.create();
List<ListenableFuture<?>> parameterValues = ImmutableList.of(
immediateFuture("hi"),
element
);
currentCall = new TraverseState.FutureCallInformation(currentNodeInfo, parameterValues);
String message = wrapException(t, currentCall, traverseState).getMessage();
assertThat(message, containsString("NOT TERMINATED FUTURE"));
}
@Test
public void shouldThrowForFailedInputs() throws Exception {
RuntimeException inputException = new RuntimeException("failing input");
List<ListenableFuture<?>> parameterValues = ImmutableList.of(
immediateFailedFuture(inputException),
immediateFuture("hi")
);
currentCall = new TraverseState.FutureCallInformation(currentNodeInfo, parameterValues);
| thrown.expect(hasAncestor(inputException)); |
spotify/trickle | src/test/java/com/spotify/trickle/TrickleIntrospectionTest.java | // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
| import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Before;
import org.junit.Test;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat; | /*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
public class TrickleIntrospectionTest {
Input<String> input;
Func0<String> func0;
Func1<String, String> func1;
@Before
public void setUp() throws Exception {
input = Input.named("hi");
func0 = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
return immediateFuture("hey there");
}
};
func1 = new Func1<String, String>() {
@Override
public ListenableFuture<String> run(String arg) {
return immediateFuture(arg);
}
};
}
@Test
public void shouldReturnEqualNodeInfosForSameNodeInTwoSubgraphs() throws Exception { | // Path: src/main/java/com/spotify/trickle/Trickle.java
// public static <R> ConfigurableGraph<R> call(Func0<R> func) {
// return new GraphBuilder<R>(func);
// }
// Path: src/test/java/com/spotify/trickle/TrickleIntrospectionTest.java
import com.google.common.util.concurrent.ListenableFuture;
import org.junit.Before;
import org.junit.Test;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.spotify.trickle.Trickle.call;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
/*
* Copyright 2013-2014 Spotify AB. All rights reserved.
*
* The contents of this file are 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.spotify.trickle;
public class TrickleIntrospectionTest {
Input<String> input;
Func0<String> func0;
Func1<String, String> func1;
@Before
public void setUp() throws Exception {
input = Input.named("hi");
func0 = new Func0<String>() {
@Override
public ListenableFuture<String> run() {
return immediateFuture("hey there");
}
};
func1 = new Func1<String, String>() {
@Override
public ListenableFuture<String> run(String arg) {
return immediateFuture(arg);
}
};
}
@Test
public void shouldReturnEqualNodeInfosForSameNodeInTwoSubgraphs() throws Exception { | Graph<String> root = call(func1).with(input); |
GhostFlying/PortalWaitingList | app/src/main/java/com/ghostflying/portalwaitinglist/dao/DataProvider.java | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/dbinfo/PortalEventDbInfo.java
// public class PortalEventDbInfo implements BaseColumns {
// public static final int ID = 0;
// public static final String TABLE_NAME = "event";
// public static final String COLUMN_NAME_PORTAL_NAME = "portalname";
// public static final String COLUMN_NAME_OPERATION_TYPE = "operationtype";
// public static final String COLUMN_NAME_OPERATION_RESULT = "operationresult";
// public static final String COLUMN_NAME_MESSAGE_ID = "messageid";
// public static final String COLUMN_NAME_DATE = "date";
// public static final String COLUMN_NAME_IMAGE_URL = "imageurl";
// public static final String COLUMN_NAME_ADDRESS = "address";
// public static final String COLUMN_NAME_ADDRESS_URL = "addressurl";
// }
| import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.support.annotation.NonNull;
import com.ghostflying.portalwaitinglist.BuildConfig;
import com.ghostflying.portalwaitinglist.dao.dbinfo.PortalEventDbInfo; | package com.ghostflying.portalwaitinglist.dao;
public class DataProvider extends ContentProvider {
public static final String AUTHORITY = BuildConfig.APPLICATION_ID;
private DbHelper mDbHelper;
private SQLiteDatabase mDatabase;
public DataProvider() {
}
private static final UriMatcher mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH){
{ | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/dbinfo/PortalEventDbInfo.java
// public class PortalEventDbInfo implements BaseColumns {
// public static final int ID = 0;
// public static final String TABLE_NAME = "event";
// public static final String COLUMN_NAME_PORTAL_NAME = "portalname";
// public static final String COLUMN_NAME_OPERATION_TYPE = "operationtype";
// public static final String COLUMN_NAME_OPERATION_RESULT = "operationresult";
// public static final String COLUMN_NAME_MESSAGE_ID = "messageid";
// public static final String COLUMN_NAME_DATE = "date";
// public static final String COLUMN_NAME_IMAGE_URL = "imageurl";
// public static final String COLUMN_NAME_ADDRESS = "address";
// public static final String COLUMN_NAME_ADDRESS_URL = "addressurl";
// }
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/DataProvider.java
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.support.annotation.NonNull;
import com.ghostflying.portalwaitinglist.BuildConfig;
import com.ghostflying.portalwaitinglist.dao.dbinfo.PortalEventDbInfo;
package com.ghostflying.portalwaitinglist.dao;
public class DataProvider extends ContentProvider {
public static final String AUTHORITY = BuildConfig.APPLICATION_ID;
private DbHelper mDbHelper;
private SQLiteDatabase mDatabase;
public DataProvider() {
}
private static final UriMatcher mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH){
{ | addURI(AUTHORITY, PortalEventDbInfo.TABLE_NAME, PortalEventDbInfo.ID); |
GhostFlying/PortalWaitingList | app/src/main/java/com/ghostflying/portalwaitinglist/dao/DbHelper.java | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/dbinfo/PortalEventDbInfo.java
// public class PortalEventDbInfo implements BaseColumns {
// public static final int ID = 0;
// public static final String TABLE_NAME = "event";
// public static final String COLUMN_NAME_PORTAL_NAME = "portalname";
// public static final String COLUMN_NAME_OPERATION_TYPE = "operationtype";
// public static final String COLUMN_NAME_OPERATION_RESULT = "operationresult";
// public static final String COLUMN_NAME_MESSAGE_ID = "messageid";
// public static final String COLUMN_NAME_DATE = "date";
// public static final String COLUMN_NAME_IMAGE_URL = "imageurl";
// public static final String COLUMN_NAME_ADDRESS = "address";
// public static final String COLUMN_NAME_ADDRESS_URL = "addressurl";
// }
| import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.ghostflying.portalwaitinglist.dao.dbinfo.PortalEventDbInfo; | package com.ghostflying.portalwaitinglist.dao;
/**
* Created by ghostflying on 1/14/15.
*/
public class DbHelper extends SQLiteOpenHelper{
static final int DATABASE_VERSION = 3;
static final String DATABASE_NAME = "PortalEvent.db";
private static final String TEXT_TYPE = " TEXT";
private static final String INTEGER_TYPE = " INTEGER";
private static final String COMMA_SEP = ",";
private static final String NOT_NULL = " NOT NULL"; | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/dbinfo/PortalEventDbInfo.java
// public class PortalEventDbInfo implements BaseColumns {
// public static final int ID = 0;
// public static final String TABLE_NAME = "event";
// public static final String COLUMN_NAME_PORTAL_NAME = "portalname";
// public static final String COLUMN_NAME_OPERATION_TYPE = "operationtype";
// public static final String COLUMN_NAME_OPERATION_RESULT = "operationresult";
// public static final String COLUMN_NAME_MESSAGE_ID = "messageid";
// public static final String COLUMN_NAME_DATE = "date";
// public static final String COLUMN_NAME_IMAGE_URL = "imageurl";
// public static final String COLUMN_NAME_ADDRESS = "address";
// public static final String COLUMN_NAME_ADDRESS_URL = "addressurl";
// }
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/DbHelper.java
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.ghostflying.portalwaitinglist.dao.dbinfo.PortalEventDbInfo;
package com.ghostflying.portalwaitinglist.dao;
/**
* Created by ghostflying on 1/14/15.
*/
public class DbHelper extends SQLiteOpenHelper{
static final int DATABASE_VERSION = 3;
static final String DATABASE_NAME = "PortalEvent.db";
private static final String TEXT_TYPE = " TEXT";
private static final String INTEGER_TYPE = " INTEGER";
private static final String COMMA_SEP = ",";
private static final String NOT_NULL = " NOT NULL"; | private static final String SQL_CREATE_EVENTS = "CREATE TABLE " + PortalEventDbInfo.TABLE_NAME |
GhostFlying/PortalWaitingList | app/src/main/java/com/ghostflying/portalwaitinglist/dao/datahelper/BaseHelper.java | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/DataProvider.java
// public class DataProvider extends ContentProvider {
// public static final String AUTHORITY = BuildConfig.APPLICATION_ID;
//
// private DbHelper mDbHelper;
// private SQLiteDatabase mDatabase;
//
// public DataProvider() {
//
// }
//
// private static final UriMatcher mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH){
// {
// addURI(AUTHORITY, PortalEventDbInfo.TABLE_NAME, PortalEventDbInfo.ID);
// }
// };
//
// private String getTableName(Uri uri){
// switch (mUriMatcher.match(uri)){
// case PortalEventDbInfo.ID:
// return PortalEventDbInfo.TABLE_NAME;
// default:
// return "";
// }
// }
//
// private DbHelper getDbHelper(){
// if (mDbHelper == null)
// mDbHelper = new DbHelper(getContext());
// return mDbHelper;
// }
//
// private SQLiteDatabase getDb(){
// DbHelper mHelper = getDbHelper();
// if (mDatabase == null)
// mDatabase = mHelper.getWritableDatabase();
// return mDatabase;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// // Implement this to handle requests to delete one or more rows.
// throw new UnsupportedOperationException("Delete is not supported");
// }
//
// @Override
// public String getType(Uri uri) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues values){
// synchronized (DataProvider.class){
// SQLiteDatabase mDb = getDb();
// mDb.beginTransaction();
// long rowId = 0;
// try{
// rowId = mDb.insert(getTableName(uri), null, values);
// mDb.setTransactionSuccessful();
// }
// catch (Exception e){
// e.printStackTrace();
// }
// finally {
// mDb.endTransaction();
// }
// if (rowId > 0){
// Uri returnUri = ContentUris.withAppendedId(uri, rowId);
// getContext().getContentResolver().notifyChange(uri, null);
// return returnUri;
// }
// throw new SQLException("Failed to insert to " + uri);
// }
// }
//
// @Override
// public int bulkInsert(Uri uri, @NonNull ContentValues[] values){
// synchronized (DataProvider.class){
// SQLiteDatabase mDb = getDb();
// mDb.beginTransaction();
// try{
// for (ContentValues each : values){
// mDb.insertWithOnConflict(
// getTableName(uri),
// null,
// each,
// SQLiteDatabase.CONFLICT_IGNORE
// );
// }
// mDb.setTransactionSuccessful();
// getContext().getContentResolver().notifyChange(uri, null);
// return values.length;
// }
// catch (Exception e){
// e.printStackTrace();
// }
// finally {
// mDb.endTransaction();
// }
// throw new SQLException("Failed to insert to " + uri);
// }
// }
//
// @Override
// public boolean onCreate() {
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection,
// String[] selectionArgs, String sortOrder) {
// synchronized (DataProvider.class){
// SQLiteQueryBuilder mQueryBuilder = new SQLiteQueryBuilder();
// mQueryBuilder.setTables(getTableName(uri));
// SQLiteDatabase mDb = getDb();
// Cursor mCursor = mQueryBuilder.query(
// mDb,
// projection,
// selection,
// selectionArgs,
// null,
// null,
// sortOrder
// );
// mCursor.setNotificationUri(getContext().getContentResolver(), uri);
// return mCursor;
// }
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection,
// String[] selectionArgs) {
// // TODO: Implement this to handle requests to update one or more rows.
// throw new UnsupportedOperationException("Not yet implemented");
// }
// }
| import android.content.ContentValues;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import com.ghostflying.portalwaitinglist.dao.DataProvider; | package com.ghostflying.portalwaitinglist.dao.datahelper;
/**
* Created by ghostflying on 1/19/15.
*/
public abstract class BaseHelper {
Context mContext;
Uri mUri;
public BaseHelper(Context context){
mContext = context; | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/DataProvider.java
// public class DataProvider extends ContentProvider {
// public static final String AUTHORITY = BuildConfig.APPLICATION_ID;
//
// private DbHelper mDbHelper;
// private SQLiteDatabase mDatabase;
//
// public DataProvider() {
//
// }
//
// private static final UriMatcher mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH){
// {
// addURI(AUTHORITY, PortalEventDbInfo.TABLE_NAME, PortalEventDbInfo.ID);
// }
// };
//
// private String getTableName(Uri uri){
// switch (mUriMatcher.match(uri)){
// case PortalEventDbInfo.ID:
// return PortalEventDbInfo.TABLE_NAME;
// default:
// return "";
// }
// }
//
// private DbHelper getDbHelper(){
// if (mDbHelper == null)
// mDbHelper = new DbHelper(getContext());
// return mDbHelper;
// }
//
// private SQLiteDatabase getDb(){
// DbHelper mHelper = getDbHelper();
// if (mDatabase == null)
// mDatabase = mHelper.getWritableDatabase();
// return mDatabase;
// }
//
// @Override
// public int delete(Uri uri, String selection, String[] selectionArgs) {
// // Implement this to handle requests to delete one or more rows.
// throw new UnsupportedOperationException("Delete is not supported");
// }
//
// @Override
// public String getType(Uri uri) {
// return null;
// }
//
// @Override
// public Uri insert(Uri uri, ContentValues values){
// synchronized (DataProvider.class){
// SQLiteDatabase mDb = getDb();
// mDb.beginTransaction();
// long rowId = 0;
// try{
// rowId = mDb.insert(getTableName(uri), null, values);
// mDb.setTransactionSuccessful();
// }
// catch (Exception e){
// e.printStackTrace();
// }
// finally {
// mDb.endTransaction();
// }
// if (rowId > 0){
// Uri returnUri = ContentUris.withAppendedId(uri, rowId);
// getContext().getContentResolver().notifyChange(uri, null);
// return returnUri;
// }
// throw new SQLException("Failed to insert to " + uri);
// }
// }
//
// @Override
// public int bulkInsert(Uri uri, @NonNull ContentValues[] values){
// synchronized (DataProvider.class){
// SQLiteDatabase mDb = getDb();
// mDb.beginTransaction();
// try{
// for (ContentValues each : values){
// mDb.insertWithOnConflict(
// getTableName(uri),
// null,
// each,
// SQLiteDatabase.CONFLICT_IGNORE
// );
// }
// mDb.setTransactionSuccessful();
// getContext().getContentResolver().notifyChange(uri, null);
// return values.length;
// }
// catch (Exception e){
// e.printStackTrace();
// }
// finally {
// mDb.endTransaction();
// }
// throw new SQLException("Failed to insert to " + uri);
// }
// }
//
// @Override
// public boolean onCreate() {
// return true;
// }
//
// @Override
// public Cursor query(Uri uri, String[] projection, String selection,
// String[] selectionArgs, String sortOrder) {
// synchronized (DataProvider.class){
// SQLiteQueryBuilder mQueryBuilder = new SQLiteQueryBuilder();
// mQueryBuilder.setTables(getTableName(uri));
// SQLiteDatabase mDb = getDb();
// Cursor mCursor = mQueryBuilder.query(
// mDb,
// projection,
// selection,
// selectionArgs,
// null,
// null,
// sortOrder
// );
// mCursor.setNotificationUri(getContext().getContentResolver(), uri);
// return mCursor;
// }
// }
//
// @Override
// public int update(Uri uri, ContentValues values, String selection,
// String[] selectionArgs) {
// // TODO: Implement this to handle requests to update one or more rows.
// throw new UnsupportedOperationException("Not yet implemented");
// }
// }
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/dao/datahelper/BaseHelper.java
import android.content.ContentValues;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
import com.ghostflying.portalwaitinglist.dao.DataProvider;
package com.ghostflying.portalwaitinglist.dao.datahelper;
/**
* Created by ghostflying on 1/19/15.
*/
public abstract class BaseHelper {
Context mContext;
Uri mUri;
public BaseHelper(Context context){
mContext = context; | mUri = Uri.parse("content://" + DataProvider.AUTHORITY + "/" + getTableName()); |
GhostFlying/PortalWaitingList | app/src/main/java/com/ghostflying/portalwaitinglist/util/GMailService.java | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/Message.java
// public class Message {
// private static final String SUBJECT_NAME = "Subject";
// private static final String SUBJECT_DATE = "Date";
//
// Payload payload;
// String id;
//
// public String getId(){
// return id;
// }
//
// public String getSubject(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_NAME))
// return header.value;
// }
// return null;
// }
//
// public Date getDate(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_DATE)){
// Date date = null;
// try{
// date = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.US).parse(header.value);
// }
// catch (ParseException e){
// e.printStackTrace();
// }
// return date;
// }
// }
// return null;
// }
//
// public String getMessageHtml(){
// return payload.parts[1].body.data;
// }
//
// private class Payload{
// Header[] headers;
// MimePart[] parts;
// }
//
// private class Header{
// String name;
// String value;
// }
//
// private class MimePart{
// String mimeType;
// MimeBody body;
// }
//
// private class MimeBody{
// String data;
// }
// }
//
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/MessageList.java
// public class MessageList {
// public ArrayList<MessageId> getMessages() {
// if (messages == null)
// messages = new ArrayList<MessageId>();
// return messages;
// }
//
// public String getNextPageToken() {
// return nextPageToken;
// }
//
// ArrayList<MessageId> messages;
// String nextPageToken;
// //long resultSizeEstimate;
//
// /**
// * Return if there is already next page in the query.
// * @return true if there is next page, otherwise false.
// */
// public boolean hasNextPage(){
// return (nextPageToken != null);
// }
//
// /**
// * The data in messages, only contain id and threadId
// */
// public class MessageId {
// public String getId() {
// return id;
// }
//
// String id;
// //String threadId;
// }
// }
| import com.ghostflying.portalwaitinglist.model.Message;
import com.ghostflying.portalwaitinglist.model.MessageList;
import retrofit.http.GET;
import retrofit.http.Path;
import retrofit.http.Query; | package com.ghostflying.portalwaitinglist.util;
/**
* Created by ghostflying on 11/19/14.
* <br>
* GMail API interface, used by retrofit to achieve.
*/
public interface GMailService {
@GET("/users/me/messages") | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/Message.java
// public class Message {
// private static final String SUBJECT_NAME = "Subject";
// private static final String SUBJECT_DATE = "Date";
//
// Payload payload;
// String id;
//
// public String getId(){
// return id;
// }
//
// public String getSubject(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_NAME))
// return header.value;
// }
// return null;
// }
//
// public Date getDate(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_DATE)){
// Date date = null;
// try{
// date = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.US).parse(header.value);
// }
// catch (ParseException e){
// e.printStackTrace();
// }
// return date;
// }
// }
// return null;
// }
//
// public String getMessageHtml(){
// return payload.parts[1].body.data;
// }
//
// private class Payload{
// Header[] headers;
// MimePart[] parts;
// }
//
// private class Header{
// String name;
// String value;
// }
//
// private class MimePart{
// String mimeType;
// MimeBody body;
// }
//
// private class MimeBody{
// String data;
// }
// }
//
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/MessageList.java
// public class MessageList {
// public ArrayList<MessageId> getMessages() {
// if (messages == null)
// messages = new ArrayList<MessageId>();
// return messages;
// }
//
// public String getNextPageToken() {
// return nextPageToken;
// }
//
// ArrayList<MessageId> messages;
// String nextPageToken;
// //long resultSizeEstimate;
//
// /**
// * Return if there is already next page in the query.
// * @return true if there is next page, otherwise false.
// */
// public boolean hasNextPage(){
// return (nextPageToken != null);
// }
//
// /**
// * The data in messages, only contain id and threadId
// */
// public class MessageId {
// public String getId() {
// return id;
// }
//
// String id;
// //String threadId;
// }
// }
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/util/GMailService.java
import com.ghostflying.portalwaitinglist.model.Message;
import com.ghostflying.portalwaitinglist.model.MessageList;
import retrofit.http.GET;
import retrofit.http.Path;
import retrofit.http.Query;
package com.ghostflying.portalwaitinglist.util;
/**
* Created by ghostflying on 11/19/14.
* <br>
* GMail API interface, used by retrofit to achieve.
*/
public interface GMailService {
@GET("/users/me/messages") | public MessageList getMessages(@Query("q") String query, @Query("pageToken") String pageToken); |
GhostFlying/PortalWaitingList | app/src/main/java/com/ghostflying/portalwaitinglist/util/GMailService.java | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/Message.java
// public class Message {
// private static final String SUBJECT_NAME = "Subject";
// private static final String SUBJECT_DATE = "Date";
//
// Payload payload;
// String id;
//
// public String getId(){
// return id;
// }
//
// public String getSubject(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_NAME))
// return header.value;
// }
// return null;
// }
//
// public Date getDate(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_DATE)){
// Date date = null;
// try{
// date = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.US).parse(header.value);
// }
// catch (ParseException e){
// e.printStackTrace();
// }
// return date;
// }
// }
// return null;
// }
//
// public String getMessageHtml(){
// return payload.parts[1].body.data;
// }
//
// private class Payload{
// Header[] headers;
// MimePart[] parts;
// }
//
// private class Header{
// String name;
// String value;
// }
//
// private class MimePart{
// String mimeType;
// MimeBody body;
// }
//
// private class MimeBody{
// String data;
// }
// }
//
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/MessageList.java
// public class MessageList {
// public ArrayList<MessageId> getMessages() {
// if (messages == null)
// messages = new ArrayList<MessageId>();
// return messages;
// }
//
// public String getNextPageToken() {
// return nextPageToken;
// }
//
// ArrayList<MessageId> messages;
// String nextPageToken;
// //long resultSizeEstimate;
//
// /**
// * Return if there is already next page in the query.
// * @return true if there is next page, otherwise false.
// */
// public boolean hasNextPage(){
// return (nextPageToken != null);
// }
//
// /**
// * The data in messages, only contain id and threadId
// */
// public class MessageId {
// public String getId() {
// return id;
// }
//
// String id;
// //String threadId;
// }
// }
| import com.ghostflying.portalwaitinglist.model.Message;
import com.ghostflying.portalwaitinglist.model.MessageList;
import retrofit.http.GET;
import retrofit.http.Path;
import retrofit.http.Query; | package com.ghostflying.portalwaitinglist.util;
/**
* Created by ghostflying on 11/19/14.
* <br>
* GMail API interface, used by retrofit to achieve.
*/
public interface GMailService {
@GET("/users/me/messages")
public MessageList getMessages(@Query("q") String query, @Query("pageToken") String pageToken);
@GET("/users/me/messages/{id}") | // Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/Message.java
// public class Message {
// private static final String SUBJECT_NAME = "Subject";
// private static final String SUBJECT_DATE = "Date";
//
// Payload payload;
// String id;
//
// public String getId(){
// return id;
// }
//
// public String getSubject(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_NAME))
// return header.value;
// }
// return null;
// }
//
// public Date getDate(){
// for(Header header : payload.headers){
// if (header.name.equals(SUBJECT_DATE)){
// Date date = null;
// try{
// date = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z", Locale.US).parse(header.value);
// }
// catch (ParseException e){
// e.printStackTrace();
// }
// return date;
// }
// }
// return null;
// }
//
// public String getMessageHtml(){
// return payload.parts[1].body.data;
// }
//
// private class Payload{
// Header[] headers;
// MimePart[] parts;
// }
//
// private class Header{
// String name;
// String value;
// }
//
// private class MimePart{
// String mimeType;
// MimeBody body;
// }
//
// private class MimeBody{
// String data;
// }
// }
//
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/model/MessageList.java
// public class MessageList {
// public ArrayList<MessageId> getMessages() {
// if (messages == null)
// messages = new ArrayList<MessageId>();
// return messages;
// }
//
// public String getNextPageToken() {
// return nextPageToken;
// }
//
// ArrayList<MessageId> messages;
// String nextPageToken;
// //long resultSizeEstimate;
//
// /**
// * Return if there is already next page in the query.
// * @return true if there is next page, otherwise false.
// */
// public boolean hasNextPage(){
// return (nextPageToken != null);
// }
//
// /**
// * The data in messages, only contain id and threadId
// */
// public class MessageId {
// public String getId() {
// return id;
// }
//
// String id;
// //String threadId;
// }
// }
// Path: app/src/main/java/com/ghostflying/portalwaitinglist/util/GMailService.java
import com.ghostflying.portalwaitinglist.model.Message;
import com.ghostflying.portalwaitinglist.model.MessageList;
import retrofit.http.GET;
import retrofit.http.Path;
import retrofit.http.Query;
package com.ghostflying.portalwaitinglist.util;
/**
* Created by ghostflying on 11/19/14.
* <br>
* GMail API interface, used by retrofit to achieve.
*/
public interface GMailService {
@GET("/users/me/messages")
public MessageList getMessages(@Query("q") String query, @Query("pageToken") String pageToken);
@GET("/users/me/messages/{id}") | public Message getMessage(@Path("id") String id, @Query("format")String format, @Query("metadataHeaders") String[] metadataHeaders); |
sergueik/SWET | src/test/java/com/github/sergueik/swet/TestConfigurationParserTest.java | // Path: src/main/java/com/github/sergueik/swet/TestConfigurationParser.java
// public class TestConfigurationParser {
//
// private static boolean skipHeaders = true;
// private static String defaultConfig = "test.configuration";
// private static Scanner scanner;
//
// public static void main(String[] args) {
// String configuPath = (args.length == 0)
// ? String.format("%s/src/main/resources/%s",
// System.getProperty("user.dir"), defaultConfig)
// : String.format("%s/%s", System.getProperty("user.dir"), args[0]);
// TestConfigurationParser.getConfiguration(configuPath);
//
// }
//
// @SuppressWarnings("resource")
// public static Scanner loadTestData(final String filename) {
// Scanner scanner = null;
// System.err
// .println(String.format("Reading configuration file: '%s'", filename));
// try {
// scanner = new Scanner(new File(filename)).useDelimiter("(?:\\r?\\n)+");
// } catch (FileNotFoundException e) {
// System.err.println(
// String.format("Configuration file was not found: '%s'", filename));
// e.printStackTrace();
// }
// return scanner;
// }
//
// public static List<String[]> getConfiguration(final String filename) {
// List<String[]> result = new LinkedList<>();
// scanner = loadTestData(filename);
// List<String> separators = new ArrayList<String>(
// Arrays.asList(new String[] { "|", "\t", ";", "," }));
// String separator = String
// .format("(?:%s)",
// String.join("|",
// separators.stream().map(o -> Pattern.compile("(\\||/)")
// .matcher(o).replaceAll("\\\\$1"))
// .collect(Collectors.toList())));
// int lineNum = 0;
// // System.err.println("separator:" + separator);
// while (scanner.hasNext()) {
// String line = scanner.next();
// // System.err.println("line: " + line);
// // skip comments
// if (line.matches("^#.*$")) {
// continue;
// }
// lineNum++;
// // skip headers
// if (skipHeaders) {
// if (lineNum == 1) {
// continue;
// }
// }
//
// String[] columns = line.split(separator);
// /*
// for (String column : columns) {
// System.err.println("data column: " + column);
// }
// */
// result.add(columns);
// }
// scanner.close();
// return result;
// }
// }
| import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
import static org.hamcrest.core.AnyOf.anyOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.containsString;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import com.github.sergueik.swet.TestConfigurationParser; | package com.github.sergueik.swet;
/**
* Copyright 2014 - 2019 Serguei Kouzmine
*/
// import static org.hamcrest.CoreMatchers.*;
// NOTE: a need to switch to hamcrest-all.jar and Matchers
// just for resolving method 'containsInAnyOrder'
public class TestConfigurationParserTest {
/**
* Testing of the Selenium WebDriver Elementor Tool (SWET) Configuration table helper
* @author: Serguei Kouzmine ([email protected])
*/
private static boolean skipHeaders = true;
private static String defaultConfig = "test.configuration";
private static String configuPath = String.format("%s/src/main/resources/%s",
System.getProperty("user.dir"), defaultConfig);
private static List<Object> result = new ArrayList<>();
private static Object[] expected = new Object[] { "A1", "A2", "A3", "B1",
"B2", "B3", "C1", "C2", "C3", "D1", "D2", "D3" /* , "E1" */ };
@BeforeClass
public static void beforeSuiteMethod() throws Exception { | // Path: src/main/java/com/github/sergueik/swet/TestConfigurationParser.java
// public class TestConfigurationParser {
//
// private static boolean skipHeaders = true;
// private static String defaultConfig = "test.configuration";
// private static Scanner scanner;
//
// public static void main(String[] args) {
// String configuPath = (args.length == 0)
// ? String.format("%s/src/main/resources/%s",
// System.getProperty("user.dir"), defaultConfig)
// : String.format("%s/%s", System.getProperty("user.dir"), args[0]);
// TestConfigurationParser.getConfiguration(configuPath);
//
// }
//
// @SuppressWarnings("resource")
// public static Scanner loadTestData(final String filename) {
// Scanner scanner = null;
// System.err
// .println(String.format("Reading configuration file: '%s'", filename));
// try {
// scanner = new Scanner(new File(filename)).useDelimiter("(?:\\r?\\n)+");
// } catch (FileNotFoundException e) {
// System.err.println(
// String.format("Configuration file was not found: '%s'", filename));
// e.printStackTrace();
// }
// return scanner;
// }
//
// public static List<String[]> getConfiguration(final String filename) {
// List<String[]> result = new LinkedList<>();
// scanner = loadTestData(filename);
// List<String> separators = new ArrayList<String>(
// Arrays.asList(new String[] { "|", "\t", ";", "," }));
// String separator = String
// .format("(?:%s)",
// String.join("|",
// separators.stream().map(o -> Pattern.compile("(\\||/)")
// .matcher(o).replaceAll("\\\\$1"))
// .collect(Collectors.toList())));
// int lineNum = 0;
// // System.err.println("separator:" + separator);
// while (scanner.hasNext()) {
// String line = scanner.next();
// // System.err.println("line: " + line);
// // skip comments
// if (line.matches("^#.*$")) {
// continue;
// }
// lineNum++;
// // skip headers
// if (skipHeaders) {
// if (lineNum == 1) {
// continue;
// }
// }
//
// String[] columns = line.split(separator);
// /*
// for (String column : columns) {
// System.err.println("data column: " + column);
// }
// */
// result.add(columns);
// }
// scanner.close();
// return result;
// }
// }
// Path: src/test/java/com/github/sergueik/swet/TestConfigurationParserTest.java
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static org.junit.Assert.*;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
import static org.hamcrest.core.AnyOf.anyOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.containsString;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import com.github.sergueik.swet.TestConfigurationParser;
package com.github.sergueik.swet;
/**
* Copyright 2014 - 2019 Serguei Kouzmine
*/
// import static org.hamcrest.CoreMatchers.*;
// NOTE: a need to switch to hamcrest-all.jar and Matchers
// just for resolving method 'containsInAnyOrder'
public class TestConfigurationParserTest {
/**
* Testing of the Selenium WebDriver Elementor Tool (SWET) Configuration table helper
* @author: Serguei Kouzmine ([email protected])
*/
private static boolean skipHeaders = true;
private static String defaultConfig = "test.configuration";
private static String configuPath = String.format("%s/src/main/resources/%s",
System.getProperty("user.dir"), defaultConfig);
private static List<Object> result = new ArrayList<>();
private static Object[] expected = new Object[] { "A1", "A2", "A3", "B1",
"B2", "B3", "C1", "C2", "C3", "D1", "D2", "D3" /* , "E1" */ };
@BeforeClass
public static void beforeSuiteMethod() throws Exception { | result = flatten(TestConfigurationParser.getConfiguration(configuPath)); |
xiaoyu830411/abtesting_dsl | src/main/java/com/yanglinkui/ab/dsl/condition/Statements.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Expression.java
// public interface Expression {
//
// public boolean interpret(Context context);
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Expression; | package com.yanglinkui.ab.dsl.condition;
/**
* Created by jonas on 2017/1/4.
*/
public class Statements implements Expression {
private Expression expression;
public Statements() {}
public Expression getExpression() {
return expression;
}
public void setExpression(Expression expression) {
this.expression = expression;
}
| // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Expression.java
// public interface Expression {
//
// public boolean interpret(Context context);
// }
// Path: src/main/java/com/yanglinkui/ab/dsl/condition/Statements.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Expression;
package com.yanglinkui.ab.dsl.condition;
/**
* Created by jonas on 2017/1/4.
*/
public class Statements implements Expression {
private Expression expression;
public Statements() {}
public Expression getExpression() {
return expression;
}
public void setExpression(Expression expression) {
this.expression = expression;
}
| public boolean interpret(Context context) { |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestEqual.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
| import com.yanglinkui.ab.dsl.*;
import com.yanglinkui.ab.dsl.Number;
import org.junit.Test;
import java.math.BigDecimal;
import java.util.HashSet;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestEqual {
@Test
public void testInterpretByNumber() {
Variable s1Version = new Variable("s1.version");
Context s1VersionContext = mock(Context.class);
when(s1VersionContext.getValue(s1Version)).thenReturn("1.2");
Equal equal = new Equal();
equal.setVariable(s1Version); | // Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestEqual.java
import com.yanglinkui.ab.dsl.*;
import com.yanglinkui.ab.dsl.Number;
import org.junit.Test;
import java.math.BigDecimal;
import java.util.HashSet;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestEqual {
@Test
public void testInterpretByNumber() {
Variable s1Version = new Variable("s1.version");
Context s1VersionContext = mock(Context.class);
when(s1VersionContext.getValue(s1Version)).thenReturn("1.2");
Equal equal = new Equal();
equal.setVariable(s1Version); | equal.setValue(new com.yanglinkui.ab.dsl.Number(new BigDecimal("1"))); |
xiaoyu830411/abtesting_dsl | src/main/java/com/yanglinkui/ab/dsl/condition/ConditionParser.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
| import com.yanglinkui.ab.dsl.*;
import com.yanglinkui.ab.dsl.Number;
import java.math.BigDecimal;
import java.util.HashSet; | return new LessEqual();
}
Value value() {
if (LA(1) == ConditionToken.TOKEN_NUMBER || LA(1) == ConditionToken.TOKEN_STRING) {
return element();
} else {
match(ConditionToken.TOKEN_LSBRACK);
Value value = elements();
match(ConditionToken.TOKEN_RSBRACK);
return value;
}
}
Array elements() {
HashSet<Value> list = new HashSet<Value>();
list.add(element());
while (LA(1) == ConditionToken.TOKEN_COMMA) {
match(ConditionToken.TOKEN_COMMA);
list.add(element());
}
return new Array(list);
}
Value element() {
if (LA(1) == ConditionToken.TOKEN_NUMBER) {
Token t = match(ConditionToken.TOKEN_NUMBER); | // Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
// Path: src/main/java/com/yanglinkui/ab/dsl/condition/ConditionParser.java
import com.yanglinkui.ab.dsl.*;
import com.yanglinkui.ab.dsl.Number;
import java.math.BigDecimal;
import java.util.HashSet;
return new LessEqual();
}
Value value() {
if (LA(1) == ConditionToken.TOKEN_NUMBER || LA(1) == ConditionToken.TOKEN_STRING) {
return element();
} else {
match(ConditionToken.TOKEN_LSBRACK);
Value value = elements();
match(ConditionToken.TOKEN_RSBRACK);
return value;
}
}
Array elements() {
HashSet<Value> list = new HashSet<Value>();
list.add(element());
while (LA(1) == ConditionToken.TOKEN_COMMA) {
match(ConditionToken.TOKEN_COMMA);
list.add(element());
}
return new Array(list);
}
Value element() {
if (LA(1) == ConditionToken.TOKEN_NUMBER) {
Token t = match(ConditionToken.TOKEN_NUMBER); | return new Number(new BigDecimal(t.getText())); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestGreater.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() { | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestGreater.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() { | Variable var = new Variable("s1.version"); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestGreater.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version"); | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestGreater.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version"); | Context context = mock(Context.class); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestGreater.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
| // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestGreater.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
| Greater g = new Greater(); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestGreater.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
Greater g = new Greater();
g.setVariable(var); | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Greater.java
// public class Greater extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) > 0;
// }
//
// public String toString() {
// return this.variable.toString() + ">" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestGreater.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.Greater;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static org.mockito.Mockito.*;
import static junit.framework.Assert.*;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestGreater {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
Greater g = new Greater();
g.setVariable(var); | g.setValue(new Number(new BigDecimal("1"))); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() { | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() { | Variable var = new Variable("s1.version"); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version"); | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version"); | Context context = mock(Context.class); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
| // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
| LessEqual g = new LessEqual(); |
xiaoyu830411/abtesting_dsl | src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
| import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; | package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
LessEqual g = new LessEqual();
g.setVariable(var); | // Path: src/main/java/com/yanglinkui/ab/dsl/Context.java
// public interface Context {
// public String getValue(Variable var);
//
// public String getValue(Function function);
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/LessEqual.java
// public class LessEqual extends Operation {
//
// public boolean interpret(Context context) {
// String leftValue = variable.getValue(context);
// return new BigDecimal(leftValue).compareTo(((Number)this.value).getValue()) <= 0;
// }
//
// public String toString() {
// return this.variable.toString() + "<=" + this.value.toString();
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Number.java
// public class Number implements Value<BigDecimal> {
//
// private final BigDecimal value;
//
// public Number(BigDecimal value) {
// this.value = value;
// }
//
// public BigDecimal getValue() {
// return this.value;
// }
//
// @Override
// public String toString() {
// return "Number: " + this.value;
// }
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Variable.java
// public class Variable {
//
// protected String id;
//
// public Variable(String id) {
// this.id = id;
// }
//
// public String getId() {
// return id;
// }
//
// public String getValue(Context context) {
// return context.getValue(this);
// }
//
// public String toString() {
// return this.id;
// }
//
// }
// Path: src/test/java/com/yanglinkui/ab/dsl/TestLessEqual.java
import com.yanglinkui.ab.dsl.Context;
import com.yanglinkui.ab.dsl.LessEqual;
import com.yanglinkui.ab.dsl.Number;
import com.yanglinkui.ab.dsl.Variable;
import org.junit.Test;
import java.math.BigDecimal;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
package com.yanglinkui.ab.dsl;
/**
* Created by jonas on 2017/1/8.
*/
public class TestLessEqual {
@Test
public void testInterpretByNumber() {
Variable var = new Variable("s1.version");
Context context = mock(Context.class);
when(context.getValue(var)).thenReturn("1");
LessEqual g = new LessEqual();
g.setVariable(var); | g.setValue(new Number(new BigDecimal("1"))); |
xiaoyu830411/abtesting_dsl | src/main/java/com/yanglinkui/ab/dsl/action/ActionLexer.java | // Path: src/main/java/com/yanglinkui/ab/dsl/Lexer.java
// public abstract class Lexer {
//
// public static final char EOF = (char) -1;
//
// protected final String input;
// protected int p = 0;
// protected char c;
//
// public Lexer(String input) {
// this.input = input;
// c = input.charAt(p);
// }
//
// protected void consume() {
// p++;
// if (p >= input.length()) c = EOF;
// else c = input.charAt(p);
// }
//
// protected void match(char x) {
// if (c == x) {
// consume();
// } else {
// throw new Error("Expecting " + x + "; found " + c);
// }
// }
//
// protected abstract Token nextToken();
//
// protected void WS() {
// while (isWS(c)) {
// consume();
// }
// }
//
// protected boolean isWS(char c) {
// return (c==' ' || c=='\t' || c=='\n' || c=='\r');
// }
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Token.java
// public abstract class Token {
// protected int type;
// protected String text;
// protected String name;
//
// public Token(int type, String name, String text) {
// this.type=type;
// this.name = name;
// this.text=text;
// }
//
// public String toString() {
// return "<'" + text + "'," + name + ">";
// }
//
// public int getType() {
// return type;
// }
//
// public void setType(int type) {
// this.type = type;
// }
//
// public String getText() {
// return text;
// }
//
// public void setText(String text) {
// this.text = text;
// }
// }
| import com.yanglinkui.ab.dsl.Lexer;
import com.yanglinkui.ab.dsl.Token; | package com.yanglinkui.ab.dsl.action;
/**
* Created by jonas on 2017/1/8.
*/
public class ActionLexer extends Lexer {
public ActionLexer(String input) {
super(input);
}
| // Path: src/main/java/com/yanglinkui/ab/dsl/Lexer.java
// public abstract class Lexer {
//
// public static final char EOF = (char) -1;
//
// protected final String input;
// protected int p = 0;
// protected char c;
//
// public Lexer(String input) {
// this.input = input;
// c = input.charAt(p);
// }
//
// protected void consume() {
// p++;
// if (p >= input.length()) c = EOF;
// else c = input.charAt(p);
// }
//
// protected void match(char x) {
// if (c == x) {
// consume();
// } else {
// throw new Error("Expecting " + x + "; found " + c);
// }
// }
//
// protected abstract Token nextToken();
//
// protected void WS() {
// while (isWS(c)) {
// consume();
// }
// }
//
// protected boolean isWS(char c) {
// return (c==' ' || c=='\t' || c=='\n' || c=='\r');
// }
//
// }
//
// Path: src/main/java/com/yanglinkui/ab/dsl/Token.java
// public abstract class Token {
// protected int type;
// protected String text;
// protected String name;
//
// public Token(int type, String name, String text) {
// this.type=type;
// this.name = name;
// this.text=text;
// }
//
// public String toString() {
// return "<'" + text + "'," + name + ">";
// }
//
// public int getType() {
// return type;
// }
//
// public void setType(int type) {
// this.type = type;
// }
//
// public String getText() {
// return text;
// }
//
// public void setText(String text) {
// this.text = text;
// }
// }
// Path: src/main/java/com/yanglinkui/ab/dsl/action/ActionLexer.java
import com.yanglinkui.ab.dsl.Lexer;
import com.yanglinkui.ab.dsl.Token;
package com.yanglinkui.ab.dsl.action;
/**
* Created by jonas on 2017/1/8.
*/
public class ActionLexer extends Lexer {
public ActionLexer(String input) {
super(input);
}
| public Token nextToken() { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.