parent
1964ebc6f2
commit
b9d92bae5a
|
@ -5,11 +5,9 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.license;
|
package org.elasticsearch.license;
|
||||||
|
|
||||||
import org.elasticsearch.license.core.ESLicenses;
|
|
||||||
import org.elasticsearch.license.manager.ESLicenseManager;
|
import org.elasticsearch.license.manager.ESLicenseManager;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -100,7 +100,7 @@ public class TestUtils {
|
||||||
final ESLicenses licenses2 = LicenseBuilders.licensesBuilder().licenses(secondLicenses).build();
|
final ESLicenses licenses2 = LicenseBuilders.licensesBuilder().licenses(secondLicenses).build();
|
||||||
|
|
||||||
// check if the effective licenses have the same feature set
|
// check if the effective licenses have the same feature set
|
||||||
assertTrue("Both licenses should have the same number of features",licenses1.features().equals(licenses2.features()));
|
assertTrue("Both licenses should have the same number of features", licenses1.features().equals(licenses2.features()));
|
||||||
|
|
||||||
|
|
||||||
// for every feature license, check if all the attributes are the same
|
// for every feature license, check if all the attributes are the same
|
||||||
|
|
|
@ -12,8 +12,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||||
import org.elasticsearch.test.InternalTestCluster;
|
import org.elasticsearch.test.InternalTestCluster;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.*;
|
|
||||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.SUITE;
|
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.SUITE;
|
||||||
|
|
||||||
@ClusterScope(scope = SUITE, numDataNodes = 10)
|
@ClusterScope(scope = SUITE, numDataNodes = 10)
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class LicensesServiceTests extends ElasticsearchIntegrationTest {
|
||||||
ESLicenses licenses = LicenseUtils.readLicensesFromString(licenseOutput);
|
ESLicenses licenses = LicenseUtils.readLicensesFromString(licenseOutput);
|
||||||
|
|
||||||
LicensesManagerService licensesManagerService = licensesManagerService();
|
LicensesManagerService licensesManagerService = licensesManagerService();
|
||||||
ESLicenseManager esLicenseManager = ((LicensesService)licensesManagerService).getEsLicenseManager();
|
ESLicenseManager esLicenseManager = ((LicensesService) licensesManagerService).getEsLicenseManager();
|
||||||
final CountDownLatch latch1 = new CountDownLatch(1);
|
final CountDownLatch latch1 = new CountDownLatch(1);
|
||||||
licensesManagerService.registerLicenses(new LicensesService.PutLicenseRequestHolder(new PutLicenseRequest().license(licenses), "test"), new ActionListener<ClusterStateUpdateResponse>() {
|
licensesManagerService.registerLicenses(new LicensesService.PutLicenseRequestHolder(new PutLicenseRequest().license(licenses), "test"), new ActionListener<ClusterStateUpdateResponse>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -208,7 +208,8 @@ public class LicensesServiceTests extends ElasticsearchIntegrationTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultipleClientRegistration() {}
|
public void testMultipleClientRegistration() {
|
||||||
|
}
|
||||||
|
|
||||||
private class TestLicenseClientListener implements LicensesClientService.Listener {
|
private class TestLicenseClientListener implements LicensesClientService.Listener {
|
||||||
|
|
||||||
|
@ -290,7 +291,8 @@ public class LicensesServiceTests extends ElasticsearchIntegrationTest {
|
||||||
latch1.await();
|
latch1.await();
|
||||||
|
|
||||||
logger.info("waiting for onEnabled");
|
logger.info("waiting for onEnabled");
|
||||||
while(!testLicenseClientListener.processed.get()) {}
|
while (!testLicenseClientListener.processed.get()) {
|
||||||
|
}
|
||||||
|
|
||||||
Set<String> enabledFeatures = licensesManagerService.enabledFeatures();
|
Set<String> enabledFeatures = licensesManagerService.enabledFeatures();
|
||||||
assertTrue(enabledFeatures.contains("shield"));
|
assertTrue(enabledFeatures.contains("shield"));
|
||||||
|
@ -315,7 +317,8 @@ public class LicensesServiceTests extends ElasticsearchIntegrationTest {
|
||||||
assertFalse("feature should not be enabled: no licenses registered", managerService.enabledFeatures().contains("marvel"));
|
assertFalse("feature should not be enabled: no licenses registered", managerService.enabledFeatures().contains("marvel"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Ignore
|
@Test
|
||||||
|
@Ignore
|
||||||
public void testLicenseExpiry() throws Exception {
|
public void testLicenseExpiry() throws Exception {
|
||||||
//TODO, first figure out how to generate a license with a quick expiry in matter of seconds
|
//TODO, first figure out how to generate a license with a quick expiry in matter of seconds
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.license.plugin;
|
||||||
|
|
||||||
import org.elasticsearch.common.collect.ImmutableSet;
|
import org.elasticsearch.common.collect.ImmutableSet;
|
||||||
import org.elasticsearch.common.component.LifecycleComponent;
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.Module;
|
|
||||||
import org.elasticsearch.plugins.AbstractPlugin;
|
import org.elasticsearch.plugins.AbstractPlugin;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
Loading…
Reference in New Issue