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;
}
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);
}
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);
}
Aggregations