Search in sources :

Example 16 with UserDirectoryService

use of org.opencastproject.security.api.UserDirectoryService in project opencast by opencast.

the class WorkflowStatisticsTest method setUp.

@Before
public void setUp() throws Exception {
    // always start with a fresh solr root directory
    sRoot = new File(getStorageRoot());
    try {
        FileUtils.forceMkdir(sRoot);
    } catch (IOException e) {
        Assert.fail(e.getMessage());
    }
    workflowDefinitions = new ArrayList<WorkflowDefinition>();
    workflowHandlers = new HashSet<HandlerRegistration>();
    String opId = "op";
    WorkflowOperationDefinition op = new WorkflowOperationDefinitionImpl(opId, "Pausing operation", null, true);
    WorkflowOperationHandler opHandler = new ResumableTestWorkflowOperationHandler(opId, Action.PAUSE, Action.CONTINUE);
    HandlerRegistration handler = new HandlerRegistration(opId, opHandler);
    workflowHandlers.add(handler);
    // create operation handlers for our workflows
    for (int i = 1; i <= WORKFLOW_DEFINITION_COUNT; i++) {
        WorkflowDefinition workflowDef = new WorkflowDefinitionImpl();
        workflowDef.setId("def-" + i);
        for (int opCount = 1; opCount <= OPERATION_COUNT; opCount++) {
            workflowDef.add(op);
        }
        workflowDefinitions.add(workflowDef);
    }
    // instantiate a service implementation and its DAO, overriding the methods that depend on the osgi runtime
    service = new WorkflowServiceImpl() {

        @Override
        public Set<HandlerRegistration> getRegisteredHandlers() {
            return workflowHandlers;
        }
    };
    scanner = new WorkflowDefinitionScanner();
    service.addWorkflowDefinitionScanner(scanner);
    // security service
    securityService = EasyMock.createNiceMock(SecurityService.class);
    EasyMock.expect(securityService.getUser()).andReturn(SecurityServiceStub.DEFAULT_ORG_ADMIN).anyTimes();
    EasyMock.expect(securityService.getOrganization()).andReturn(new DefaultOrganization()).anyTimes();
    EasyMock.replay(securityService);
    service.setSecurityService(securityService);
    AuthorizationService authzService = EasyMock.createNiceMock(AuthorizationService.class);
    EasyMock.expect(authzService.getActiveAcl((MediaPackage) EasyMock.anyObject())).andReturn(Tuple.tuple(acl, AclScope.Series)).anyTimes();
    EasyMock.replay(authzService);
    service.setAuthorizationService(authzService);
    UserDirectoryService userDirectoryService = EasyMock.createMock(UserDirectoryService.class);
    EasyMock.expect(userDirectoryService.loadUser((String) EasyMock.anyObject())).andReturn(DEFAULT_ORG_ADMIN).anyTimes();
    EasyMock.replay(userDirectoryService);
    service.setUserDirectoryService(userDirectoryService);
    Organization organization = new DefaultOrganization();
    List<Organization> organizationList = new ArrayList<Organization>();
    organizationList.add(organization);
    OrganizationDirectoryService organizationDirectoryService = EasyMock.createMock(OrganizationDirectoryService.class);
    EasyMock.expect(organizationDirectoryService.getOrganizations()).andReturn(organizationList).anyTimes();
    EasyMock.expect(organizationDirectoryService.getOrganization((String) EasyMock.anyObject())).andReturn(organization).anyTimes();
    EasyMock.replay(organizationDirectoryService);
    service.setOrganizationDirectoryService(organizationDirectoryService);
    MessageSender messageSender = EasyMock.createNiceMock(MessageSender.class);
    EasyMock.replay(messageSender);
    service.setMessageSender(messageSender);
    MediaPackageMetadataService mds = EasyMock.createNiceMock(MediaPackageMetadataService.class);
    EasyMock.replay(mds);
    service.addMetadataService(mds);
    // Register the workflow definitions
    for (WorkflowDefinition workflowDefinition : workflowDefinitions) {
        service.registerWorkflowDefinition(workflowDefinition);
    }
    // Mock the workspace
    workspace = EasyMock.createNiceMock(Workspace.class);
    EasyMock.expect(workspace.getCollectionContents((String) EasyMock.anyObject())).andReturn(new URI[0]);
    EasyMock.replay(workspace);
    // Mock the service registry
    ServiceRegistryInMemoryImpl serviceRegistry = new ServiceRegistryInMemoryImpl(service, securityService, userDirectoryService, organizationDirectoryService, EasyMock.createNiceMock(IncidentService.class));
    // Create the workflow database (solr)
    dao = new WorkflowServiceSolrIndex();
    dao.solrRoot = sRoot + File.separator + "solr." + System.currentTimeMillis();
    dao.setSecurityService(securityService);
    dao.setServiceRegistry(serviceRegistry);
    dao.setAuthorizationService(authzService);
    dao.setOrgDirectory(organizationDirectoryService);
    dao.activate("System Admin");
    service.setDao(dao);
    service.setServiceRegistry(serviceRegistry);
    service.setSecurityService(securityService);
    service.activate(null);
    // Crate a media package
    InputStream is = null;
    try {
        MediaPackageBuilder mediaPackageBuilder = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder();
        mediaPackageBuilder.setSerializer(new DefaultMediaPackageSerializerImpl(new File("target/test-classes")));
        is = WorkflowStatisticsTest.class.getResourceAsStream("/mediapackage-1.xml");
        mediaPackage = mediaPackageBuilder.loadFromXml(is);
        IOUtils.closeQuietly(is);
        Assert.assertNotNull(mediaPackage.getIdentifier());
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }
    // Register the workflow service with the service registry
    serviceRegistry.registerService(service);
}
Also used : IncidentService(org.opencastproject.serviceregistry.api.IncidentService) Set(java.util.Set) HashSet(java.util.HashSet) Organization(org.opencastproject.security.api.Organization) DefaultOrganization(org.opencastproject.security.api.DefaultOrganization) MessageSender(org.opencastproject.message.broker.api.MessageSender) ArrayList(java.util.ArrayList) MediaPackageMetadataService(org.opencastproject.metadata.api.MediaPackageMetadataService) DefaultMediaPackageSerializerImpl(org.opencastproject.mediapackage.DefaultMediaPackageSerializerImpl) MediaPackageBuilder(org.opencastproject.mediapackage.MediaPackageBuilder) SecurityService(org.opencastproject.security.api.SecurityService) WorkflowOperationHandler(org.opencastproject.workflow.api.WorkflowOperationHandler) ServiceRegistryInMemoryImpl(org.opencastproject.serviceregistry.api.ServiceRegistryInMemoryImpl) HandlerRegistration(org.opencastproject.workflow.impl.WorkflowServiceImpl.HandlerRegistration) WorkflowDefinitionImpl(org.opencastproject.workflow.api.WorkflowDefinitionImpl) InputStream(java.io.InputStream) WorkflowDefinition(org.opencastproject.workflow.api.WorkflowDefinition) WorkflowOperationDefinition(org.opencastproject.workflow.api.WorkflowOperationDefinition) IOException(java.io.IOException) IOException(java.io.IOException) UserDirectoryService(org.opencastproject.security.api.UserDirectoryService) WorkflowOperationDefinitionImpl(org.opencastproject.workflow.api.WorkflowOperationDefinitionImpl) AuthorizationService(org.opencastproject.security.api.AuthorizationService) MediaPackage(org.opencastproject.mediapackage.MediaPackage) File(java.io.File) DefaultOrganization(org.opencastproject.security.api.DefaultOrganization) OrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService) Workspace(org.opencastproject.workspace.api.Workspace) Before(org.junit.Before)

