Search in sources :

Example 16 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class InstancePermissionImplificationTest method testMultipleAccessesPermit.

@Test
public void testMultipleAccessesPermit() {
    // Test different Instances
    Permission pStored = DatasetPermission.onInstance(EnumSet.of(Ability.READ, Ability.DOWNLOAD), new DatasetId(DATASET1));
    Permission pRequested = DatasetPermission.onInstance(Ability.READ.asSet(), new DatasetId(DATASET1));
    assert pStored.implies(pRequested);
}
Also used : SuperPermission(com.bakdata.conquery.models.auth.permissions.SuperPermission) DatasetPermission(com.bakdata.conquery.models.auth.permissions.DatasetPermission) ExecutionPermission(com.bakdata.conquery.models.auth.permissions.ExecutionPermission) Permission(org.apache.shiro.authz.Permission) AdminPermission(com.bakdata.conquery.models.auth.permissions.AdminPermission) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test)

Example 17 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class IdTests method testEquals.

@Test
public void testEquals() {
    ConceptTreeChildId idA = new ConceptTreeChildId(new ConceptTreeChildId(new ConceptId(new DatasetId("1"), "2"), "3"), "4");
    ConceptTreeChildId idB = new ConceptTreeChildId(new ConceptTreeChildId(new ConceptId(new DatasetId("1"), "2"), "3"), "4");
    assertThat(idA).isEqualTo(idB);
    assertThat(idA).hasSameHashCodeAs(idB);
    assertThat(idA.toString()).isEqualTo(idB.toString());
}
Also used : ConceptTreeChildId(com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId) ConceptId(com.bakdata.conquery.models.identifiable.ids.specific.ConceptId) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 18 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class IdTests method testJacksonBinarySerialization.

@Test
public void testJacksonBinarySerialization() throws JsonParseException, JsonMappingException, JsonProcessingException, IOException {
    ConceptTreeChildId id = new ConceptTreeChildId(new ConceptTreeChildId(new ConceptId(new DatasetId("1"), "2"), "3"), "4");
    ObjectMapper mapper = Jackson.BINARY_MAPPER;
    ConceptTreeChildId copy = mapper.readValue(mapper.writeValueAsBytes(id), ConceptTreeChildId.class);
    assertThat(copy).isEqualTo(id);
    assertThat(copy).hasSameHashCodeAs(id);
    assertThat(copy.toString()).isEqualTo(id.toString());
}
Also used : ConceptTreeChildId(com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ConceptId(com.bakdata.conquery.models.identifiable.ids.specific.ConceptId) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 19 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class SerializationTests method group.

@Test
public void group() throws IOException, JSONException {
    Group group = new Group("group", "group", STORAGE);
    group.addPermission(DatasetPermission.onInstance(Ability.READ, new DatasetId("test")));
    group.addPermission(ExecutionPermission.onInstance(Ability.READ, new ManagedExecutionId(new DatasetId("dataset"), UUID.randomUUID())));
    group.addRole(new Role("company", "company", STORAGE));
    Role role = new Role("company", "company", STORAGE);
    group.addRole(role);
    User user = new User("userName", "userLabel", STORAGE);
    group.addMember(user);
    CentralRegistry registry = new CentralRegistry();
    registry.register(role);
    registry.register(user);
    SerializationTestUtil.forType(Group.class).injectables(STORAGE).registry(registry).test(group);
}
Also used : Role(com.bakdata.conquery.models.auth.entities.Role) Group(com.bakdata.conquery.models.auth.entities.Group) User(com.bakdata.conquery.models.auth.entities.User) ManagedExecutionId(com.bakdata.conquery.models.identifiable.ids.specific.ManagedExecutionId) CentralRegistry(com.bakdata.conquery.models.identifiable.CentralRegistry) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test) IdMapSerialisationTest(com.bakdata.conquery.models.identifiable.IdMapSerialisationTest)

Example 20 with DatasetId

use of com.bakdata.conquery.models.identifiable.ids.specific.DatasetId in project conquery by bakdata.

the class SerializationTests method executionCreationResolveError.

@Test
public void executionCreationResolveError() throws JSONException, IOException {
    ConqueryError error = new ConqueryError.ExecutionCreationResolveError(new DatasetId("test"));
    SerializationTestUtil.forType(ConqueryError.class).test(error);
}
Also used : ConqueryError(com.bakdata.conquery.models.error.ConqueryError) DatasetId(com.bakdata.conquery.models.identifiable.ids.specific.DatasetId) Test(org.junit.jupiter.api.Test) IdMapSerialisationTest(com.bakdata.conquery.models.identifiable.IdMapSerialisationTest)

Aggregations

DatasetId (com.bakdata.conquery.models.identifiable.ids.specific.DatasetId)31 Test (org.junit.jupiter.api.Test)18 DatasetPermission (com.bakdata.conquery.models.auth.permissions.DatasetPermission)9 Permission (org.apache.shiro.authz.Permission)8 User (com.bakdata.conquery.models.auth.entities.User)7 AdminPermission (com.bakdata.conquery.models.auth.permissions.AdminPermission)7 ExecutionPermission (com.bakdata.conquery.models.auth.permissions.ExecutionPermission)7 SuperPermission (com.bakdata.conquery.models.auth.permissions.SuperPermission)7 ConqueryTestSpec (com.bakdata.conquery.integration.json.ConqueryTestSpec)6 Role (com.bakdata.conquery.models.auth.entities.Role)6 MetaStorage (com.bakdata.conquery.io.storage.MetaStorage)5 Dataset (com.bakdata.conquery.models.datasets.Dataset)5 Group (com.bakdata.conquery.models.auth.entities.Group)4 ConceptId (com.bakdata.conquery.models.identifiable.ids.specific.ConceptId)4 ConceptTreeChildId (com.bakdata.conquery.models.identifiable.ids.specific.ConceptTreeChildId)4 DatasetRegistry (com.bakdata.conquery.models.worker.DatasetRegistry)4 ConceptsProcessor (com.bakdata.conquery.resources.api.ConceptsProcessor)4 ResolvedConceptsResult (com.bakdata.conquery.resources.api.ConceptsProcessor.ResolvedConceptsResult)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 FilterTemplate (com.bakdata.conquery.apiv1.FilterTemplate)3