@Test public void testPulsarDataSourceRule() { PulsarDataSourceRule rule = new PulsarDataSourceRule("druid", "day"); rule.setDatasourceType("druid"); rule.setPeriod("day"); PulsarDataSourceRule rule1 = new PulsarDataSourceRule("druid", "day"); rule1.setDatasourceType("druid"); rule1.setPeriod("day"); assertEquals("druid",rule.getDatasourceType()); assertEquals("day",rule.getPeriod()); assertEquals(rule.hashCode(),rule1.hashCode()); PulsarDataSourceRule rule2 = new PulsarDataSourceRule(null, "day"); rule2.setPeriod("day"); PulsarDataSourceRule rule3 = new PulsarDataSourceRule("druid", null); rule3.setDatasourceType("druid"); PulsarDataSourceRule rule4 = new PulsarDataSourceRule("druid", "day"); rule4.setDatasourceType("druid"); rule4.setPeriod("week"); PulsarDataSourceRule rule5 = new PulsarDataSourceRule("druid", "day"); rule5.setDatasourceType("druid1"); rule5.setPeriod("day"); assertFalse(rule2.equals(rule)); assertFalse(rule3.equals(rule)); assertFalse(rule4.equals(rule)); assertFalse(rule5.equals(rule)); }
public PulsarDataSourceRule(String datasourceType, String period) { this.datasourceType = datasourceType; this.period = period; }
PulsarDataSourceRule { public PulsarDataSourceRule(String datasourceType, String period) { this.datasourceType = datasourceType; this.period = period; } }
PulsarDataSourceRule { public PulsarDataSourceRule(String datasourceType, String period) { this.datasourceType = datasourceType; this.period = period; } PulsarDataSourceRule(String datasourceType, String period); }
PulsarDataSourceRule { public PulsarDataSourceRule(String datasourceType, String period) { this.datasourceType = datasourceType; this.period = period; } PulsarDataSourceRule(String datasourceType, String period); String getPeriod(); void setPeriod(String period); String getDatasourceType(); void setDatasourceType(String datasourceType); @Override int hashCode(); @Override boolean equals(Object obj); }
PulsarDataSourceRule { public PulsarDataSourceRule(String datasourceType, String period) { this.datasourceType = datasourceType; this.period = period; } PulsarDataSourceRule(String datasourceType, String period); String getPeriod(); void setPeriod(String period); String getDatasourceType(); void setDatasourceType(String datasourceType); @Override int hashCode(); @Override boolean equals(Object obj);  }