Example 17 with UserDirectoryService

use of org.opencastproject.security.api.UserDirectoryService in project opencast by opencast.

the class WorkflowOperationSkippingTest method setUp.

@Before
public void setUp() throws Exception {
    sRoot = new File(getStorageRoot());
    try {
        FileUtils.forceMkdir(sRoot);
    } catch (IOException e) {
        Assert.fail(e.getMessage());
    }
    // create operation handlers for our workflows
    succeedingOperationHandler = new SucceedingWorkflowOperationHandler(mediapackage1);
    handlerRegistrations = new HashSet<HandlerRegistration>();
    handlerRegistrations.add(new HandlerRegistration("op1", succeedingOperationHandler));
    handlerRegistrations.add(new HandlerRegistration("op2", succeedingOperationHandler));
    // instantiate a service implementation and its DAO, overriding the methods that depend on the osgi runtime
    service = new WorkflowServiceImpl() {

        @Override
        public Set<HandlerRegistration> getRegisteredHandlers() {
            return handlerRegistrations;
        }
    };
    scanner = new WorkflowDefinitionScanner();
    service.addWorkflowDefinitionScanner(scanner);
    MediaPackageMetadataService mds = EasyMock.createNiceMock(MediaPackageMetadataService.class);
    EasyMock.replay(mds);
    service.addMetadataService(mds);
    workspace = EasyMock.createNiceMock(Workspace.class);
    EasyMock.expect(workspace.getCollectionContents((String) EasyMock.anyObject())).andReturn(new URI[0]);
    EasyMock.replay(workspace);
    // security service
    SecurityService securityService = EasyMock.createNiceMock(SecurityService.class);
    EasyMock.expect(securityService.getUser()).andReturn(SecurityServiceStub.DEFAULT_ORG_ADMIN).anyTimes();
    EasyMock.expect(securityService.getOrganization()).andReturn(new DefaultOrganization()).anyTimes();
    EasyMock.replay(securityService);
    service.setSecurityService(securityService);
    UserDirectoryService userDirectoryService = EasyMock.createMock(UserDirectoryService.class);
    EasyMock.expect(userDirectoryService.loadUser((String) EasyMock.anyObject())).andReturn(DEFAULT_ORG_ADMIN).anyTimes();
    EasyMock.replay(userDirectoryService);
    service.setUserDirectoryService(userDirectoryService);
    Organization organization = new DefaultOrganization();
    List<Organization> organizationList = new ArrayList<Organization>();
    organizationList.add(organization);
    OrganizationDirectoryService organizationDirectoryService = EasyMock.createMock(OrganizationDirectoryService.class);
    EasyMock.expect(organizationDirectoryService.getOrganizations()).andReturn(organizationList).anyTimes();
    EasyMock.expect(organizationDirectoryService.getOrganization((String) EasyMock.anyObject())).andReturn(organization).anyTimes();
    EasyMock.replay(organizationDirectoryService);
    service.setOrganizationDirectoryService(organizationDirectoryService);
    ServiceRegistryInMemoryImpl serviceRegistry = new ServiceRegistryInMemoryImpl(service, securityService, userDirectoryService, organizationDirectoryService, EasyMock.createNiceMock(IncidentService.class));
    dao = new WorkflowServiceSolrIndex();
    dao.solrRoot = sRoot + File.separator + "solr." + System.currentTimeMillis();
    MessageSender messageSender = EasyMock.createNiceMock(MessageSender.class);
    EasyMock.replay(messageSender);
    AuthorizationService authzService = EasyMock.createNiceMock(AuthorizationService.class);
    EasyMock.expect(authzService.getActiveAcl((MediaPackage) EasyMock.anyObject())).andReturn(Tuple.tuple(acl, AclScope.Series)).anyTimes();
    EasyMock.replay(authzService);
    service.setAuthorizationService(authzService);
    dao.setServiceRegistry(serviceRegistry);
    dao.setSecurityService(securityService);
    dao.setAuthorizationService(authzService);
    dao.setOrgDirectory(organizationDirectoryService);
    dao.activate("System Admin");
    service.setDao(dao);
    service.setServiceRegistry(serviceRegistry);
    service.setMessageSender(messageSender);
    service.setUserDirectoryService(userDirectoryService);
    service.activate(null);
    InputStream is = null;
    try {
        is = WorkflowOperationSkippingTest.class.getResourceAsStream("/workflow-definition-skipping.xml");
        workingDefinition = WorkflowParser.parseWorkflowDefinition(is);
        service.registerWorkflowDefinition(workingDefinition);
        IOUtils.closeQuietly(is);
        MediaPackageBuilder mediaPackageBuilder = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder();
        mediaPackageBuilder.setSerializer(new DefaultMediaPackageSerializerImpl(new File("target/test-classes")));
        is = WorkflowOperationSkippingTest.class.getResourceAsStream("/mediapackage-1.xml");
        mediapackage1 = mediaPackageBuilder.loadFromXml(is);
        IOUtils.closeQuietly(is);
        Assert.assertNotNull(mediapackage1.getIdentifier());
    } catch (Exception e) {
        Assert.fail(e.getMessage());
    }
}
Also used : IncidentService(org.opencastproject.serviceregistry.api.IncidentService) Set(java.util.Set) HashSet(java.util.HashSet) Organization(org.opencastproject.security.api.Organization) DefaultOrganization(org.opencastproject.security.api.DefaultOrganization) MessageSender(org.opencastproject.message.broker.api.MessageSender) MediaPackageMetadataService(org.opencastproject.metadata.api.MediaPackageMetadataService) ArrayList(java.util.ArrayList) DefaultMediaPackageSerializerImpl(org.opencastproject.mediapackage.DefaultMediaPackageSerializerImpl) MediaPackageBuilder(org.opencastproject.mediapackage.MediaPackageBuilder) SecurityService(org.opencastproject.security.api.SecurityService) ServiceRegistryInMemoryImpl(org.opencastproject.serviceregistry.api.ServiceRegistryInMemoryImpl) HandlerRegistration(org.opencastproject.workflow.impl.WorkflowServiceImpl.HandlerRegistration) InputStream(java.io.InputStream) IOException(java.io.IOException) WorkflowOperationException(org.opencastproject.workflow.api.WorkflowOperationException) IOException(java.io.IOException) UserDirectoryService(org.opencastproject.security.api.UserDirectoryService) AuthorizationService(org.opencastproject.security.api.AuthorizationService) MediaPackage(org.opencastproject.mediapackage.MediaPackage) File(java.io.File) Workspace(org.opencastproject.workspace.api.Workspace) DefaultOrganization(org.opencastproject.security.api.DefaultOrganization) OrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService) Before(org.junit.Before)

