Search in sources :

Example 1 with ContentOverrideValidator

use of org.candlepin.util.ContentOverrideValidator in project candlepin by candlepin.

the class ConsumerContentOverrideResourceTest method setUp.

@Before
public void setUp() {
    ConsumerType ctype = new ConsumerType("test-consumer-type");
    ctype.setId("test-ctype");
    consumer = new Consumer("test-consumer", "test-user", new Owner("Test Owner"), ctype);
    MultivaluedMap<String, String> mvm = new MultivaluedMapImpl<>();
    mvm.add("consumer_uuid", consumer.getUuid());
    context = mock(UriInfo.class);
    when(context.getPathParameters()).thenReturn(mvm);
    when(consumerCurator.verifyAndLookupConsumer(eq(consumer.getUuid()))).thenReturn(consumer);
    when(overrideRules.canOverrideForConsumer(any(String.class))).thenReturn(true);
    i18n = I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK);
    contentOverrideValidator = new ContentOverrideValidator(i18n, overrideRules);
    resource = new ConsumerContentOverrideResource(consumerContentOverrideCurator, consumerCurator, contentOverrideValidator, i18n);
    when(principal.canAccess(any(Object.class), any(SubResource.class), any(Access.class))).thenReturn(true);
}
Also used : SubResource(org.candlepin.auth.SubResource) Owner(org.candlepin.model.Owner) Consumer(org.candlepin.model.Consumer) Access(org.candlepin.auth.Access) MultivaluedMapImpl(org.jboss.resteasy.specimpl.MultivaluedMapImpl) ContentOverrideValidator(org.candlepin.util.ContentOverrideValidator) ConsumerType(org.candlepin.model.ConsumerType) UriInfo(javax.ws.rs.core.UriInfo) Before(org.junit.Before)

Aggregations

UriInfo (javax.ws.rs.core.UriInfo)1 Access (org.candlepin.auth.Access)1 SubResource (org.candlepin.auth.SubResource)1 Consumer (org.candlepin.model.Consumer)1 ConsumerType (org.candlepin.model.ConsumerType)1 Owner (org.candlepin.model.Owner)1 ContentOverrideValidator (org.candlepin.util.ContentOverrideValidator)1 MultivaluedMapImpl (org.jboss.resteasy.specimpl.MultivaluedMapImpl)1 Before (org.junit.Before)1