Search in sources :

Example 6 with ExpirationPolicy

use of org.apereo.cas.ticket.ExpirationPolicy in project cas by apereo.

the class OAuthAccessTokenExpirationPolicyTests method verifySerializeAnOAuthAccessTokenExpirationPolicyToJson.

@Test
public void verifySerializeAnOAuthAccessTokenExpirationPolicyToJson() throws IOException {
    final OAuthAccessTokenExpirationPolicy policyWritten = new OAuthAccessTokenExpirationPolicy(1234L, 5678L);
    MAPPER.writeValue(JSON_FILE, policyWritten);
    final ExpirationPolicy policyRead = MAPPER.readValue(JSON_FILE, OAuthAccessTokenExpirationPolicy.class);
    assertEquals(policyWritten, policyRead);
}
Also used : ExpirationPolicy(org.apereo.cas.ticket.ExpirationPolicy) Test(org.junit.Test)

Example 7 with ExpirationPolicy

use of org.apereo.cas.ticket.ExpirationPolicy in project cas by apereo.

the class OAuthRefreshTokenExpirationPolicyTests method verifySerializeAnOAuthRefreshTokenExpirationPolicyToJson.

@Test
public void verifySerializeAnOAuthRefreshTokenExpirationPolicyToJson() throws IOException {
    final OAuthRefreshTokenExpirationPolicy policyWritten = new OAuthRefreshTokenExpirationPolicy(1234L);
    MAPPER.writeValue(JSON_FILE, policyWritten);
    final ExpirationPolicy policyRead = MAPPER.readValue(JSON_FILE, OAuthRefreshTokenExpirationPolicy.class);
    assertEquals(policyWritten, policyRead);
}
Also used : ExpirationPolicy(org.apereo.cas.ticket.ExpirationPolicy) Test(org.junit.Test)

Example 8 with ExpirationPolicy

use of org.apereo.cas.ticket.ExpirationPolicy in project cas by apereo.

the class RememberMeDelegatingExpirationPolicyTests method verifySerializeATimeoutExpirationPolicyToJson.

@Test
public void verifySerializeATimeoutExpirationPolicyToJson() throws IOException {
    MAPPER.writeValue(JSON_FILE, p);
    final ExpirationPolicy policyRead = MAPPER.readValue(JSON_FILE, RememberMeDelegatingExpirationPolicy.class);
    assertEquals(p, policyRead);
}
Also used : ExpirationPolicy(org.apereo.cas.ticket.ExpirationPolicy) Test(org.junit.Test)

Example 9 with ExpirationPolicy

use of org.apereo.cas.ticket.ExpirationPolicy in project cas by apereo.

the class TicketGrantingTicketExpirationPolicyTests method verifySerializeAnExpirationPolicyToJson.

@Test
public void verifySerializeAnExpirationPolicyToJson() throws IOException {
    MAPPER.writeValue(JSON_FILE, expirationPolicy);
    final ExpirationPolicy policyRead = MAPPER.readValue(JSON_FILE, TicketGrantingTicketExpirationPolicy.class);
    assertEquals(expirationPolicy, policyRead);
}
Also used : ExpirationPolicy(org.apereo.cas.ticket.ExpirationPolicy) Test(org.junit.Test)

Example 10 with ExpirationPolicy

use of org.apereo.cas.ticket.ExpirationPolicy in project cas by apereo.

the class NeverExpiresExpirationPolicyTests method verifySerializeANeverExpiresExpirationPolicyToJson.

@Test
public void verifySerializeANeverExpiresExpirationPolicyToJson() throws IOException {
    final NeverExpiresExpirationPolicy policyWritten = new NeverExpiresExpirationPolicy();
    MAPPER.writeValue(JSON_FILE, policyWritten);
    final ExpirationPolicy policyRead = MAPPER.readValue(JSON_FILE, NeverExpiresExpirationPolicy.class);
    assertEquals(policyWritten, policyRead);
}
Also used : ExpirationPolicy(org.apereo.cas.ticket.ExpirationPolicy) Test(org.junit.Test)

Aggregations

ExpirationPolicy (org.apereo.cas.ticket.ExpirationPolicy)10 Test (org.junit.Test)10