parent
1964ebc6f2
commit
b9d92bae5a
|
@ -5,11 +5,9 @@
|
|||
*/
|
||||
package org.elasticsearch.license;
|
||||
|
||||
import org.elasticsearch.license.core.ESLicenses;
|
||||
import org.elasticsearch.license.manager.ESLicenseManager;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -100,7 +100,7 @@ public class TestUtils {
|
|||
final ESLicenses licenses2 = LicenseBuilders.licensesBuilder().licenses(secondLicenses).build();
|
||||
|
||||
// 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
|
||||
|
|
|
@ -139,7 +139,7 @@ public class LicenseVerificationTests extends AbstractLicensingTestBase {
|
|||
esLicenseProvider.setLicenses(esLicensesOutput);
|
||||
|
||||
// All validation for shield license should be normal as expected
|
||||
|
||||
|
||||
verifyLicenseManager(esLicenseManager, Collections.singletonMap(TestUtils.SHIELD, shildFeatureAttributes));
|
||||
|
||||
assertFalse("license for marvel should not be valid due to expired expiry date", esLicenseManager.hasLicenseForFeature(TestUtils.MARVEL));
|
||||
|
|
|
@ -12,8 +12,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
|||
import org.elasticsearch.test.InternalTestCluster;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.*;
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.SUITE;
|
||||
|
||||
@ClusterScope(scope = SUITE, numDataNodes = 10)
|
||||
|
|
|
@ -138,7 +138,7 @@ public class LicensesServiceTests extends ElasticsearchIntegrationTest {
|
|||
ESLicenses licenses = LicenseUtils.readLicensesFromString(licenseOutput);
|
||||
|
||||
LicensesManagerService licensesManagerService = licensesManagerService();
|
||||
ESLicenseManager esLicenseManager = ((LicensesService)licensesManagerService).getEsLicenseManager();
|
||||
ESLicenseManager esLicenseManager = ((LicensesService) licensesManagerService).getEsLicenseManager();
|
||||
final CountDownLatch latch1 = new CountDownLatch(1);
|
||||
licensesManagerService.registerLicenses(new LicensesService.PutLicenseRequestHolder(new PutLicenseRequest().license(licenses), "test"), new ActionListener<ClusterStateUpdateResponse>() {
|
||||
@Override
|
||||
|
@ -208,7 +208,8 @@ public class LicensesServiceTests extends ElasticsearchIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleClientRegistration() {}
|
||||
public void testMultipleClientRegistration() {
|
||||
}
|
||||
|
||||
private class TestLicenseClientListener implements LicensesClientService.Listener {
|
||||
|
||||
|
@ -290,7 +291,8 @@ public class LicensesServiceTests extends ElasticsearchIntegrationTest {
|
|||
latch1.await();
|
||||
|
||||
logger.info("waiting for onEnabled");
|
||||
while(!testLicenseClientListener.processed.get()) {}
|
||||
while (!testLicenseClientListener.processed.get()) {
|
||||
}
|
||||
|
||||
Set<String> enabledFeatures = licensesManagerService.enabledFeatures();
|
||||
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"));
|
||||
}
|
||||
|
||||
@Test @Ignore
|
||||
@Test
|
||||
@Ignore
|
||||
public void testLicenseExpiry() throws Exception {
|
||||
//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.component.LifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Module;
|
||||
import org.elasticsearch.plugins.AbstractPlugin;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
|
@ -38,8 +38,8 @@ public class TestPluginService extends AbstractLifecycleComponent<TestPluginServ
|
|||
|
||||
// check if feature is enabled
|
||||
public boolean enabled() {
|
||||
return enabled.get();
|
||||
}
|
||||
return enabled.get();
|
||||
}
|
||||
|
||||
protected void doStart() throws ElasticsearchException {
|
||||
licensesClientService.register(FEATURE_NAME,
|
||||
|
@ -59,12 +59,12 @@ public class TestPluginService extends AbstractLifecycleComponent<TestPluginServ
|
|||
|
||||
@Override
|
||||
public void onEnabled() {
|
||||
enabled.set(true);
|
||||
}
|
||||
enabled.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisabled() {
|
||||
enabled.set(false);
|
||||
}
|
||||
enabled.set(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue