Return ETag in response header
[aai/champ.git] / champ-service / src / test / java / org / onap / champ / util / etag / TestEtagGenerator.java
1 /**
2  * ============LICENSE_START==========================================
3  * org.onap.aai
4  * ===================================================================
5  * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017-2018 Amdocs
7  * ===================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  */
21 package org.onap.champ.util.etag;
22 import static org.hamcrest.CoreMatchers.is;
23 import static org.hamcrest.CoreMatchers.not;
24 import static org.junit.Assert.assertThat;
25 import java.security.NoSuchAlgorithmException;
26 import java.util.ArrayList;
27 import java.util.HashMap;
28 import java.util.List;
29 import java.util.Map;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.onap.aai.champcore.model.ChampObject;
33 import org.onap.aai.champcore.model.ChampRelationship;
34
35 public class TestEtagGenerator {
36
37     private EtagGenerator etagGenerator;
38
39     @Before
40     public void init() throws NoSuchAlgorithmException {
41         etagGenerator = new EtagGenerator();
42     }
43
44     @Test
45     public void computeHashForIdenticalChampRelationshipObjects() throws Exception {
46         // everything is same
47         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
48         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
49         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
50         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
51         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
52         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
53         assertThat(etagGenerator.computeHashForChampRelationship(champRelationship11), is(etagGenerator.computeHashForChampRelationship(champRelationship12)));
54     }
55
56     @Test
57     public void computeHashForIdenticalChampRelationshipObjects1() throws Exception {
58         // everything is same
59         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").build();
60         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").build();
61         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
62         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a12345").build();
63         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a12345").build();
64         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
65         assertThat(etagGenerator.computeHashForChampRelationship(champRelationship11), is(etagGenerator.computeHashForChampRelationship(champRelationship12)));
66     }
67
68     @Test
69     public void computeHashForIdenticalChampRelationshipObjects2() throws Exception {
70         // everything is same
71         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
72         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
73         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").build();
74         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
75         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
76         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").build();
77         assertThat(etagGenerator.computeHashForChampRelationship(champRelationship11), is(etagGenerator.computeHashForChampRelationship(champRelationship12)));
78     }
79
80
81     @Test
82     public void computeHashForChampRelationshipObjectsWithDifferentKey() throws Exception {
83         // key is different
84         ChampObject sourceChampObject21 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
85         ChampObject targetChampObject21 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
86         ChampRelationship champRelationship21 = new ChampRelationship.Builder(sourceChampObject21, targetChampObject21, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
87         ChampObject sourceChampObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
88         ChampObject targetChampObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
89         ChampRelationship champRelationship22 = new ChampRelationship.Builder(sourceChampObject22, targetChampObject22, "tosca.relationships.HostedOn").key("rel1234").property("prop1", "value1").build();
90         assertThat(etagGenerator.computeHashForChampRelationship(champRelationship21), not(etagGenerator.computeHashForChampRelationship(champRelationship22)));
91     }
92
93     @Test
94     public void computeHashForChampRelationshipObjectsWithDifferentRelationShip() throws Exception {
95         // relationship is different
96         ChampObject sourceChampObject31 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
97         ChampObject targetChampObject31 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
98         ChampRelationship champRelationship31 = new ChampRelationship.Builder(sourceChampObject31, targetChampObject31, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
99         ChampObject sourceChampObject32 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
100         ChampObject targetChampObject32 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
101         ChampRelationship champRelationship32 = new ChampRelationship.Builder(sourceChampObject32, targetChampObject32, "tosca.relationships.RelatedTo").key("rel123").property("prop1", "value1").build();
102         assertThat(etagGenerator.computeHashForChampRelationship(champRelationship31), not(etagGenerator.computeHashForChampRelationship(champRelationship32)));
103     }
104
105     @Test
106     public void computeHashForChampRelationshipObjectsWithDifferentChampObjects() throws Exception {
107         // source/target different
108         ChampObject sourceChampObject41 = new ChampObject.Builder("pserver").key("a123456").property("prop1", "value1").build();
109         ChampObject targetChampObject41 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
110         ChampRelationship champRelationship41 = new ChampRelationship.Builder(sourceChampObject41, targetChampObject41, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
111         ChampObject sourceChampObject42 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
112         ChampObject targetChampObject42 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
113         ChampRelationship champRelationship42 = new ChampRelationship.Builder(sourceChampObject42, targetChampObject42, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
114         assertThat(etagGenerator.computeHashForChampRelationship(champRelationship41), not(etagGenerator.computeHashForChampRelationship(champRelationship42)));
115     }
116
117     @Test
118     public void computeHashForChampRelationshipObjectsWithDifferentProperties() throws Exception {
119         // property different
120         ChampObject sourceChampObject51 = new ChampObject.Builder("pserver").key("a123456").property("prop1", "value1").build();
121         ChampObject targetChampObject51 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
122         ChampRelationship champRelationship51 = new ChampRelationship.Builder(sourceChampObject51, targetChampObject51, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
123         ChampObject sourceChampObject52 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
124         ChampObject targetChampObject52 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
125         ChampRelationship champRelationship52 = new ChampRelationship.Builder(sourceChampObject52, targetChampObject52, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
126         assertThat(etagGenerator.computeHashForChampRelationship(champRelationship51), not(etagGenerator.computeHashForChampRelationship(champRelationship52)));
127     }
128
129     @Test
130     public void testComputeHashForIdenticalChampObjects() throws Exception {
131         ChampObject champObject1 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
132         ChampObject champObject2 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
133         assertThat(etagGenerator.computeHashForChampObject(champObject1), is(etagGenerator.computeHashForChampObject(champObject2)));
134     }
135
136     @Test
137     public void testComputeHashForEquivalentChampObjects() throws Exception {
138         Map<String, Object> properties1 = new HashMap<>();
139         properties1.put("prop3", "value3");
140         properties1.put("prop1", "value1");
141         properties1.put("prop2", "value2");
142         properties1.put("aai-last-mod-ts", "1234");
143         // note aai-last-mod-ts value is different
144         Map<String, Object> properties2 = new HashMap<>();
145         properties2.put("prop3", "value3");
146         properties2.put("prop1", "value1");
147         properties2.put("prop2", "value2");
148         properties2.put("aai-last-mod-ts", "12345");
149
150
151         ChampObject champObject1 = new ChampObject.Builder("pserver").key("a1234").properties(properties1).build();
152         ChampObject champObject2 = new ChampObject.Builder("pserver").key("a1234").properties(properties2).build();
153         assertThat(etagGenerator.computeHashForChampObject(champObject1), is(etagGenerator.computeHashForChampObject(champObject2)));
154     }
155
156     @Test
157     public void testComputeHashForChampObjectsWithDifferentProperties() throws Exception {
158         ChampObject champObject3 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
159         ChampObject champObject4= new ChampObject.Builder("pserver").key("a12345").property("prop2", "value1").build();
160         assertThat(etagGenerator.computeHashForChampObject(champObject3), not(etagGenerator.computeHashForChampObject(champObject4)));
161     }
162
163     @Test
164     public void testComputeHashForChampObjectsWithDifferentKey() throws Exception {
165         ChampObject champObject5 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
166         ChampObject champObject6= new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
167         assertThat(etagGenerator.computeHashForChampObject(champObject5), not(etagGenerator.computeHashForChampObject(champObject6)));
168     }
169
170     @Test
171     public void testComputeHashForIdenticalListOfChampObjects() throws Exception {
172         //List 1
173         ChampObject champObject11 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
174         ChampObject champObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
175         List<ChampObject> champObjects1 = new ArrayList<>();
176         champObjects1.add(champObject11);
177         champObjects1.add(champObject12);
178         // List 2
179         ChampObject champObject21 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
180         ChampObject champObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
181         List<ChampObject> champObjects2 = new ArrayList<>();
182         champObjects2.add(champObject21);
183         champObjects2.add(champObject22);
184
185         assertThat(etagGenerator.computeHashForChampObjects(champObjects1), is(etagGenerator.computeHashForChampObjects(champObjects2)));
186     }
187
188     @Test
189     public void testComputeHashForIdenticalListOfChampObjectsWithDifferentOrder() throws Exception {
190         //List 1
191         ChampObject champObject11 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
192         ChampObject champObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
193         List<ChampObject> champObjects1 = new ArrayList<>();
194         champObjects1.add(champObject11);
195         champObjects1.add(champObject12);
196         // List 2
197         ChampObject champObject21 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
198         ChampObject champObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
199         List<ChampObject> champObjects2 = new ArrayList<>();
200         // Different order of the items added.
201         champObjects2.add(champObject22);
202         champObjects2.add(champObject21);
203
204         assertThat(etagGenerator.computeHashForChampObjects(champObjects1), not(etagGenerator.computeHashForChampObjects(champObjects2)));
205     }
206
207     @Test
208     public void testComputeHashForDifferentListOfChampObjects() throws Exception {
209         //List 1
210         ChampObject champObject11 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
211         ChampObject champObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
212         List<ChampObject> champObjects1 = new ArrayList<>();
213         champObjects1.add(champObject11);
214         champObjects1.add(champObject12);
215         // List 2
216         ChampObject champObject21 = new ChampObject.Builder("pserver").key("a1234").property("prop1", "value1").build();
217         ChampObject champObject22 = new ChampObject.Builder("pserver").key("a123456").property("prop2", "value2").build();
218         List<ChampObject> champObjects2 = new ArrayList<>();
219         champObjects2.add(champObject21);
220         champObjects2.add(champObject22);
221
222         assertThat(etagGenerator.computeHashForChampObjects(champObjects1), not(etagGenerator.computeHashForChampObjects(champObjects2)));
223     }
224
225     @Test
226     public void testComputeHashForIdenticalListOfChampRelationships() throws Exception {
227         //List 1
228         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
229         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
230         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
231         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
232         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
233         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
234         List<ChampRelationship> champRelationships1 = new ArrayList<>();
235         champRelationships1.add(champRelationship11);
236         champRelationships1.add(champRelationship12);
237         // List 2
238         ChampObject sourceChampObject21 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
239         ChampObject targetChampObject21 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
240         ChampRelationship champRelationship21 = new ChampRelationship.Builder(sourceChampObject21, targetChampObject21, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
241         ChampObject sourceChampObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
242         ChampObject targetChampObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
243         ChampRelationship champRelationship22 = new ChampRelationship.Builder(sourceChampObject22, targetChampObject22, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
244         List<ChampRelationship> champRelationships2 = new ArrayList<>();
245         champRelationships2.add(champRelationship21);
246         champRelationships2.add(champRelationship22);
247
248         assertThat(etagGenerator.computeHashForChampRelationships(champRelationships1), is(etagGenerator.computeHashForChampRelationships(champRelationships2)));
249     }
250
251     @Test
252     public void testComputeHashForIdenticalListOfChampRelationships1() throws Exception {
253         //List 1
254         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
255         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
256         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").build();
257         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
258         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
259         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").build();
260         List<ChampRelationship> champRelationships1 = new ArrayList<>();
261         champRelationships1.add(champRelationship11);
262         champRelationships1.add(champRelationship12);
263         // List 2
264         ChampObject sourceChampObject21 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
265         ChampObject targetChampObject21 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
266         ChampRelationship champRelationship21 = new ChampRelationship.Builder(sourceChampObject21, targetChampObject21, "tosca.relationships.HostedOn").key("rel123").build();
267         ChampObject sourceChampObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
268         ChampObject targetChampObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
269         ChampRelationship champRelationship22 = new ChampRelationship.Builder(sourceChampObject22, targetChampObject22, "tosca.relationships.HostedOn").key("rel123").build();
270         List<ChampRelationship> champRelationships2 = new ArrayList<>();
271         champRelationships2.add(champRelationship21);
272         champRelationships2.add(champRelationship22);
273
274         assertThat(etagGenerator.computeHashForChampRelationships(champRelationships1), is(etagGenerator.computeHashForChampRelationships(champRelationships2)));
275     }
276
277     @Test
278     public void testComputeHashForIdenticalListOfChampRelationships2() throws Exception {
279         //List 1
280         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").build();
281         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").build();
282         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
283         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a12345").build();
284         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a12345").build();
285         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
286         List<ChampRelationship> champRelationships1 = new ArrayList<>();
287         champRelationships1.add(champRelationship11);
288         champRelationships1.add(champRelationship12);
289         // List 2
290         ChampObject sourceChampObject21 = new ChampObject.Builder("pserver").key("a12345").build();
291         ChampObject targetChampObject21 = new ChampObject.Builder("pserver").key("a12345").build();
292         ChampRelationship champRelationship21 = new ChampRelationship.Builder(sourceChampObject21, targetChampObject21, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
293         ChampObject sourceChampObject22 = new ChampObject.Builder("pserver").key("a12345").build();
294         ChampObject targetChampObject22 = new ChampObject.Builder("pserver").key("a12345").build();
295         ChampRelationship champRelationship22 = new ChampRelationship.Builder(sourceChampObject22, targetChampObject22, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
296         List<ChampRelationship> champRelationships2 = new ArrayList<>();
297         champRelationships2.add(champRelationship21);
298         champRelationships2.add(champRelationship22);
299
300         assertThat(etagGenerator.computeHashForChampRelationships(champRelationships1), is(etagGenerator.computeHashForChampRelationships(champRelationships2)));
301     }
302
303     @Test
304     public void testComputeHashForIdenticalListOfChampRelationshipsWithDifferentOrder() throws Exception {
305
306         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
307         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
308         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
309         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a123456").property("prop1", "value1").build();
310         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a123456").property("prop2", "value2").build();
311         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").property("prop2", "value2").build();
312         List<ChampRelationship> champRelationships1 = new ArrayList<>();
313         // List 1
314         champRelationships1.add(champRelationship11);
315         champRelationships1.add(champRelationship12);
316         // List 2, elements added in different order
317         List<ChampRelationship> champRelationships2 = new ArrayList<>();
318         champRelationships2.add(champRelationship12);
319         champRelationships2.add(champRelationship11);
320
321         assertThat(etagGenerator.computeHashForChampRelationships(champRelationships1), not(etagGenerator.computeHashForChampRelationships(champRelationships2)));
322     }
323
324     @Test
325     public void testComputeHashForDifferntListOfChampRelationships() throws Exception {
326       //List 1
327         ChampObject sourceChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
328         ChampObject targetChampObject11 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
329         ChampRelationship champRelationship11 = new ChampRelationship.Builder(sourceChampObject11, targetChampObject11, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
330         ChampObject sourceChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop1", "value1").build();
331         ChampObject targetChampObject12 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
332         ChampRelationship champRelationship12 = new ChampRelationship.Builder(sourceChampObject12, targetChampObject12, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
333         List<ChampRelationship> champRelationships1 = new ArrayList<>();
334         champRelationships1.add(champRelationship11);
335         champRelationships1.add(champRelationship12);
336         // List 2
337         ChampObject sourceChampObject21 = new ChampObject.Builder("pserver").key("a123456").property("prop1", "value1").build();
338         ChampObject targetChampObject21 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
339         ChampRelationship champRelationship21 = new ChampRelationship.Builder(sourceChampObject21, targetChampObject21, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
340         ChampObject sourceChampObject22 = new ChampObject.Builder("pserver").key("a123456").property("prop1", "value1").build();
341         ChampObject targetChampObject22 = new ChampObject.Builder("pserver").key("a12345").property("prop2", "value2").build();
342         ChampRelationship champRelationship22 = new ChampRelationship.Builder(sourceChampObject22, targetChampObject22, "tosca.relationships.HostedOn").key("rel123").property("prop1", "value1").build();
343         List<ChampRelationship> champRelationships2 = new ArrayList<>();
344         champRelationships2.add(champRelationship21);
345         champRelationships2.add(champRelationship22);
346
347         assertThat(etagGenerator.computeHashForChampRelationships(champRelationships1), not(etagGenerator.computeHashForChampRelationships(champRelationships2)));
348     }
349
350
351 }
352