@Before
 public void setUpSession() throws Exception {
   session =
       perun.getPerunSession(
           new PerunPrincipal(
               "perunTests",
               ExtSourcesManager.EXTSOURCE_INTERNAL,
               ExtSourcesManager.EXTSOURCE_INTERNAL));
   user1 = setUpUser1();
   setUpBackground();
   session.getPerunPrincipal().setUser(user1);
 }
Ejemplo n.º 2
0
  protected void initialize() throws PerunException {

    // gets session for a system principal "perunRegistrar"
    final PerunPrincipal pp =
        new PerunPrincipal(
            "perunRegistrar",
            ExtSourcesManager.EXTSOURCE_NAME_INTERNAL,
            ExtSourcesManager.EXTSOURCE_INTERNAL);
    registrarSession = perun.getPerunSession(pp, new PerunClient());

    // cache expires after 5 minutes from creation
    requestCache =
        ExpiringMap.builder()
            .expiration(5, TimeUnit.MINUTES)
            .expirationPolicy(ExpiringMap.ExpirationPolicy.CREATED)
            .build();
  }