@Test public void testCreateResources() throws Exception { AmbariManagementController amc = createMock(AmbariManagementController.class); LdapSyncEventResourceProvider provider = new TestLdapSyncEventResourceProvider(amc); Set<Map<String, Object>> properties = new HashSet<Map<String, Object>>(); Map<String, Object> propertyMap = new HashMap<String, Object>(); Set<Map<String, String>> specs = new HashSet<Map<String, String>>(); propertyMap.put(LdapSyncEventResourceProvider.EVENT_SPECS_PROPERTY_ID, specs); properties.add(propertyMap); provider.createResources(PropertyHelper.getCreateRequest(properties, null)); Set<Resource> resources = provider.getResources(PropertyHelper.getReadRequest(), null); Assert.assertEquals(1, resources.size()); }
@Override public Set<Resource> getResources(Request event, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new HashSet<Resource>(); Set<String> requestedIds = getRequestPropertyIds(event, predicate); for (LdapSyncEventEntity eventEntity : events.values()) { resources.add(toResource(eventEntity, requestedIds)); } return resources; }
LdapSyncEventResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request event, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new HashSet<Resource>(); Set<String> requestedIds = getRequestPropertyIds(event, predicate); for (LdapSyncEventEntity eventEntity : events.values()) { resources.add(toResource(eventEntity, requestedIds)); } return resources; } }
LdapSyncEventResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request event, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new HashSet<Resource>(); Set<String> requestedIds = getRequestPropertyIds(event, predicate); for (LdapSyncEventEntity eventEntity : events.values()) { resources.add(toResource(eventEntity, requestedIds)); } return resources; } LdapSyncEventResourceProvider(AmbariManagementController managementController); }
LdapSyncEventResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request event, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new HashSet<Resource>(); Set<String> requestedIds = getRequestPropertyIds(event, predicate); for (LdapSyncEventEntity eventEntity : events.values()) { resources.add(toResource(eventEntity, requestedIds)); } return resources; } LdapSyncEventResourceProvider(AmbariManagementController managementController); @Override RequestStatus createResourcesAuthorized(Request event); @Override Set<Resource> getResources(Request event, Predicate predicate); @Override RequestStatus updateResources(Request event, Predicate predicate); @Override RequestStatus deleteResourcesAuthorized(Request request, Predicate predicate); @Override Map<Resource.Type, String> getKeyPropertyIds(); }
LdapSyncEventResourceProvider extends AbstractControllerResourceProvider { @Override public Set<Resource> getResources(Request event, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { Set<Resource> resources = new HashSet<Resource>(); Set<String> requestedIds = getRequestPropertyIds(event, predicate); for (LdapSyncEventEntity eventEntity : events.values()) { resources.add(toResource(eventEntity, requestedIds)); } return resources; } LdapSyncEventResourceProvider(AmbariManagementController managementController); @Override RequestStatus createResourcesAuthorized(Request event); @Override Set<Resource> getResources(Request event, Predicate predicate); @Override RequestStatus updateResources(Request event, Predicate predicate); @Override RequestStatus deleteResourcesAuthorized(Request request, Predicate predicate); @Override Map<Resource.Type, String> getKeyPropertyIds(); static final String EVENT_ID_PROPERTY_ID; static final String EVENT_STATUS_PROPERTY_ID; static final String EVENT_STATUS_DETAIL_PROPERTY_ID; static final String EVENT_START_TIME_PROPERTY_ID; static final String EVENT_END_TIME_PROPERTY_ID; static final String USERS_CREATED_PROPERTY_ID; static final String USERS_UPDATED_PROPERTY_ID; static final String USERS_REMOVED_PROPERTY_ID; static final String USERS_SKIPPED_PROPERTY_ID; static final String GROUPS_CREATED_PROPERTY_ID; static final String GROUPS_UPDATED_PROPERTY_ID; static final String GROUPS_REMOVED_PROPERTY_ID; static final String MEMBERSHIPS_CREATED_PROPERTY_ID; static final String MEMBERSHIPS_REMOVED_PROPERTY_ID; static final String EVENT_SPECS_PROPERTY_ID; }