use of com.alibaba.nacos.core.distributed.distro.entity.DistroData in project nacos by alibaba.
the class DistroControllerTest method testGetAllDatums.
@Test
public void testGetAllDatums() {
Mockito.when(distroProtocol.onSnapshot(Mockito.any())).thenReturn(new DistroData(null, "content".getBytes()));
ResponseEntity<byte[]> responseEntity = distroController.getAllDatums();
Assert.assertArrayEquals("content".getBytes(), responseEntity.getBody());
}
use of com.alibaba.nacos.core.distributed.distro.entity.DistroData in project nacos by alibaba.
the class DistroDataRequestHandler method handleSnapshot.
private DistroDataResponse handleSnapshot() {
DistroDataResponse result = new DistroDataResponse();
DistroData distroData = distroProtocol.onSnapshot(DistroClientDataProcessor.TYPE);
result.setDistroData(distroData);
return result;
}
use of com.alibaba.nacos.core.distributed.distro.entity.DistroData in project nacos by alibaba.
the class DistroDataRequestHandler method handleQueryData.
private DistroDataResponse handleQueryData(DistroData distroData) {
DistroDataResponse result = new DistroDataResponse();
DistroKey distroKey = distroData.getDistroKey();
DistroData queryData = distroProtocol.onQuery(distroKey);
result.setDistroData(queryData);
return result;
}
use of com.alibaba.nacos.core.distributed.distro.entity.DistroData in project nacos by alibaba.
the class DistroDataRequestTest method testGetterAndSetter.
@Test
public void testGetterAndSetter() {
DistroData distroData = mock(DistroData.class);
DataOperation dataOperation = mock(DataOperation.class);
DistroDataRequest req = new DistroDataRequest();
req.setDistroData(distroData);
req.setDataOperation(dataOperation);
assertEquals(distroData, req.getDistroData());
assertEquals(dataOperation, req.getDataOperation());
}
use of com.alibaba.nacos.core.distributed.distro.entity.DistroData in project nacos by alibaba.
the class DistroSyncChangeTask method doExecuteWithCallback.
@Override
protected void doExecuteWithCallback(DistroCallback callback) {
String type = getDistroKey().getResourceType();
DistroData distroData = getDistroData(type);
if (null == distroData) {
Loggers.DISTRO.warn("[DISTRO] {} with null data to sync, skip", toString());
return;
}
getDistroComponentHolder().findTransportAgent(type).syncData(distroData, getDistroKey().getTargetServer(), callback);
}
Aggregations