Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@

package org.elasticsearch.xpack.esql.spatial;

import org.elasticsearch.license.License;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.license.internal.XPackLicenseStatus;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.xpack.esql.action.EsqlPluginWithNonEnterpriseOrExpiredLicense;
import org.elasticsearch.xpack.esql.plugin.EsqlPlugin;
import org.elasticsearch.xpack.spatial.SpatialPlugin;

import java.util.Collection;
Expand All @@ -18,11 +21,45 @@ public class SpatialExtentAggregationNoLicenseIT extends SpatialExtentAggregatio

@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return List.of(SpatialPlugin.class, EsqlPluginWithNonEnterpriseOrExpiredLicense.class);
return List.of(TestSpatialPlugin.class, TestEsqlPlugin.class);
}

@Override
public void testStExtentAggregationWithShapes() {
assertStExtentFailsWith("index_geo_shape");
}

private static XPackLicenseState getLicenseState() {
License.OperationMode operationMode;
boolean active;
if (randomBoolean()) {
operationMode = randomFrom(
License.OperationMode.GOLD,
License.OperationMode.BASIC,
License.OperationMode.MISSING,
License.OperationMode.STANDARD
);
active = true;
} else {
operationMode = randomFrom(License.OperationMode.PLATINUM, License.OperationMode.ENTERPRISE, License.OperationMode.TRIAL);
active = false; // expired
}

return new XPackLicenseState(
() -> System.currentTimeMillis(),
new XPackLicenseStatus(operationMode, active, "Test license expired")
);
}

public static class TestEsqlPlugin extends EsqlPlugin {
protected XPackLicenseState getLicenseState() {
return SpatialExtentAggregationNoLicenseIT.getLicenseState();
}
}

public static class TestSpatialPlugin extends SpatialPlugin {
protected XPackLicenseState getLicenseState() {
return SpatialExtentAggregationNoLicenseIT.getLicenseState();
}
}
}