BUG-8733: refactor IdInts listeners
[controller.git] / opendaylight / md-sal / samples / clustering-test-app / provider / src / main / java / org / opendaylight / controller / clustering / it / provider / impl / DataListenerViolation.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.clustering.it.provider.impl;
9
10 import com.google.common.base.MoreObjects;
11 import com.google.common.base.Optional;
12 import org.opendaylight.controller.clustering.it.provider.NormalizedNodeDiff;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14
15 public final class DataListenerViolation {
16     private final NormalizedNode<?, ?> expected;
17     private final NormalizedNode<?, ?> actual;
18     private final long sequence;
19
20     DataListenerViolation(final long sequence, final NormalizedNode<?, ?> expected, final NormalizedNode<?, ?> actual) {
21         this.sequence = sequence;
22         this.expected = expected;
23         this.actual = actual;
24     }
25
26     public long getSequence() {
27         return sequence;
28     }
29
30     public Optional<NormalizedNodeDiff> toDiff() {
31         return NormalizedNodeDiff.compute(expected, actual);
32     }
33
34     @Override
35     public String toString() {
36         return MoreObjects.toStringHelper(this).add("sequence", sequence).toString();
37     }
38
39 }