public void testToProxyParticipant() throws Exception { ParticipantId participant = ParticipantId.of("foo@example.com"); ParticipantId proxyParticipant = ParticipantId.of("foo+proxyFor@example.com"); assertEquals(proxyParticipant, OperationUtil.toProxyParticipant(participant, "proxyFor")); // If participant is already a proxy - return without a change. assertEquals(proxyParticipant, OperationUtil.toProxyParticipant(proxyParticipant, "proxyFor")); }
public void testGetRequiredParameter() throws Exception { String waveId = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVE_ID); assertEquals(s(WAVE_ID), waveId); }
public void testToProxyParticipant() throws Exception { ParticipantId participant = ParticipantId.of("foo@example.com"); ParticipantId proxyParticipant = ParticipantId.of("foo+proxyFor@example.com"); assertEquals(proxyParticipant, OperationUtil.toProxyParticipant(participant, "proxyFor")); // If participant is already a proxy - return without a change. assertEquals(proxyParticipant, OperationUtil.toProxyParticipant(proxyParticipant, "proxyFor")); }
public void testGetRequiredParameter() throws Exception { String waveId = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVE_ID); assertEquals(s(WAVE_ID), waveId); }
public void testGetProtocolVersion() throws Exception { ProtocolVersion protocolVersion = OperationUtil.getProtocolVersion(Collections.<OperationRequest> emptyList()); assertEquals( "Empty list should return default version", ProtocolVersion.DEFAULT, protocolVersion); protocolVersion = OperationUtil.getProtocolVersion(Collections.singletonList(operation)); assertEquals("Non notify op as first op should return default", ProtocolVersion.DEFAULT, protocolVersion); OperationRequest notifyOp = new OperationRequest(OperationType.ROBOT_NOTIFY.method(), "op1"); protocolVersion = OperationUtil.getProtocolVersion(Collections.singletonList(notifyOp)); assertEquals("Notify op as first op without version parameter should return default", ProtocolVersion.DEFAULT, protocolVersion); Parameter versionParameter = Parameter.of(ParamsProperty.PROTOCOL_VERSION, ProtocolVersion.V2_1.getVersionString()); notifyOp = new OperationRequest(OperationType.ROBOT_NOTIFY.method(), "op1", versionParameter); protocolVersion = OperationUtil.getProtocolVersion(Collections.singletonList(notifyOp)); assertEquals( "Notify op as first op should return its version", ProtocolVersion.V2_1, protocolVersion); }
public void testGetProtocolVersion() throws Exception { ProtocolVersion protocolVersion = OperationUtil.getProtocolVersion(Collections.<OperationRequest> emptyList()); assertEquals( "Empty list should return default version", ProtocolVersion.DEFAULT, protocolVersion); protocolVersion = OperationUtil.getProtocolVersion(Collections.singletonList(operation)); assertEquals("Non notify op as first op should return default", ProtocolVersion.DEFAULT, protocolVersion); OperationRequest notifyOp = new OperationRequest(OperationType.ROBOT_NOTIFY.method(), "op1"); protocolVersion = OperationUtil.getProtocolVersion(Collections.singletonList(notifyOp)); assertEquals("Notify op as first op without version parameter should return default", ProtocolVersion.DEFAULT, protocolVersion); Parameter versionParameter = Parameter.of(ParamsProperty.PROTOCOL_VERSION, ProtocolVersion.V2_1.getVersionString()); notifyOp = new OperationRequest(OperationType.ROBOT_NOTIFY.method(), "op1", versionParameter); protocolVersion = OperationUtil.getProtocolVersion(Collections.singletonList(notifyOp)); assertEquals( "Notify op as first op should return its version", ProtocolVersion.V2_1, protocolVersion); }
public void testGetOptionalParameter() throws Exception { String waveId = OperationUtil.getOptionalParameter(operation, ParamsProperty.WAVE_ID); assertEquals(s(WAVE_ID), waveId); assertNull("Non existing properties should return null when optional", OperationUtil.getOptionalParameter(operation, ParamsProperty.ANNOTATION)); String defaultValue = "b+1234"; String blipId = OperationUtil.getOptionalParameter(operation, ParamsProperty.BLIP_ID, defaultValue); assertSame("Default value should be returned when object does not exist", defaultValue, blipId); }
public void testGetOptionalParameter() throws Exception { String waveId = OperationUtil.getOptionalParameter(operation, ParamsProperty.WAVE_ID); assertEquals(s(WAVE_ID), waveId); assertNull("Non existing properties should return null when optional", OperationUtil.getOptionalParameter(operation, ParamsProperty.ANNOTATION)); String defaultValue = "b+1234"; String blipId = OperationUtil.getOptionalParameter(operation, ParamsProperty.BLIP_ID, defaultValue); assertSame("Default value should be returned when object does not exist", defaultValue, blipId); }