Search in sources :

Example 1 with KorAPUser

use of de.ids_mannheim.korap.user.KorAPUser in project Kustvakt by KorAP.

the class FoundryRewriteTest method testFoundryInjectGroupedQueryNoErrors.

@Test
public void testFoundryInjectGroupedQueryNoErrors() throws KustvaktException {
    QuerySerializer s = new QuerySerializer();
    s.setQuery("[(base=laufen | tt/pos=VVFIN)]", "poliqarp");
    String result = handler.processQuery(s.toJSON(), new KorAPUser("test"));
    JsonNode node = JsonUtils.readTree(result);
    assertNotNull(node);
    assertEquals("koral:termGroup", node.at("/query/wrap/@type").asText());
    assertFalse(node.at("/query/wrap/operands/0/foundry").isMissingNode());
    assertFalse(node.at("/query/wrap/operands/0/rewrites").isMissingNode());
    assertFalse(node.at("/query/wrap/operands/1/foundry").isMissingNode());
    assertTrue(node.at("/query/wrap/operands/1/rewrites").isMissingNode());
}
Also used : QuerySerializer(de.ids_mannheim.korap.query.serialize.QuerySerializer) KorAPUser(de.ids_mannheim.korap.user.KorAPUser) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test) SpringJerseyTest(de.ids_mannheim.korap.config.SpringJerseyTest)

Example 2 with KorAPUser

use of de.ids_mannheim.korap.user.KorAPUser in project Kustvakt by KorAP.

the class FoundryRewriteTest method testDefaultFoundryInjectPOSNoErrors.

@Test
public void testDefaultFoundryInjectPOSNoErrors() throws KustvaktException {
    QuerySerializer s = new QuerySerializer();
    s.setQuery("[pos=ADJA]", "poliqarp");
    String result = handler.processQuery(s.toJSON(), new KorAPUser("test"));
    JsonNode node = JsonUtils.readTree(result);
    assertNotNull(node);
    assertFalse(node.at("/query/wrap/foundry").isMissingNode());
    assertEquals(config.getDefault_pos(), node.at("/query/wrap/foundry").asText());
    assertEquals("pos", node.at("/query/wrap/layer").asText());
    assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
    assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type").asText());
}
Also used : QuerySerializer(de.ids_mannheim.korap.query.serialize.QuerySerializer) KorAPUser(de.ids_mannheim.korap.user.KorAPUser) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test) SpringJerseyTest(de.ids_mannheim.korap.config.SpringJerseyTest)

Example 3 with KorAPUser

use of de.ids_mannheim.korap.user.KorAPUser in project Kustvakt by KorAP.

the class FoundryRewriteTest method testFoundryInjectJoinedQueryNoErrors.

@Test
public void testFoundryInjectJoinedQueryNoErrors() throws KustvaktException {
    QuerySerializer s = new QuerySerializer();
    s.setQuery("[orth=laufe/i & base!=Lauf]", "poliqarp");
    String result = handler.processQuery(s.toJSON(), new KorAPUser("test"));
    JsonNode node = JsonUtils.readTree(result);
    assertNotNull(node);
    assertEquals("koral:termGroup", node.at("/query/wrap/@type").asText());
    assertFalse(node.at("/query/wrap/operands/0/foundry").isMissingNode());
    assertFalse(node.at("/query/wrap/operands/0/rewrites").isMissingNode());
    assertFalse(node.at("/query/wrap/operands/1/foundry").isMissingNode());
    assertFalse(node.at("/query/wrap/operands/1/rewrites").isMissingNode());
}
Also used : QuerySerializer(de.ids_mannheim.korap.query.serialize.QuerySerializer) KorAPUser(de.ids_mannheim.korap.user.KorAPUser) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test) SpringJerseyTest(de.ids_mannheim.korap.config.SpringJerseyTest)

Example 4 with KorAPUser

use of de.ids_mannheim.korap.user.KorAPUser in project Kustvakt by KorAP.

the class KustvaktAuthenticationManagerTest method testUserSettingsGetNonExistent.

@Test(expected = KustvaktException.class)
public void testUserSettingsGetNonExistent() throws KustvaktException {
    User user = new KorAPUser(10, "random");
    authenticationManager.getUserData(user, UserSettingProcessor.class);
}
Also used : User(de.ids_mannheim.korap.user.User) KorAPUser(de.ids_mannheim.korap.user.KorAPUser) KorAPUser(de.ids_mannheim.korap.user.KorAPUser) Test(org.junit.Test) BeanConfigTest(de.ids_mannheim.korap.config.BeanConfigTest)

Example 5 with KorAPUser

use of de.ids_mannheim.korap.user.KorAPUser in project Kustvakt by KorAP.

the class DummyAuthenticationManager method getUser.

@Override
public User getUser(String username) throws KustvaktException {
    KorAPUser user = new KorAPUser();
    user.setUsername(username);
    return user;
}
Also used : KorAPUser(de.ids_mannheim.korap.user.KorAPUser)

Aggregations

KorAPUser (de.ids_mannheim.korap.user.KorAPUser)22 Test (org.junit.Test)12 JsonNode (com.fasterxml.jackson.databind.JsonNode)10 SpringJerseyTest (de.ids_mannheim.korap.config.SpringJerseyTest)10 QuerySerializer (de.ids_mannheim.korap.query.serialize.QuerySerializer)9 User (de.ids_mannheim.korap.user.User)8 ShibbolethUser (de.ids_mannheim.korap.user.ShibbolethUser)5 KustvaktException (de.ids_mannheim.korap.exceptions.KustvaktException)4 DataAccessException (org.springframework.dao.DataAccessException)3 EmptyResultDataAccessException (org.springframework.dao.EmptyResultDataAccessException)3 BeanConfigTest (de.ids_mannheim.korap.config.BeanConfigTest)2 URIParam (de.ids_mannheim.korap.config.URIParam)2 DatabaseException (de.ids_mannheim.korap.exceptions.DatabaseException)2 WrappedException (de.ids_mannheim.korap.exceptions.WrappedException)2 IdWriter (de.ids_mannheim.korap.rewrite.IdWriter)2 RewriteHandler (de.ids_mannheim.korap.rewrite.RewriteHandler)2 TokenContext (de.ids_mannheim.korap.security.context.TokenContext)2 DemoUser (de.ids_mannheim.korap.user.DemoUser)2 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)2 ResourceFilters (com.sun.jersey.spi.container.ResourceFilters)1