@Test public void setEmailConfigurationKeepsTheOriginalPassword() { EmailConfiguration newConfiguration = mock(EmailConfiguration.class); when(emailConfiguration.getPassword()).thenReturn("testpassword"); when(emailManager.getConfiguration()).thenReturn(emailConfiguration); when(emailManager.newConfiguration()).thenReturn(newConfiguration); ApiEmailConfiguration request = new ApiEmailConfiguration(); request.setEnabled(true); request.setPassword(""); underTest.setEmailConfiguration(request); verify(newConfiguration).setPassword(emailConfiguration.getPassword()); verify(newConfiguration).setEnabled(true); verify(emailManager).setConfiguration(newConfiguration); }
@PUT @Validate @RequiresAuthentication @RequiresPermissions("nexus:settings:update") public void setEmailConfiguration(@NotNull @Valid final ApiEmailConfiguration apiEmailConfiguration) { EmailConfiguration emailConfiguration = emailManager.getConfiguration(); String password = emailConfiguration != null ? emailConfiguration.getPassword() : null; emailManager.setConfiguration(convert(apiEmailConfiguration, password)); }
EmailConfigurationApiResource implements Resource, EmailConfigurationApiResourceDoc { @PUT @Validate @RequiresAuthentication @RequiresPermissions("nexus:settings:update") public void setEmailConfiguration(@NotNull @Valid final ApiEmailConfiguration apiEmailConfiguration) { EmailConfiguration emailConfiguration = emailManager.getConfiguration(); String password = emailConfiguration != null ? emailConfiguration.getPassword() : null; emailManager.setConfiguration(convert(apiEmailConfiguration, password)); } }
EmailConfigurationApiResource implements Resource, EmailConfigurationApiResourceDoc { @PUT @Validate @RequiresAuthentication @RequiresPermissions("nexus:settings:update") public void setEmailConfiguration(@NotNull @Valid final ApiEmailConfiguration apiEmailConfiguration) { EmailConfiguration emailConfiguration = emailManager.getConfiguration(); String password = emailConfiguration != null ? emailConfiguration.getPassword() : null; emailManager.setConfiguration(convert(apiEmailConfiguration, password)); } @Inject  EmailConfigurationApiResource(EmailManager emailManager); }
EmailConfigurationApiResource implements Resource, EmailConfigurationApiResourceDoc { @PUT @Validate @RequiresAuthentication @RequiresPermissions("nexus:settings:update") public void setEmailConfiguration(@NotNull @Valid final ApiEmailConfiguration apiEmailConfiguration) { EmailConfiguration emailConfiguration = emailManager.getConfiguration(); String password = emailConfiguration != null ? emailConfiguration.getPassword() : null; emailManager.setConfiguration(convert(apiEmailConfiguration, password)); } @Inject  EmailConfigurationApiResource(EmailManager emailManager); @GET @RequiresPermissions("nexus:settings:read") ApiEmailConfiguration getEmailConfiguration(); @PUT @Validate @RequiresAuthentication @RequiresPermissions("nexus:settings:update") void setEmailConfiguration(@NotNull @Valid final ApiEmailConfiguration apiEmailConfiguration); @POST @Path("/verify") @RequiresAuthentication @RequiresPermissions("nexus:settings:update") ApiEmailValidation testEmailConfiguration(@NotNull String verificationAddress); @DELETE @RequiresAuthentication @RequiresPermissions("nexus:settings:update") void deleteEmailConfiguration(); }
EmailConfigurationApiResource implements Resource, EmailConfigurationApiResourceDoc { @PUT @Validate @RequiresAuthentication @RequiresPermissions("nexus:settings:update") public void setEmailConfiguration(@NotNull @Valid final ApiEmailConfiguration apiEmailConfiguration) { EmailConfiguration emailConfiguration = emailManager.getConfiguration(); String password = emailConfiguration != null ? emailConfiguration.getPassword() : null; emailManager.setConfiguration(convert(apiEmailConfiguration, password)); } @Inject  EmailConfigurationApiResource(EmailManager emailManager); @GET @RequiresPermissions("nexus:settings:read") ApiEmailConfiguration getEmailConfiguration(); @PUT @Validate @RequiresAuthentication @RequiresPermissions("nexus:settings:update") void setEmailConfiguration(@NotNull @Valid final ApiEmailConfiguration apiEmailConfiguration); @POST @Path("/verify") @RequiresAuthentication @RequiresPermissions("nexus:settings:update") ApiEmailValidation testEmailConfiguration(@NotNull String verificationAddress); @DELETE @RequiresAuthentication @RequiresPermissions("nexus:settings:update") void deleteEmailConfiguration();  }