@Test public void testSystemNameWithNullDataSource(@Mocked OdeRequest mockOdeRequest) { new Expectations() { { mockOdeRequest.getDataSource(); result = null; mockOdeRequest.getRequestType(); result = OdeRequestType.Subscription; } }; assertEquals("Expected OdeRequestType.Subscription --> SDC: ", SystemName.SDC, DdsRequestManager.systemName(mockOdeRequest)); new Expectations() { { mockOdeRequest.getDataSource(); result = null; mockOdeRequest.getRequestType(); result = OdeRequestType.Query; } }; assertEquals("Expected OdeRequestType.Query --> SDW: ", SystemName.SDW, DdsRequestManager.systemName(mockOdeRequest)); }
public static SystemName systemName(OdeRequest odeRequest) { SystemName sysName; OdeRequest.DataSource dataSource; if (odeRequest.getDataSource() != null) { dataSource = odeRequest.getDataSource(); } else { dataSource = defaultDataSource(odeRequest); } switch (dataSource) { case SDC: case DEPOSIT_SDC: sysName = SystemName.SDC; break; case SDW: case DEPOSIT_SDW: sysName = SystemName.SDW; break; case SDPC: sysName = SystemName.SDPC; break; default: sysName = defaultSystemName(odeRequest); } return sysName; }
DdsRequestManager { public static SystemName systemName(OdeRequest odeRequest) { SystemName sysName; OdeRequest.DataSource dataSource; if (odeRequest.getDataSource() != null) { dataSource = odeRequest.getDataSource(); } else { dataSource = defaultDataSource(odeRequest); } switch (dataSource) { case SDC: case DEPOSIT_SDC: sysName = SystemName.SDC; break; case SDW: case DEPOSIT_SDW: sysName = SystemName.SDW; break; case SDPC: sysName = SystemName.SDPC; break; default: sysName = defaultSystemName(odeRequest); } return sysName; } }
DdsRequestManager { public static SystemName systemName(OdeRequest odeRequest) { SystemName sysName; OdeRequest.DataSource dataSource; if (odeRequest.getDataSource() != null) { dataSource = odeRequest.getDataSource(); } else { dataSource = defaultDataSource(odeRequest); } switch (dataSource) { case SDC: case DEPOSIT_SDC: sysName = SystemName.SDC; break; case SDW: case DEPOSIT_SDW: sysName = SystemName.SDW; break; case SDPC: sysName = SystemName.SDPC; break; default: sysName = defaultSystemName(odeRequest); } return sysName; } DdsRequestManager(OdeProperties odeProperties); }
DdsRequestManager { public static SystemName systemName(OdeRequest odeRequest) { SystemName sysName; OdeRequest.DataSource dataSource; if (odeRequest.getDataSource() != null) { dataSource = odeRequest.getDataSource(); } else { dataSource = defaultDataSource(odeRequest); } switch (dataSource) { case SDC: case DEPOSIT_SDC: sysName = SystemName.SDC; break; case SDW: case DEPOSIT_SDW: sysName = SystemName.SDW; break; case SDPC: sysName = SystemName.SDPC; break; default: sysName = defaultSystemName(odeRequest); } return sysName; } DdsRequestManager(OdeProperties odeProperties); @SuppressWarnings("unchecked") Session connect(WebSocketMessageHandler<T> messageHandler, Class<?> decoder); void sendRequest(OdeRequest odeRequest); static SystemName systemName(OdeRequest odeRequest); static DataSource defaultDataSource(OdeRequest odeRequest); static SystemName defaultSystemName(OdeRequest odeRequest); DdsClient<T> getDdsClient(); void close(); Session getSession(); boolean isConnected(); WebSocketEndpoint<T> getWsClient(); OdeProperties getOdeProperties(); void setDdsClient(DdsClient<T> pDdsClient); void setWsClient(WebSocketEndpoint<T> pWsClient); void setLogger(Logger newLogger); }
DdsRequestManager { public static SystemName systemName(OdeRequest odeRequest) { SystemName sysName; OdeRequest.DataSource dataSource; if (odeRequest.getDataSource() != null) { dataSource = odeRequest.getDataSource(); } else { dataSource = defaultDataSource(odeRequest); } switch (dataSource) { case SDC: case DEPOSIT_SDC: sysName = SystemName.SDC; break; case SDW: case DEPOSIT_SDW: sysName = SystemName.SDW; break; case SDPC: sysName = SystemName.SDPC; break; default: sysName = defaultSystemName(odeRequest); } return sysName; } DdsRequestManager(OdeProperties odeProperties); @SuppressWarnings("unchecked") Session connect(WebSocketMessageHandler<T> messageHandler, Class<?> decoder); void sendRequest(OdeRequest odeRequest); static SystemName systemName(OdeRequest odeRequest); static DataSource defaultDataSource(OdeRequest odeRequest); static SystemName defaultSystemName(OdeRequest odeRequest); DdsClient<T> getDdsClient(); void close(); Session getSession(); boolean isConnected(); WebSocketEndpoint<T> getWsClient(); OdeProperties getOdeProperties(); void setDdsClient(DdsClient<T> pDdsClient); void setWsClient(WebSocketEndpoint<T> pWsClient); void setLogger(Logger newLogger);  }