use of com.yahoo.pulsar.common.policies.data.OldPolicies in project pulsar by yahoo.
the class NamespaceIsolationPolicyImplTest method testConstructor.
@Test
public void testConstructor() throws Exception {
NamespaceIsolationPolicyImpl defaultPolicy = this.getDefaultPolicy();
NamespaceIsolationData policyData = new NamespaceIsolationData();
policyData.namespaces = new ArrayList<String>();
policyData.namespaces.add("pulsar/use/test.*");
policyData.primary = new ArrayList<String>();
policyData.primary.add("prod1-broker[1-3].messaging.use.example.com");
policyData.secondary = new ArrayList<String>();
policyData.secondary.add("prod1-broker.*.use.example.com");
policyData.auto_failover_policy = new AutoFailoverPolicyData();
policyData.auto_failover_policy.policy_type = AutoFailoverPolicyType.min_available;
policyData.auto_failover_policy.parameters = new HashMap<String, String>();
policyData.auto_failover_policy.parameters.put("min_limit", "3");
policyData.auto_failover_policy.parameters.put("usage_threshold", "90");
NamespaceIsolationPolicyImpl newPolicy = new NamespaceIsolationPolicyImpl(policyData);
assertTrue(defaultPolicy.equals(newPolicy));
policyData.auto_failover_policy.parameters.put("usage_threshold", "80");
newPolicy = new NamespaceIsolationPolicyImpl(policyData);
assertTrue(!defaultPolicy.equals(newPolicy));
assertTrue(!newPolicy.equals(new OldPolicies()));
}
Aggregations