killbill-memoizeit
Changes
util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagCreationEvent.java 122(+122 -0)
util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionCreationEvent.java 97(+97 -0)
util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionDeletionEvent.java 97(+97 -0)
util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDeletionEvent.java 122(+122 -0)
util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionCreationEvent.java 97(+97 -0)
util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionDeletionEvent.java 97(+97 -0)
util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagCreationEvent.java 59(+59 -0)
util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionCreationEvent.java 53(+53 -0)
util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionDeletionEvent.java 53(+53 -0)
util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDeletionEvent.java 59(+59 -0)
util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagCreationEvent.java 59(+59 -0)
util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionCreationEvent.java 53(+53 -0)
util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionDeletionEvent.java 53(+53 -0)
Details
diff --git a/api/src/main/java/com/ning/billing/util/bus/BusEvent.java b/api/src/main/java/com/ning/billing/util/bus/BusEvent.java
index d969440..cfb8b0b 100644
--- a/api/src/main/java/com/ning/billing/util/bus/BusEvent.java
+++ b/api/src/main/java/com/ning/billing/util/bus/BusEvent.java
@@ -19,19 +19,26 @@ package com.ning.billing.util.bus;
import java.util.UUID;
public interface BusEvent {
-
- public enum BusEventType {
- ACCOUNT_CREATE,
- ACCOUNT_CHANGE,
- SUBSCRIPTION_TRANSITION,
- BUNDLE_REPAIR,
- INVOICE_EMPTY,
- INVOICE_CREATION,
- PAYMENT_INFO,
- PAYMENT_ERROR
- }
+ public enum BusEventType {
+ ACCOUNT_CREATE,
+ ACCOUNT_CHANGE,
+ SUBSCRIPTION_TRANSITION,
+ BUNDLE_REPAIR,
+ INVOICE_EMPTY,
+ INVOICE_CREATION,
+ PAYMENT_INFO,
+ PAYMENT_ERROR,
+ CONTROL_TAG_CREATION,
+ CONTROL_TAG_DELETION,
+ USER_TAG_CREATION,
+ USER_TAG_DELETION,
+ CONTROL_TAGDEFINITION_CREATION,
+ CONTROL_TAGDEFINITION_DELETION,
+ USER_TAGDEFINITION_CREATION,
+ USER_TAGDEFINITION_DELETION
+ }
- public BusEventType getBusEventType();
-
- public UUID getUserToken();
+ public BusEventType getBusEventType();
+
+ public UUID getUserToken();
}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/ControlTagCreationEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagCreationEvent.java
new file mode 100644
index 0000000..03d2686
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagCreationEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface ControlTagCreationEvent extends TagEvent {
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDefinitionCreationEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDefinitionCreationEvent.java
new file mode 100644
index 0000000..f691198
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDefinitionCreationEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface ControlTagDefinitionCreationEvent extends TagDefinitionEvent {
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDefinitionDeletionEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDefinitionDeletionEvent.java
new file mode 100644
index 0000000..7a5f453
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDefinitionDeletionEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface ControlTagDefinitionDeletionEvent extends TagDefinitionEvent {
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDeletionEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDeletionEvent.java
new file mode 100644
index 0000000..c82ea96
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/ControlTagDeletionEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface ControlTagDeletionEvent extends TagEvent {
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/TagDefinitionEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/TagDefinitionEvent.java
new file mode 100644
index 0000000..7906c7e
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/TagDefinitionEvent.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+import java.util.UUID;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.tag.TagDefinition;
+
+public interface TagDefinitionEvent extends BusEvent {
+ UUID getTagDefinitionId();
+
+ TagDefinition getTagDefinition();
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/TagEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/TagEvent.java
new file mode 100644
index 0000000..1cd3cfd
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/TagEvent.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+import java.util.UUID;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.TagDefinition;
+
+public interface TagEvent extends BusEvent {
+ UUID getTagId();
+
+ UUID getObjectId();
+
+ ObjectType getObjectType();
+
+ TagDefinition getTagDefinition();
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/UserTagCreationEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/UserTagCreationEvent.java
new file mode 100644
index 0000000..986845f
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/UserTagCreationEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface UserTagCreationEvent extends TagEvent {
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/UserTagDefinitionCreationEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/UserTagDefinitionCreationEvent.java
new file mode 100644
index 0000000..06b74a5
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/UserTagDefinitionCreationEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface UserTagDefinitionCreationEvent extends TagDefinitionEvent {
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/UserTagDefinitionDeletionEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/UserTagDefinitionDeletionEvent.java
new file mode 100644
index 0000000..8922eaf
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/UserTagDefinitionDeletionEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface UserTagDefinitionDeletionEvent extends TagDefinitionEvent {
+}
diff --git a/api/src/main/java/com/ning/billing/util/tag/api/UserTagDeletionEvent.java b/api/src/main/java/com/ning/billing/util/tag/api/UserTagDeletionEvent.java
new file mode 100644
index 0000000..22ef341
--- /dev/null
+++ b/api/src/main/java/com/ning/billing/util/tag/api/UserTagDeletionEvent.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api;
+
+public interface UserTagDeletionEvent extends TagEvent {
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagCreationEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagCreationEvent.java
new file mode 100644
index 0000000..2e420ed
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagCreationEvent.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.ControlTagCreationEvent;
+
+public class DefaultControlTagCreationEvent implements ControlTagCreationEvent {
+ private final UUID tagId;
+ private final UUID objectId;
+ private final ObjectType objectType;
+ private final TagDefinition tagDefinition;
+ private final UUID userToken;
+
+ public DefaultControlTagCreationEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagId;
+ this.objectId = objectId;
+ this.objectType = objectType;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagId() {
+ return tagId;
+ }
+
+ @Override
+ public UUID getObjectId() {
+ return objectId;
+ }
+
+ @Override
+ public ObjectType getObjectType() {
+ return objectType;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.CONTROL_TAG_CREATION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultControlTagCreationEvent");
+ sb.append("{objectId=").append(objectId);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", objectType=").append(objectType);
+ sb.append(", tagDefinition=").append(tagDefinition);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultControlTagCreationEvent that = (DefaultControlTagCreationEvent) o;
+
+ if (objectId != null ? !objectId.equals(that.objectId) : that.objectId != null) {
+ return false;
+ }
+ if (objectType != that.objectType) {
+ return false;
+ }
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (objectId != null ? objectId.hashCode() : 0);
+ result = 31 * result + (objectType != null ? objectType.hashCode() : 0);
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionCreationEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionCreationEvent.java
new file mode 100644
index 0000000..b084ac5
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionCreationEvent.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.ControlTagDefinitionCreationEvent;
+
+public class DefaultControlTagDefinitionCreationEvent implements ControlTagDefinitionCreationEvent {
+ private final UUID tagId;
+ private final TagDefinition tagDefinition;
+ private final UUID userToken;
+
+ public DefaultControlTagDefinitionCreationEvent(final UUID tagId, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagId;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagDefinitionId() {
+ return tagId;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.CONTROL_TAGDEFINITION_CREATION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultControlTagDefinitionCreationEvent");
+ sb.append("{tagDefinition=").append(tagDefinition);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultControlTagDefinitionCreationEvent that = (DefaultControlTagDefinitionCreationEvent) o;
+
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionDeletionEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionDeletionEvent.java
new file mode 100644
index 0000000..10de711
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDefinitionDeletionEvent.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.ControlTagDefinitionDeletionEvent;
+
+public class DefaultControlTagDefinitionDeletionEvent implements ControlTagDefinitionDeletionEvent {
+ private final UUID tagId;
+ private final TagDefinition tagDefinition;
+ private final UUID userToken;
+
+ public DefaultControlTagDefinitionDeletionEvent(final UUID tagId, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagId;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagDefinitionId() {
+ return tagId;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.CONTROL_TAGDEFINITION_DELETION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultControlTagDefinitionDeletionEvent");
+ sb.append("{tagDefinition=").append(tagDefinition);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultControlTagDefinitionDeletionEvent that = (DefaultControlTagDefinitionDeletionEvent) o;
+
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDeletionEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDeletionEvent.java
new file mode 100644
index 0000000..79f97a9
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultControlTagDeletionEvent.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.ControlTagDeletionEvent;
+
+public class DefaultControlTagDeletionEvent implements ControlTagDeletionEvent {
+ private final UUID tagId;
+ final UUID objectId;
+ final ObjectType objectType;
+ final TagDefinition tagDefinition;
+ final UUID userToken;
+
+ public DefaultControlTagDeletionEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagId;
+ this.objectId = objectId;
+ this.objectType = objectType;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagId() {
+ return tagId;
+ }
+
+ @Override
+ public UUID getObjectId() {
+ return objectId;
+ }
+
+ @Override
+ public ObjectType getObjectType() {
+ return objectType;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.CONTROL_TAG_DELETION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultControlTagDeletionEvent");
+ sb.append("{objectId=").append(objectId);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", objectType=").append(objectType);
+ sb.append(", tagDefinition=").append(tagDefinition);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultControlTagDeletionEvent that = (DefaultControlTagDeletionEvent) o;
+
+ if (objectId != null ? !objectId.equals(that.objectId) : that.objectId != null) {
+ return false;
+ }
+ if (objectType != that.objectType) {
+ return false;
+ }
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (objectId != null ? objectId.hashCode() : 0);
+ result = 31 * result + (objectType != null ? objectType.hashCode() : 0);
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagCreationEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagCreationEvent.java
new file mode 100644
index 0000000..634addb
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagCreationEvent.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.UserTagCreationEvent;
+
+public class DefaultUserTagCreationEvent implements UserTagCreationEvent {
+ private final UUID tagId;
+ private final UUID objectId;
+ private final ObjectType objectType;
+ private final TagDefinition tagDefinition;
+ private final UUID userToken;
+
+ public DefaultUserTagCreationEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagId;
+ this.objectId = objectId;
+ this.objectType = objectType;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagId() {
+ return tagId;
+ }
+
+ @Override
+ public UUID getObjectId() {
+ return objectId;
+ }
+
+ @Override
+ public ObjectType getObjectType() {
+ return objectType;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.USER_TAG_CREATION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultUserTagCreationEvent");
+ sb.append("{objectId=").append(objectId);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", objectType=").append(objectType);
+ sb.append(", tagDefinition=").append(tagDefinition);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultUserTagCreationEvent that = (DefaultUserTagCreationEvent) o;
+
+ if (objectId != null ? !objectId.equals(that.objectId) : that.objectId != null) {
+ return false;
+ }
+ if (objectType != that.objectType) {
+ return false;
+ }
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (objectId != null ? objectId.hashCode() : 0);
+ result = 31 * result + (objectType != null ? objectType.hashCode() : 0);
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionCreationEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionCreationEvent.java
new file mode 100644
index 0000000..eaf2cae
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionCreationEvent.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.UserTagDefinitionCreationEvent;
+
+public class DefaultUserTagDefinitionCreationEvent implements UserTagDefinitionCreationEvent {
+ private final UUID tagId;
+ private final TagDefinition tagDefinition;
+ private final UUID userToken;
+
+ public DefaultUserTagDefinitionCreationEvent(final UUID tagDefinitionId, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagDefinitionId;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagDefinitionId() {
+ return tagId;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.USER_TAGDEFINITION_CREATION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultUserTagDefinitionCreationEvent");
+ sb.append("{tagDefinition=").append(tagDefinition);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultUserTagDefinitionCreationEvent that = (DefaultUserTagDefinitionCreationEvent) o;
+
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionDeletionEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionDeletionEvent.java
new file mode 100644
index 0000000..391a099
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDefinitionDeletionEvent.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.UserTagDefinitionDeletionEvent;
+
+public class DefaultUserTagDefinitionDeletionEvent implements UserTagDefinitionDeletionEvent {
+ private final UUID tagId;
+ private final TagDefinition tagDefinition;
+ private final UUID userToken;
+
+ public DefaultUserTagDefinitionDeletionEvent(final UUID tagDefinitionId, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagDefinitionId;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagDefinitionId() {
+ return tagId;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.USER_TAGDEFINITION_DELETION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultUserTagDefinitionDeletionEvent");
+ sb.append("{tagDefinition=").append(tagDefinition);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultUserTagDefinitionDeletionEvent that = (DefaultUserTagDefinitionDeletionEvent) o;
+
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDeletionEvent.java b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDeletionEvent.java
new file mode 100644
index 0000000..d073740
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/DefaultUserTagDeletionEvent.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.UserTagDeletionEvent;
+
+public class DefaultUserTagDeletionEvent implements UserTagDeletionEvent {
+ private final UUID tagId;
+ private final UUID objectId;
+ private final ObjectType objectType;
+ private final TagDefinition tagDefinition;
+ private final UUID userToken;
+
+ public DefaultUserTagDeletionEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ this.tagId = tagId;
+ this.objectId = objectId;
+ this.objectType = objectType;
+ this.tagDefinition = tagDefinition;
+ this.userToken = userToken;
+ }
+
+ @Override
+ public UUID getTagId() {
+ return tagId;
+ }
+
+ @Override
+ public UUID getObjectId() {
+ return objectId;
+ }
+
+ @Override
+ public ObjectType getObjectType() {
+ return objectType;
+ }
+
+ @Override
+ public TagDefinition getTagDefinition() {
+ return tagDefinition;
+ }
+
+ @Override
+ public BusEventType getBusEventType() {
+ return BusEventType.USER_TAG_DELETION;
+ }
+
+ @Override
+ public UUID getUserToken() {
+ return userToken;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("DefaultUserTagDeletionEvent");
+ sb.append("{objectId=").append(objectId);
+ sb.append(", tagId=").append(tagId);
+ sb.append(", objectType=").append(objectType);
+ sb.append(", tagDefinition=").append(tagDefinition);
+ sb.append(", userToken=").append(userToken);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final DefaultUserTagDeletionEvent that = (DefaultUserTagDeletionEvent) o;
+
+ if (objectId != null ? !objectId.equals(that.objectId) : that.objectId != null) {
+ return false;
+ }
+ if (objectType != that.objectType) {
+ return false;
+ }
+ if (tagDefinition != null ? !tagDefinition.equals(that.tagDefinition) : that.tagDefinition != null) {
+ return false;
+ }
+ if (tagId != null ? !tagId.equals(that.tagId) : that.tagId != null) {
+ return false;
+ }
+ if (userToken != null ? !userToken.equals(that.userToken) : that.userToken != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = tagId != null ? tagId.hashCode() : 0;
+ result = 31 * result + (objectId != null ? objectId.hashCode() : 0);
+ result = 31 * result + (objectType != null ? objectType.hashCode() : 0);
+ result = 31 * result + (tagDefinition != null ? tagDefinition.hashCode() : 0);
+ result = 31 * result + (userToken != null ? userToken.hashCode() : 0);
+ return result;
+ }
+}
diff --git a/util/src/main/java/com/ning/billing/util/tag/api/user/TagEventBuilder.java b/util/src/main/java/com/ning/billing/util/tag/api/user/TagEventBuilder.java
new file mode 100644
index 0000000..9160731
--- /dev/null
+++ b/util/src/main/java/com/ning/billing/util/tag/api/user/TagEventBuilder.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.ControlTagCreationEvent;
+import com.ning.billing.util.tag.api.ControlTagDefinitionCreationEvent;
+import com.ning.billing.util.tag.api.ControlTagDefinitionDeletionEvent;
+import com.ning.billing.util.tag.api.ControlTagDeletionEvent;
+import com.ning.billing.util.tag.api.UserTagCreationEvent;
+import com.ning.billing.util.tag.api.UserTagDefinitionCreationEvent;
+import com.ning.billing.util.tag.api.UserTagDefinitionDeletionEvent;
+import com.ning.billing.util.tag.api.UserTagDeletionEvent;
+
+public class TagEventBuilder {
+ public UserTagDefinitionCreationEvent newUserTagDefinitionCreationEvent(final UUID tagDefinitionId, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken);
+ }
+
+ public UserTagDefinitionDeletionEvent newUserTagDefinitionDeletionEvent(final UUID tagDefinitionId, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken);
+ }
+
+ public ControlTagDefinitionCreationEvent newControlTagDefinitionCreationEvent(final UUID tagDefinitionId, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken);
+ }
+
+ public ControlTagDefinitionDeletionEvent newControlTagDefinitionDeletionEvent(final UUID tagDefinitionId, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken);
+ }
+
+ public UserTagCreationEvent newUserTagCreationEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ }
+
+ public UserTagDeletionEvent newUserTagDeletionEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ }
+
+ public ControlTagCreationEvent newControlTagCreationEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ }
+
+ public ControlTagDeletionEvent newControlTagDeletionEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final TagDefinition tagDefinition, final UUID userToken) {
+ return new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagCreationEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagCreationEvent.java
new file mode 100644
index 0000000..f8a594a
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagCreationEvent.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultControlTagCreationEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultControlTagCreationEvent event = new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.CONTROL_TAG_CREATION);
+
+ Assert.assertEquals(event.getTagId(), tagId);
+ Assert.assertEquals(event.getObjectId(), objectId);
+ Assert.assertEquals(event.getObjectType(), objectType);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionCreationEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionCreationEvent.java
new file mode 100644
index 0000000..7f2260b
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionCreationEvent.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultControlTagDefinitionCreationEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultControlTagDefinitionCreationEvent event = new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.CONTROL_TAGDEFINITION_CREATION);
+
+ Assert.assertEquals(event.getTagDefinitionId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionDeletionEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionDeletionEvent.java
new file mode 100644
index 0000000..26d2322
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDefinitionDeletionEvent.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultControlTagDefinitionDeletionEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultControlTagDefinitionDeletionEvent event = new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.CONTROL_TAGDEFINITION_DELETION);
+
+ Assert.assertEquals(event.getTagDefinitionId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDeletionEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDeletionEvent.java
new file mode 100644
index 0000000..089ee63
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultControlTagDeletionEvent.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultControlTagDeletionEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultControlTagDeletionEvent event = new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.CONTROL_TAG_DELETION);
+
+ Assert.assertEquals(event.getTagId(), tagId);
+ Assert.assertEquals(event.getObjectId(), objectId);
+ Assert.assertEquals(event.getObjectType(), objectType);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagCreationEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagCreationEvent.java
new file mode 100644
index 0000000..72e5f98
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagCreationEvent.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultUserTagCreationEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultUserTagCreationEvent event = new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.USER_TAG_CREATION);
+
+ Assert.assertEquals(event.getTagId(), tagId);
+ Assert.assertEquals(event.getObjectId(), objectId);
+ Assert.assertEquals(event.getObjectType(), objectType);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionCreationEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionCreationEvent.java
new file mode 100644
index 0000000..9c033b9
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionCreationEvent.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultUserTagDefinitionCreationEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultUserTagDefinitionCreationEvent event = new DefaultUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.USER_TAGDEFINITION_CREATION);
+
+ Assert.assertEquals(event.getTagDefinitionId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionDeletionEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionDeletionEvent.java
new file mode 100644
index 0000000..b5f7615
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDefinitionDeletionEvent.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultUserTagDefinitionDeletionEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultUserTagDefinitionDeletionEvent event = new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.USER_TAGDEFINITION_DELETION);
+
+ Assert.assertEquals(event.getTagDefinitionId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDeletionEvent.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDeletionEvent.java
new file mode 100644
index 0000000..ed5b073
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestDefaultUserTagDeletionEvent.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.bus.BusEvent;
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+
+public class TestDefaultUserTagDeletionEvent {
+ @Test(groups = "fast")
+ public void testPojo() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final DefaultUserTagDeletionEvent event = new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertEquals(event.getBusEventType(), BusEvent.BusEventType.USER_TAG_DELETION);
+
+ Assert.assertEquals(event.getTagId(), tagId);
+ Assert.assertEquals(event.getObjectId(), objectId);
+ Assert.assertEquals(event.getObjectType(), objectType);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertEquals(event, new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(event));
+ Assert.assertTrue(event.equals(new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+ }
+}
diff --git a/util/src/test/java/com/ning/billing/util/tag/api/user/TestTagEventBuilder.java b/util/src/test/java/com/ning/billing/util/tag/api/user/TestTagEventBuilder.java
new file mode 100644
index 0000000..724ad14
--- /dev/null
+++ b/util/src/test/java/com/ning/billing/util/tag/api/user/TestTagEventBuilder.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2010-2012 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.util.tag.api.user;
+
+import java.util.UUID;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.ning.billing.util.dao.ObjectType;
+import com.ning.billing.util.tag.DefaultTagDefinition;
+import com.ning.billing.util.tag.TagDefinition;
+import com.ning.billing.util.tag.api.ControlTagCreationEvent;
+import com.ning.billing.util.tag.api.ControlTagDefinitionCreationEvent;
+import com.ning.billing.util.tag.api.ControlTagDefinitionDeletionEvent;
+import com.ning.billing.util.tag.api.ControlTagDeletionEvent;
+import com.ning.billing.util.tag.api.TagDefinitionEvent;
+import com.ning.billing.util.tag.api.TagEvent;
+import com.ning.billing.util.tag.api.UserTagCreationEvent;
+import com.ning.billing.util.tag.api.UserTagDefinitionCreationEvent;
+import com.ning.billing.util.tag.api.UserTagDefinitionDeletionEvent;
+import com.ning.billing.util.tag.api.UserTagDeletionEvent;
+
+public class TestTagEventBuilder {
+ @Test(groups = "fast")
+ public void testNewUserTagDefinitionCreationEvent() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagDefinitionEvent event = tagEventBuilder.newUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof UserTagDefinitionCreationEvent);
+
+ Assert.assertEquals(event, new DefaultUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken)));
+
+ verifyTagDefinitionEvent(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ @Test(groups = "fast")
+ public void testNewUserTagDefinitionDeletionEvent() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagDefinitionEvent event = tagEventBuilder.newUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof UserTagDefinitionDeletionEvent);
+
+ Assert.assertEquals(event, new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken)));
+
+ verifyTagDefinitionEvent(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ @Test(groups = "fast")
+ public void testNewControlTagDefinitionCreationEvent() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagDefinitionEvent event = tagEventBuilder.newControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof ControlTagDefinitionCreationEvent);
+
+ Assert.assertEquals(event, new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, userToken)));
+
+ verifyTagDefinitionEvent(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ @Test(groups = "fast")
+ public void testNewControlTagDefinitionDeletionEvent() throws Exception {
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagDefinitionEvent event = tagEventBuilder.newControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof ControlTagDefinitionDeletionEvent);
+
+ Assert.assertEquals(event, new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, userToken)));
+
+ verifyTagDefinitionEvent(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ @Test(groups = "fast")
+ public void testNewUserTagCreationEvent() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagEvent event = tagEventBuilder.newUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof UserTagCreationEvent);
+
+ Assert.assertEquals(event, new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+
+ verifyTagEvent(tagId, objectId, objectType, tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ @Test(groups = "fast")
+ public void testNewUserTagDeletionEvent() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagEvent event = tagEventBuilder.newUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof UserTagDeletionEvent);
+
+ Assert.assertEquals(event, new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+
+ verifyTagEvent(tagId, objectId, objectType, tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ @Test(groups = "fast")
+ public void testNewControlTagCreationEvent() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagEvent event = tagEventBuilder.newControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof ControlTagCreationEvent);
+
+ Assert.assertEquals(event, new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+
+ verifyTagEvent(tagId, objectId, objectType, tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ @Test(groups = "fast")
+ public void testNewControlTagDeletionEvent() throws Exception {
+ final UUID tagId = UUID.randomUUID();
+ final UUID objectId = UUID.randomUUID();
+ final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
+ final UUID tagDefinitionId = UUID.randomUUID();
+ final String tagDefinitionName = UUID.randomUUID().toString();
+ final String tagDefinitionDescription = UUID.randomUUID().toString();
+ final boolean controlTag = true;
+ final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
+ final UUID userToken = UUID.randomUUID();
+
+ final TagEventBuilder tagEventBuilder = new TagEventBuilder();
+ final TagEvent event = tagEventBuilder.newControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken);
+ Assert.assertTrue(event instanceof ControlTagDeletionEvent);
+
+ Assert.assertEquals(event, new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken));
+ Assert.assertTrue(event.equals(new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, userToken)));
+
+ verifyTagEvent(tagId, objectId, objectType, tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
+ }
+
+ private void verifyTagDefinitionEvent(final UUID tagDefinitionId, final String tagDefinitionName, final String tagDefinitionDescription, final TagDefinition tagDefinition, final UUID userToken, final TagDefinitionEvent event) {
+ Assert.assertEquals(event.getTagDefinitionId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertTrue(event.equals(event));
+ }
+
+ private void verifyTagEvent(final UUID tagId, final UUID objectId, final ObjectType objectType, final UUID tagDefinitionId, final String tagDefinitionName, final String tagDefinitionDescription, final TagDefinition tagDefinition, final UUID userToken, final TagEvent event) {
+ Assert.assertEquals(event.getTagId(), tagId);
+ Assert.assertEquals(event.getObjectId(), objectId);
+ Assert.assertEquals(event.getObjectType(), objectType);
+ Assert.assertEquals(event.getTagDefinition(), tagDefinition);
+ Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
+ Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
+ Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
+ Assert.assertEquals(event.getUserToken(), userToken);
+
+ Assert.assertEquals(event, event);
+ Assert.assertTrue(event.equals(event));
+ }
+}