Example 18 with UserDirectoryService

use of org.opencastproject.security.api.UserDirectoryService in project opencast by opencast.

the class AbstractJobProducerTest method setUp.

@Before
public void setUp() throws Exception {
    serviceRegistry = createNiceMock(ServiceRegistry.class);
    expect(serviceRegistry.count(JobProducerTest.JOB_TYPE, Status.DISPATCHING)).andReturn(2L).anyTimes();
    expect(serviceRegistry.count(JobProducerTest.JOB_TYPE, Status.RUNNING)).andReturn(3L).anyTimes();
    final Capture<Job> job = EasyMock.newCapture();
    expect(serviceRegistry.updateJob(EasyMock.capture(job))).andAnswer(new IAnswer<Job>() {

        @Override
        public Job answer() throws Throwable {
            return job.getValue();
        }
    });
    SecurityService securityService = createNiceMock(SecurityService.class);
    UserDirectoryService userDirectoryService = createNiceMock(UserDirectoryService.class);
    OrganizationDirectoryService organizationDirectoryService = createNiceMock(OrganizationDirectoryService.class);
    jobProducer = new JobProducerTest(serviceRegistry, securityService, userDirectoryService, organizationDirectoryService);
}
Also used : SecurityService(org.opencastproject.security.api.SecurityService) ServiceRegistry(org.opencastproject.serviceregistry.api.ServiceRegistry) UserDirectoryService(org.opencastproject.security.api.UserDirectoryService) OrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService) Before(org.junit.Before)

