@@ -0,0 +1,2322 @@
+/*%0A * Copyright 2017-present Open Networking Foundation%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage io.atomix.core.multiset.impl;%0A%0Aimport io.atomix.core.set.DistributedSetType;%0Aimport io.atomix.primitive.PrimitiveId;%0Aimport io.atomix.primitive.service.ServiceContext;%0Aimport io.atomix.primitive.service.impl.DefaultBackupInput;%0Aimport io.atomix.primitive.service.impl.DefaultBackupOutput;%0Aimport io.atomix.primitive.session.Session;%0Aimport io.atomix.primitive.session.SessionId;%0Aimport io.atomix.storage.buffer.Buffer;%0Aimport io.atomix.storage.buffer.HeapBuffer;%0Aimport io.atomix.utils.time.WallClock;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertTrue;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0A/**%0A * Distributed multiset service test.%0A */%0Apublic class DefaultDistributedMultisetServiceTest %7B%0A  @Test%0A  @SuppressWarnings(%22unchecked%22)%0A  public void testSnapshot() throws Exception %7B%0A    ServiceContext context = mock(ServiceContext.class);%0A    when(context.serviceType()).thenReturn(DistributedSetType.instance());%0A    when(context.serviceName()).thenReturn(%22test%22);%0A    when(context.serviceId()).thenReturn(PrimitiveId.from(1));%0A    when(context.wallClock()).thenReturn(new WallClock());%0A%0A    Session session = mock(Session.class);%0A    when(session.sessionId()).thenReturn(SessionId.from(1));%0A%0A    DefaultDistributedMultisetService service = new DefaultDistributedMultisetService();%0A    service.init(context);%0A%0A    service.add(%22foo%22);%0A%0A    Buffer buffer = HeapBuffer.allocate();%0A    service.backup(new DefaultBackupOutput(buffer, service.serializer()));%0A%0A    service = new DefaultDistributedMultisetService();%0A    service.restore(new DefaultBackupInput(buffer.flip(), service.serializer()));%0A%0A    assertTrue(service.contains(%22foo%22));%0A  %7D%0A%7D%0A

Add distributed multiset service backup/restore test.