Search in sources :

Example 26 with DataSetMetaData

use of nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData in project timbuctoo by HuygensING.

the class PermissionBasedFieldVisibilityTest method createDataSet.

private DataSet createDataSet(DataSetMetaData dataSetMetaData) {
    DataSet dataSet = mock(DataSet.class);
    given(dataSet.getMetadata()).willReturn(dataSetMetaData);
    return dataSet;
}
Also used : DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet)

Example 27 with DataSetMetaData

use of nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData in project timbuctoo by HuygensING.

the class UserPermissionCheckTest method getPermissionsReturnsNoPermissionsForEmptyUserIfPublicDataSet.

@Test
public void getPermissionsReturnsNoPermissionsForEmptyUserIfPublicDataSet() {
    PermissionFetcher permissionFetcher = mock(PermissionFetcher.class);
    Set<Permission> defaultPermissions = Sets.newHashSet(Permission.READ);
    UserPermissionCheck userPermissionCheck = new UserPermissionCheck(Optional.empty(), permissionFetcher, defaultPermissions);
    DataSetMetaData dataSetMetaData = mock(BasicDataSetMetaData.class);
    given(dataSetMetaData.isPublished()).willReturn(true);
    Set<Permission> permissions = userPermissionCheck.getPermissions(dataSetMetaData);
    assertEquals(Sets.newHashSet(Permission.READ), permissions);
}
Also used : PermissionFetcher(nl.knaw.huygens.timbuctoo.v5.security.PermissionFetcher) Permission(nl.knaw.huygens.timbuctoo.v5.security.dto.Permission) DataSetMetaData(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData) BasicDataSetMetaData(nl.knaw.huygens.timbuctoo.v5.dataset.dto.BasicDataSetMetaData) Test(org.junit.Test)

Example 28 with DataSetMetaData

use of nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData in project timbuctoo by HuygensING.

the class RsDocumentBuilderTest method init.

@Before
public void init() throws Exception {
    dataSetRepository = mock(DataSetRepository.class);
    rsDocumentBuilder = new RsDocumentBuilder(dataSetRepository, new UriHelper(URI.create("http://example.com")));
    dataSet = mock(DataSet.class);
    DataSetMetaData dataSetMetaData1 = mock(DataSetMetaData.class);
    DataSetMetaData dataSetMetaData2 = mock(DataSetMetaData.class);
    when(dataSetMetaData1.getOwnerId()).thenReturn("u1");
    when(dataSetMetaData1.getDataSetId()).thenReturn("ds1");
    when(dataSetMetaData2.getOwnerId()).thenReturn("u2");
    when(dataSetMetaData2.getDataSetId()).thenReturn("ds2");
    when(dataSet.getMetadata()).thenReturn(dataSetMetaData1).thenReturn(dataSetMetaData2);
}
Also used : DataSet(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet) DataSetRepository(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetRepository) UriHelper(nl.knaw.huygens.timbuctoo.util.UriHelper) DataSetMetaData(nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData) Before(org.junit.Before)

Aggregations

DataSetMetaData (nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData)20 BasicDataSetMetaData (nl.knaw.huygens.timbuctoo.v5.dataset.dto.BasicDataSetMetaData)13 DataSet (nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet)12 Test (org.junit.Test)12 Permission (nl.knaw.huygens.timbuctoo.v5.security.dto.Permission)10 User (nl.knaw.huygens.timbuctoo.v5.security.dto.User)10 IOException (java.io.IOException)5 VreAuthorization (nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization)5 Map (java.util.Map)4 Collectors (java.util.stream.Collectors)3 Stream (java.util.stream.Stream)3 RsLn (nl.knaw.huygens.timbuctoo.remote.rs.xml.RsLn)3 RsMd (nl.knaw.huygens.timbuctoo.remote.rs.xml.RsMd)3 UrlItem (nl.knaw.huygens.timbuctoo.remote.rs.xml.UrlItem)3 Urlset (nl.knaw.huygens.timbuctoo.remote.rs.xml.Urlset)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Charsets (com.google.common.base.Charsets)2 Resources (com.google.common.io.Resources)2 Resources.getResource (com.google.common.io.Resources.getResource)2 GraphQLSchema (graphql.schema.GraphQLSchema)2