Example 19 with UserDirectoryService

use of org.opencastproject.security.api.UserDirectoryService in project opencast by opencast.

the class RemoteUserAndOrganizationFilterTest method setUp.

/**
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
    defaultUser = new JaxbUser("admin", "test", new DefaultOrganization(), new JaxbRole(SecurityConstants.GLOBAL_ADMIN_ROLE, new DefaultOrganization()));
    switchingUser = new JaxbUser("switch", "test", new DefaultOrganization(), new JaxbRole("ROLE_USER", new DefaultOrganization()));
    userResponder = new Responder<User>(defaultUser);
    chain = EasyMock.createNiceMock(FilterChain.class);
    EasyMock.replay(chain);
    UserDirectoryService userDirectoryService = EasyMock.createNiceMock(UserDirectoryService.class);
    switchingUserResponder = new Responder<User>(switchingUser);
    EasyMock.expect(userDirectoryService.loadUser(EasyMock.anyObject(String.class))).andAnswer(switchingUserResponder).anyTimes();
    EasyMock.replay(userDirectoryService);
    OrganizationDirectoryService organizationDirectoryService = EasyMock.createNiceMock(OrganizationDirectoryService.class);
    EasyMock.expect(organizationDirectoryService.getOrganization(EasyMock.anyObject(String.class))).andReturn(new DefaultOrganization()).anyTimes();
    EasyMock.replay(organizationDirectoryService);
    filter = new RemoteUserAndOrganizationFilter();
    filter.setOrganizationDirectoryService(organizationDirectoryService);
    filter.setUserDirectoryService(userDirectoryService);
}
Also used : JaxbRole(org.opencastproject.security.api.JaxbRole) User(org.opencastproject.security.api.User) JaxbUser(org.opencastproject.security.api.JaxbUser) FilterChain(javax.servlet.FilterChain) JaxbUser(org.opencastproject.security.api.JaxbUser) DefaultOrganization(org.opencastproject.security.api.DefaultOrganization) UserDirectoryService(org.opencastproject.security.api.UserDirectoryService) OrganizationDirectoryService(org.opencastproject.security.api.OrganizationDirectoryService) Before(org.junit.Before)

Example 20 with UserDirectoryService

use of org.opencastproject.security.api.UserDirectoryService in project opencast by opencast.

the class IndexServiceImplTest method updatePresenters.

@Test
public void updatePresenters() throws IOException, org.osgi.service.cm.ConfigurationException {
    String nonUser1 = "Non User 1";
    String nonUser2 = "Non User 2";
    String nonUser3 = "Non User 3";
    Properties eventProperties = new Properties();
    InputStream in = getClass().getResourceAsStream("/episode-catalog.properties");
    eventProperties.load(in);
    in.close();
    Dictionary<String, String> properties = PropertiesUtil.toDictionary(eventProperties);
    SecurityService securityService = EasyMock.createMock(SecurityService.class);
    EasyMock.expect(securityService.getOrganization()).andStubReturn(organization);
    EasyMock.replay(securityService);
    UserDirectoryService userDirectoryService = EasyMock.createMock(UserDirectoryService.class);
    EasyMock.expect(userDirectoryService.loadUser(user1.getUsername())).andStubReturn(user1);
    EasyMock.expect(userDirectoryService.loadUser(user2.getUsername())).andStubReturn(user2);
    EasyMock.expect(userDirectoryService.loadUser(user3.getUsername())).andStubReturn(user3);
    EasyMock.expect(userDirectoryService.loadUser(nonUser1)).andStubReturn(null);
    EasyMock.expect(userDirectoryService.loadUser(nonUser2)).andStubReturn(null);
    EasyMock.expect(userDirectoryService.loadUser(nonUser3)).andStubReturn(null);
    EasyMock.replay(userDirectoryService);
    IndexServiceImpl indexServiceImpl = new IndexServiceImpl();
    CommonEventCatalogUIAdapter commonEventCatalogUIAdapter = new CommonEventCatalogUIAdapter();
    commonEventCatalogUIAdapter.updated(properties);
    indexServiceImpl.setCommonEventCatalogUIAdapter(commonEventCatalogUIAdapter);
    indexServiceImpl.setUserDirectoryService(userDirectoryService);
    indexServiceImpl.setSecurityService(securityService);
    MetadataCollection metadata = commonEventCatalogUIAdapter.getRawFields();
    // Possible presenter combinations
    MetadataField<Iterable<String>> emptyUpdatedPresenter = createCreatorMetadataField(new ArrayList<String>());
    ArrayList<String> oneNonUserList = new ArrayList<>();
    oneNonUserList.add(nonUser1);
    MetadataField<Iterable<String>> nonUserUpdatedPresenter = createCreatorMetadataField(oneNonUserList);
    ArrayList<String> multiNonUserList = new ArrayList<>();
    multiNonUserList.add(nonUser1);
    multiNonUserList.add(nonUser2);
    multiNonUserList.add(nonUser3);
    MetadataField<Iterable<String>> multiNonUserUpdatedPresenter = createCreatorMetadataField(multiNonUserList);
    ArrayList<String> oneUserList = new ArrayList<>();
    oneUserList.add(user1.getUsername());
    MetadataField<Iterable<String>> userUpdatedPresenter = createCreatorMetadataField(oneUserList);
    ArrayList<String> multiUserList = new ArrayList<>();
    multiUserList.add(user1.getUsername());
    multiUserList.add(user2.getUsername());
    multiUserList.add(user3.getUsername());
    MetadataField<Iterable<String>> multiUserUpdatedPresenter = createCreatorMetadataField(multiUserList);
    ArrayList<String> mixedUserList = new ArrayList<>();
    mixedUserList.add(user1.getUsername());
    mixedUserList.add(nonUser1);
    mixedUserList.add(user2.getUsername());
    mixedUserList.add(nonUser2);
    mixedUserList.add(nonUser3);
    mixedUserList.add(user3.getUsername());
    MetadataField<Iterable<String>> mixedPresenters = createCreatorMetadataField(mixedUserList);
    ArrayList<String> userFullNames = new ArrayList<>();
    userFullNames.add(user1.getName());
    userFullNames.add(user2.getName());
    userFullNames.add(user3.getUsername());
    // Empty presenters
    metadata.removeField(metadata.getOutputFields().get(DublinCore.PROPERTY_CREATOR.getLocalName()));
    metadata.addField(emptyUpdatedPresenter);
    Tuple<List<String>, Set<String>> updatedPresenters = indexServiceImpl.getTechnicalPresenters(metadata);
    assertTrue("The presenters dublincore metadata should be empty", updatedPresenters.getA().isEmpty());
    assertTrue("The technical presenters should be empty", updatedPresenters.getB().isEmpty());
    // Non-user presenter
    metadata.removeField(metadata.getOutputFields().get(DublinCore.PROPERTY_CREATOR.getLocalName()));
    metadata.addField(nonUserUpdatedPresenter);
    updatedPresenters = indexServiceImpl.getTechnicalPresenters(metadata);
    assertTrue("There should be one presenter", updatedPresenters.getA().size() == 1);
    assertTrue("There should be no technical presenters", updatedPresenters.getB().isEmpty());
    // Multi non-user presenter
    metadata.removeField(metadata.getOutputFields().get(DublinCore.PROPERTY_CREATOR.getLocalName()));
    metadata.addField(multiNonUserUpdatedPresenter);
    updatedPresenters = indexServiceImpl.getTechnicalPresenters(metadata);
    assertTrue("There should be three presenters", updatedPresenters.getA().size() == 3);
    assertTrue("The value for technical presenters should be empty", updatedPresenters.getB().isEmpty());
    // User presenter
    metadata.removeField(metadata.getOutputFields().get(DublinCore.PROPERTY_CREATOR.getLocalName()));
    metadata.addField(userUpdatedPresenter);
    updatedPresenters = indexServiceImpl.getTechnicalPresenters(metadata);
    assertTrue("There should be one presenter", updatedPresenters.getA().size() == 1);
    assertEquals("The one presenter should have the user's full name", "User 1", updatedPresenters.getA().get(0));
    assertTrue("The one technical presenter", updatedPresenters.getB().size() == 1);
    assertEquals("The one technical presenter has the correct username", "user1", updatedPresenters.getB().iterator().next());
    // Multi user presenter
    metadata.removeField(metadata.getOutputFields().get(DublinCore.PROPERTY_CREATOR.getLocalName()));
    metadata.addField(multiUserUpdatedPresenter);
    updatedPresenters = indexServiceImpl.getTechnicalPresenters(metadata);
    assertTrue("There should be three presenters", updatedPresenters.getA().size() == 3);
    assertTrue("There should be three technical presenters", updatedPresenters.getB().size() == 3);
    assertTrue("The list of technical presenters should contain all of the user names", updatedPresenters.getB().containsAll(multiUserList));
    // Mixed non-user and user presenters
    metadata.removeField(metadata.getOutputFields().get(DublinCore.PROPERTY_CREATOR.getLocalName()));
    metadata.addField(mixedPresenters);
    updatedPresenters = indexServiceImpl.getTechnicalPresenters(metadata);
    assertTrue("There should be six presenters", updatedPresenters.getA().size() == 6);
    assertTrue("There should be three technical presenters", updatedPresenters.getB().size() == 3);
    assertTrue("The list of presenters should contain all of the non-user names", updatedPresenters.getA().containsAll(multiNonUserList));
    assertTrue("The list of presenters should contain all of the user full names", updatedPresenters.getA().containsAll(userFullNames));
    assertTrue("The list of technical presenters should contain all of the usernames", updatedPresenters.getB().containsAll(multiUserList));
}
Also used : Set(java.util.Set) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) Properties(java.util.Properties) UserDirectoryService(org.opencastproject.security.api.UserDirectoryService) SecurityService(org.opencastproject.security.api.SecurityService) CommonEventCatalogUIAdapter(org.opencastproject.index.service.catalog.adapter.events.CommonEventCatalogUIAdapter) DublinCoreMetadataCollection(org.opencastproject.index.service.catalog.adapter.DublinCoreMetadataCollection) MetadataCollection(org.opencastproject.metadata.dublincore.MetadataCollection) List(java.util.List) MetadataList(org.opencastproject.index.service.catalog.adapter.MetadataList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) AccessControlList(org.opencastproject.security.api.AccessControlList) Test(org.junit.Test)

Aggregations

UserDirectoryService (org.opencastproject.security.api.UserDirectoryService)35 Before (org.junit.Before)30 SecurityService (org.opencastproject.security.api.SecurityService)30 DefaultOrganization (org.opencastproject.security.api.DefaultOrganization)27 OrganizationDirectoryService (org.opencastproject.security.api.OrganizationDirectoryService)25 User (org.opencastproject.security.api.User)21 JaxbUser (org.opencastproject.security.api.JaxbUser)19 Organization (org.opencastproject.security.api.Organization)19 ServiceRegistryInMemoryImpl (org.opencastproject.serviceregistry.api.ServiceRegistryInMemoryImpl)18 JaxbRole (org.opencastproject.security.api.JaxbRole)17 Workspace (org.opencastproject.workspace.api.Workspace)17 File (java.io.File)16 ArrayList (java.util.ArrayList)13 InputStream (java.io.InputStream)11 HashSet (java.util.HashSet)11 MessageSender (org.opencastproject.message.broker.api.MessageSender)11 URI (java.net.URI)10 MediaPackageBuilder (org.opencastproject.mediapackage.MediaPackageBuilder)10 AuthorizationService (org.opencastproject.security.api.AuthorizationService)10 IncidentService (org.opencastproject.serviceregistry.api.IncidentService)10