@Override
    public boolean processData(DistroData distroData) {
        switch (distroData.getType()) {
            case ADD:
            case CHANGE:
                ClientSyncData clientSyncData = ApplicationUtils.getBean(Serializer.class)
                        .deserialize(distroData.getContent(), ClientSyncData.class);
                handlerClientSyncData(clientSyncData);
                return true;
            case DELETE:
                String deleteClientId = distroData.getDistroKey().getResourceKey();
                Loggers.DISTRO.info("[Client-Delete] Received distro client sync data {}", deleteClientId);
                clientManager.clientDisconnected(deleteClientId);
                return true;
            default:
                return false;
        }
    }
@Test
    void testProcessDataForBatch() {
        // swap tmp
        Serializer mock = Mockito.mock(Serializer.class);
        when(applicationContext.getBean(Serializer.class)).thenReturn(mock);
        
        // single instance => batch instances => batch instances => single instance
        // single
        ClientSyncData syncData = createSingleForBatchTest(1);
        DistroData data = new DistroData();
        data.setContent(serializer.serialize(syncData));
        data.setType(DataOperation.ADD);
        when(mock.deserialize(any(), eq(ClientSyncData.class))).thenReturn(syncData);
        distroClientDataProcessor.processData(data);
        assertEquals(1L, client.getRevision());
        assertEquals(1, client.getAllPublishedService().size());
        Service service = Service.newService("batchData", "batchData", "batchData");
        Service singleton = ServiceManager.getInstance().getSingleton(service);
        InstancePublishInfo info = client.getInstancePublishInfo(ServiceManager.getInstance().getSingleton(singleton));
        assertEquals("127.0.0.1", info.getIp());
        assertEquals(8080, info.getPort());
        
        // batch
        data = new DistroData();
        syncData = createBatchForBatchTest(2);
        data.setContent(serializer.serialize(syncData));
        data.setType(DataOperation.CHANGE);
        when(mock.deserialize(any(), eq(ClientSyncData.class))).thenReturn(syncData);
        distroClientDataProcessor.processData(data);
        assertEquals(2L, client.getRevision());
        assertEquals(1, client.getAllPublishedService().size());
        info = client.getInstancePublishInfo(ServiceManager.getInstance().getSingleton(singleton));
        assertTrue(info instanceof BatchInstancePublishInfo);
        BatchInstancePublishInfo batchInfo = (BatchInstancePublishInfo) info;
        assertEquals(2, batchInfo.getInstancePublishInfos().size());
        for (InstancePublishInfo instancePublishInfo : batchInfo.getInstancePublishInfos()) {
            assertEquals("127.0.0.1", instancePublishInfo.getIp());
            assertTrue(instancePublishInfo.getPort() == 8080 || instancePublishInfo.getPort() == 8081);
        }
        
        // batch
        data = new DistroData();
        syncData = createBatchForBatchTest(3);
        data.setContent(serializer.serialize(syncData));
        data.setType(DataOperation.CHANGE);
        when(mock.deserialize(any(), eq(ClientSyncData.class))).thenReturn(syncData);
        distroClientDataProcessor.processData(data);
        assertEquals(3L, client.getRevision());
        assertEquals(1, client.getAllPublishedService().size());
        info = client.getInstancePublishInfo(ServiceManager.getInstance().getSingleton(singleton));
        assertTrue(info instanceof BatchInstancePublishInfo);
        batchInfo = (BatchInstancePublishInfo) info;
        assertEquals(2, batchInfo.getInstancePublishInfos().size());
        for (InstancePublishInfo instancePublishInfo : batchInfo.getInstancePublishInfos()) {
            assertEquals("127.0.0.1", instancePublishInfo.getIp());
            assertTrue(instancePublishInfo.getPort() == 8080 || instancePublishInfo.getPort() == 8081);
        }
        
        // single
        syncData = createSingleForBatchTest(4);
        data = new DistroData();
        data.setContent(serializer.serialize(syncData));
        data.setType(DataOperation.ADD);
        when(mock.deserialize(any(), eq(ClientSyncData.class))).thenReturn(syncData);
        distroClientDataProcessor.processData(data);
        assertEquals(4L, client.getRevision());
        assertEquals(1, client.getAllPublishedService().size());
        info = client.getInstancePublishInfo(ServiceManager.getInstance().getSingleton(singleton));
        assertEquals("127.0.0.1", info.getIp());
        assertEquals(8080, info.getPort());
    }