@Test public void testUpdate() { AnonymousConfiguration newConfiguration = new TestAnonymousConfiguration(); newConfiguration.setRealmName(AnonymousConfiguration.DEFAULT_REALM_NAME); newConfiguration.setUserId(AnonymousConfiguration.DEFAULT_USER_ID); newConfiguration.setEnabled(false); AnonymousAccessSettingsXO xo = new AnonymousAccessSettingsXO(newConfiguration); when(anonymousManager.getConfiguration()).thenReturn(newConfiguration); assertThat(underTest.update(xo), is(new AnonymousAccessSettingsXO(newConfiguration))); }
@PUT @RequiresAuthentication @RequiresPermissions("nexus:settings:update") @Override public AnonymousAccessSettingsXO update(@Valid final AnonymousAccessSettingsXO anonymousXO) { Realm realm = validate(anonymousXO); AnonymousConfiguration configuration = anonymousManager.newConfiguration(); configuration.setEnabled(anonymousXO.isEnabled()); configuration.setUserId(anonymousXO.getUserId()); configuration.setRealmName(realm.getName()); anonymousManager.setConfiguration(configuration); return new AnonymousAccessSettingsXO(anonymousManager.getConfiguration()); }
AnonymousAccessApiResource extends ComponentSupport implements Resource, AnonymousAccessApiResourceDoc { @PUT @RequiresAuthentication @RequiresPermissions("nexus:settings:update") @Override public AnonymousAccessSettingsXO update(@Valid final AnonymousAccessSettingsXO anonymousXO) { Realm realm = validate(anonymousXO); AnonymousConfiguration configuration = anonymousManager.newConfiguration(); configuration.setEnabled(anonymousXO.isEnabled()); configuration.setUserId(anonymousXO.getUserId()); configuration.setRealmName(realm.getName()); anonymousManager.setConfiguration(configuration); return new AnonymousAccessSettingsXO(anonymousManager.getConfiguration()); } }
AnonymousAccessApiResource extends ComponentSupport implements Resource, AnonymousAccessApiResourceDoc { @PUT @RequiresAuthentication @RequiresPermissions("nexus:settings:update") @Override public AnonymousAccessSettingsXO update(@Valid final AnonymousAccessSettingsXO anonymousXO) { Realm realm = validate(anonymousXO); AnonymousConfiguration configuration = anonymousManager.newConfiguration(); configuration.setEnabled(anonymousXO.isEnabled()); configuration.setUserId(anonymousXO.getUserId()); configuration.setRealmName(realm.getName()); anonymousManager.setConfiguration(configuration); return new AnonymousAccessSettingsXO(anonymousManager.getConfiguration()); } @Inject  AnonymousAccessApiResource(final AnonymousManager anonymousManager, final RealmSecurityManager realmSecurityManager); }
AnonymousAccessApiResource extends ComponentSupport implements Resource, AnonymousAccessApiResourceDoc { @PUT @RequiresAuthentication @RequiresPermissions("nexus:settings:update") @Override public AnonymousAccessSettingsXO update(@Valid final AnonymousAccessSettingsXO anonymousXO) { Realm realm = validate(anonymousXO); AnonymousConfiguration configuration = anonymousManager.newConfiguration(); configuration.setEnabled(anonymousXO.isEnabled()); configuration.setUserId(anonymousXO.getUserId()); configuration.setRealmName(realm.getName()); anonymousManager.setConfiguration(configuration); return new AnonymousAccessSettingsXO(anonymousManager.getConfiguration()); } @Inject  AnonymousAccessApiResource(final AnonymousManager anonymousManager, final RealmSecurityManager realmSecurityManager); @GET @RequiresPermissions("nexus:settings:read") @Override AnonymousAccessSettingsXO read(); @PUT @RequiresAuthentication @RequiresPermissions("nexus:settings:update") @Override AnonymousAccessSettingsXO update(@Valid final AnonymousAccessSettingsXO anonymousXO); }
AnonymousAccessApiResource extends ComponentSupport implements Resource, AnonymousAccessApiResourceDoc { @PUT @RequiresAuthentication @RequiresPermissions("nexus:settings:update") @Override public AnonymousAccessSettingsXO update(@Valid final AnonymousAccessSettingsXO anonymousXO) { Realm realm = validate(anonymousXO); AnonymousConfiguration configuration = anonymousManager.newConfiguration(); configuration.setEnabled(anonymousXO.isEnabled()); configuration.setUserId(anonymousXO.getUserId()); configuration.setRealmName(realm.getName()); anonymousManager.setConfiguration(configuration); return new AnonymousAccessSettingsXO(anonymousManager.getConfiguration()); } @Inject  AnonymousAccessApiResource(final AnonymousManager anonymousManager, final RealmSecurityManager realmSecurityManager); @GET @RequiresPermissions("nexus:settings:read") @Override AnonymousAccessSettingsXO read(); @PUT @RequiresAuthentication @RequiresPermissions("nexus:settings:update") @Override AnonymousAccessSettingsXO update(@Valid final AnonymousAccessSettingsXO anonymousXO);  }