X-plugin tests - added testing for Standard licence in graph plugin. See https://github.com/elastic/x-plugins/issues/1263

Original commit: elastic/x-pack-elasticsearch@6773ead0fc
This commit is contained in:
markharwood 2016-04-28 13:47:19 +01:00
parent 91943318bf
commit 077599b63f
1 changed files with 38 additions and 8 deletions

View File

@ -29,7 +29,15 @@ public class LicenseTests extends AbstractLicenseeTestCase {
GraphLicensee graphLicensee = new GraphLicensee(Settings.EMPTY, licenseeRegistry); GraphLicensee graphLicensee = new GraphLicensee(Settings.EMPTY, licenseeRegistry);
licenseeRegistry.register(graphLicensee); licenseeRegistry.register(graphLicensee);
assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(graphLicensee); assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
}
public void testStandardLicenseIsDisabled() throws Exception {
licenseeRegistry.setOperationMode(OperationMode.STANDARD);
GraphLicensee graphLicensee = new GraphLicensee(Settings.EMPTY, licenseeRegistry);
licenseeRegistry.register(graphLicensee);
assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
} }
public void testNoLicenseDoesNotWork() { public void testNoLicenseDoesNotWork() {
@ -38,7 +46,7 @@ public class LicenseTests extends AbstractLicenseeTestCase {
licenseeRegistry.register(graphLicensee); licenseeRegistry.register(graphLicensee);
licenseeRegistry.disable(); licenseeRegistry.disable();
assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(graphLicensee); assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
} }
public void testExpiredPlatinumTrialLicenseIsRestricted() throws Exception { public void testExpiredPlatinumTrialLicenseIsRestricted() throws Exception {
@ -47,7 +55,7 @@ public class LicenseTests extends AbstractLicenseeTestCase {
licenseeRegistry.register(graphLicensee); licenseeRegistry.register(graphLicensee);
licenseeRegistry.disable(); licenseeRegistry.disable();
assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(graphLicensee); assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
} }
public void testUpgradingFromBasicLicenseWorks() { public void testUpgradingFromBasicLicenseWorks() {
@ -55,7 +63,7 @@ public class LicenseTests extends AbstractLicenseeTestCase {
GraphLicensee graphLicensee = new GraphLicensee(Settings.EMPTY, licenseeRegistry); GraphLicensee graphLicensee = new GraphLicensee(Settings.EMPTY, licenseeRegistry);
licenseeRegistry.register(graphLicensee); licenseeRegistry.register(graphLicensee);
assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(graphLicensee); assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
licenseeRegistry.setOperationMode(randomTrialOrPlatinumMode()); licenseeRegistry.setOperationMode(randomTrialOrPlatinumMode());
assertLicensePlatinumTrialBehaviour(graphLicensee); assertLicensePlatinumTrialBehaviour(graphLicensee);
@ -69,7 +77,29 @@ public class LicenseTests extends AbstractLicenseeTestCase {
assertLicensePlatinumTrialBehaviour(graphLicensee); assertLicensePlatinumTrialBehaviour(graphLicensee);
licenseeRegistry.setOperationMode(OperationMode.BASIC); licenseeRegistry.setOperationMode(OperationMode.BASIC);
assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(graphLicensee); assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
}
public void testUpgradingFromStandardLicenseWorks() {
licenseeRegistry.setOperationMode(OperationMode.STANDARD);
GraphLicensee graphLicensee = new GraphLicensee(Settings.EMPTY, licenseeRegistry);
licenseeRegistry.register(graphLicensee);
assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
licenseeRegistry.setOperationMode(randomTrialOrPlatinumMode());
assertLicensePlatinumTrialBehaviour(graphLicensee);
}
public void testDowngradingToStandardLicenseWorks() {
licenseeRegistry.setOperationMode(randomTrialOrPlatinumMode());
GraphLicensee graphLicensee = new GraphLicensee(Settings.EMPTY, licenseeRegistry);
licenseeRegistry.register(graphLicensee);
assertLicensePlatinumTrialBehaviour(graphLicensee);
licenseeRegistry.setOperationMode(OperationMode.STANDARD);
assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
} }
public void testDowngradingToGoldLicenseWorks() { public void testDowngradingToGoldLicenseWorks() {
@ -80,7 +110,7 @@ public class LicenseTests extends AbstractLicenseeTestCase {
assertLicensePlatinumTrialBehaviour(graphLicensee); assertLicensePlatinumTrialBehaviour(graphLicensee);
licenseeRegistry.setOperationMode(OperationMode.GOLD); licenseeRegistry.setOperationMode(OperationMode.GOLD);
assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(graphLicensee); assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
} }
public void testUpgradingExpiredLicenseWorks() { public void testUpgradingExpiredLicenseWorks() {
@ -89,7 +119,7 @@ public class LicenseTests extends AbstractLicenseeTestCase {
licenseeRegistry.register(graphLicensee); licenseeRegistry.register(graphLicensee);
licenseeRegistry.disable(); licenseeRegistry.disable();
assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(graphLicensee); assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(graphLicensee);
licenseeRegistry.setOperationMode(randomTrialOrPlatinumMode()); licenseeRegistry.setOperationMode(randomTrialOrPlatinumMode());
assertLicensePlatinumTrialBehaviour(graphLicensee); assertLicensePlatinumTrialBehaviour(graphLicensee);
@ -99,7 +129,7 @@ public class LicenseTests extends AbstractLicenseeTestCase {
assertThat("Expected graph exploration to be allowed", graphLicensee.isAvailable(), is(true)); assertThat("Expected graph exploration to be allowed", graphLicensee.isAvailable(), is(true));
} }
private void assertLicenseBasicOrGoldOrNoneOrExpiredBehaviour(GraphLicensee graphLicensee) { private void assertLicenseBasicOrStandardGoldOrNoneOrExpiredBehaviour(GraphLicensee graphLicensee) {
assertThat("Expected graph exploration not to be allowed", graphLicensee.isAvailable(), is(false)); assertThat("Expected graph exploration not to be allowed", graphLicensee.isAvailable(), is(false));
} }
} }