@Test public void testCreateDeviceKeyUsingUsernamePassword() { DeviceKeyId deviceKeyId = DeviceKeyId.deviceKeyId(deviceKeyIdValue); DeviceKey deviceKey = DeviceKey.createDeviceKeyUsingUsernamePassword(deviceKeyId, deviceKeyLabel, deviceKeyUsername, deviceKeyPassword); assertNotNull("The deviceKey should not be null.", deviceKey); assertEquals("The deviceKeyId should match as expected", deviceKeyId, deviceKey.deviceKeyId()); assertEquals("The label should match as expected", deviceKeyLabel, deviceKey.label()); assertEquals("The type should match as expected", DeviceKey.Type.USERNAME_PASSWORD, deviceKey.type()); UsernamePassword usernamePassword = deviceKey.asUsernamePassword(); assertNotNull("The usernamePassword should not be null.", usernamePassword); assertEquals("The username should match as expected", deviceKeyUsername, usernamePassword.username()); assertEquals("The password should match as expected", deviceKeyPassword, usernamePassword.password()); }
public static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label, String username, String password) { DefaultAnnotations annotations = builder().set(AnnotationKeys.USERNAME, username) .set(AnnotationKeys.PASSWORD, password).build(); return new DeviceKey(id, label, Type.USERNAME_PASSWORD, annotations); }
DeviceKey extends AbstractAnnotated { public static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label, String username, String password) { DefaultAnnotations annotations = builder().set(AnnotationKeys.USERNAME, username) .set(AnnotationKeys.PASSWORD, password).build(); return new DeviceKey(id, label, Type.USERNAME_PASSWORD, annotations); } }
DeviceKey extends AbstractAnnotated { public static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label, String username, String password) { DefaultAnnotations annotations = builder().set(AnnotationKeys.USERNAME, username) .set(AnnotationKeys.PASSWORD, password).build(); return new DeviceKey(id, label, Type.USERNAME_PASSWORD, annotations); } DeviceKey(); private  DeviceKey(DeviceKeyId id, String label, Type type, Annotations... annotations); }
DeviceKey extends AbstractAnnotated { public static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label, String username, String password) { DefaultAnnotations annotations = builder().set(AnnotationKeys.USERNAME, username) .set(AnnotationKeys.PASSWORD, password).build(); return new DeviceKey(id, label, Type.USERNAME_PASSWORD, annotations); } DeviceKey(); private  DeviceKey(DeviceKeyId id, String label, Type type, Annotations... annotations); DeviceKeyId deviceKeyId(); String label(); Type type(); static DeviceKey createDeviceKeyUsingCommunityName(DeviceKeyId id, String label, String name); CommunityName asCommunityName(); static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label,
                                                                 String username, String password); UsernamePassword asUsernamePassword(); }
DeviceKey extends AbstractAnnotated { public static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label, String username, String password) { DefaultAnnotations annotations = builder().set(AnnotationKeys.USERNAME, username) .set(AnnotationKeys.PASSWORD, password).build(); return new DeviceKey(id, label, Type.USERNAME_PASSWORD, annotations); } DeviceKey(); private  DeviceKey(DeviceKeyId id, String label, Type type, Annotations... annotations); DeviceKeyId deviceKeyId(); String label(); Type type(); static DeviceKey createDeviceKeyUsingCommunityName(DeviceKeyId id, String label, String name); CommunityName asCommunityName(); static DeviceKey createDeviceKeyUsingUsernamePassword(DeviceKeyId id, String label,
                                                                 String username, String password); UsernamePassword asUsernamePassword();  }