Skip to content

Commit 410eb58

Browse files
committed
Move ViewTests and ViewMetadataTests to server
1 parent b8e6206 commit 410eb58

File tree

4 files changed

+41
-26
lines changed

4 files changed

+41
-26
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
9+
package org.elasticsearch.cluster.metadata;
710

8-
package org.elasticsearch.xpack.esql.view;
9-
10-
import org.elasticsearch.cluster.metadata.View;
11-
import org.elasticsearch.cluster.metadata.ViewMetadata;
1211
import org.elasticsearch.common.io.stream.Writeable;
1312
import org.elasticsearch.test.AbstractChunkedSerializingTestCase;
1413
import org.elasticsearch.xcontent.XContentParser;
@@ -18,8 +17,8 @@
1817
import java.util.ArrayList;
1918
import java.util.List;
2019

21-
import static org.elasticsearch.xpack.esql.view.ViewTests.randomName;
22-
import static org.elasticsearch.xpack.esql.view.ViewTests.randomView;
20+
import static org.elasticsearch.cluster.metadata.ViewTestsUtils.randomName;
21+
import static org.elasticsearch.cluster.metadata.ViewTestsUtils.randomView;
2322
import static org.hamcrest.Matchers.equalTo;
2423

2524
public class ViewMetadataTests extends AbstractChunkedSerializingTestCase<ViewMetadata> {
Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
9+
package org.elasticsearch.cluster.metadata;
710

8-
package org.elasticsearch.xpack.esql.view;
9-
10-
import org.elasticsearch.cluster.metadata.View;
1111
import org.elasticsearch.common.io.stream.Writeable;
1212
import org.elasticsearch.test.AbstractXContentSerializingTestCase;
1313
import org.elasticsearch.xcontent.XContentParser;
1414
import org.elasticsearch.xcontent.XContentType;
1515

1616
import java.io.IOException;
1717

18+
import static org.elasticsearch.cluster.metadata.ViewTestsUtils.randomName;
19+
import static org.elasticsearch.cluster.metadata.ViewTestsUtils.randomView;
1820
import static org.hamcrest.Matchers.equalTo;
1921

2022
public class ViewTests extends AbstractXContentSerializingTestCase<View> {
@@ -39,15 +41,6 @@ protected View createXContextTestInstance(XContentType xContentType) {
3941
return randomView(randomName());
4042
}
4143

42-
public static String randomName() {
43-
return randomAlphaOfLength(8);
44-
}
45-
46-
public static View randomView(String name) {
47-
String query = "FROM " + randomAlphaOfLength(10);
48-
return new View(name, query);
49-
}
50-
5144
@Override
5245
protected Writeable.Reader<View> instanceReader() {
5346
return View::new;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
package org.elasticsearch.cluster.metadata;
11+
12+
import static org.elasticsearch.test.ESTestCase.randomAlphaOfLength;
13+
14+
public class ViewTestsUtils {
15+
public static String randomName() {
16+
return randomAlphaOfLength(8);
17+
}
18+
19+
public static View randomView(String name) {
20+
String query = "FROM " + randomAlphaOfLength(10);
21+
return new View(name, query);
22+
}
23+
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/view/ViewCrudTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import java.util.Optional;
2121
import java.util.concurrent.atomic.AtomicReference;
2222

23+
import static org.elasticsearch.cluster.metadata.ViewTestsUtils.randomName;
24+
import static org.elasticsearch.cluster.metadata.ViewTestsUtils.randomView;
2325
import static org.elasticsearch.xpack.esql.plugin.EsqlFeatures.ESQL_VIEWS_FEATURE_FLAG;
24-
import static org.elasticsearch.xpack.esql.view.ViewTests.randomName;
25-
import static org.elasticsearch.xpack.esql.view.ViewTests.randomView;
2626
import static org.hamcrest.Matchers.containsString;
2727
import static org.hamcrest.Matchers.equalTo;
2828
import static org.hamcrest.Matchers.nullValue;

0 commit comments

Comments
 (0)