Examples of SessionMetaData


Examples of org.teiid.adminapi.impl.SessionMetadata

      fail("exception expected"); //$NON-NLS-1$
    } catch (InvalidSessionException e) {
     
    }
   
    SessionMetadata info = ssi.createSession("steve", null, "foo", new Properties(), false, true); //$NON-NLS-1$ //$NON-NLS-2$
    if (securityEnabled) {
      Mockito.verify(impl).authenticateUser("steve", null, "foo", domains, false);
    }
   
    String id1 = info.getSessionId();
    ssi.validateSession(id1);
   
    assertEquals(1, ssi.getActiveSessionsCount());
    assertEquals(0, ssi.getSessionsLoggedInToVDB("a", 1).size()); //$NON-NLS-1$
   
View Full Code Here

Examples of org.teiid.adminapi.impl.SessionMetadata

      return buildWorkContext(metadata, metadata.getVdbMetaData());
    }
   
  public static DQPWorkContext buildWorkContext(QueryMetadataInterface metadata, VDBMetaData vdb) {
    DQPWorkContext workContext = new DQPWorkContext();
    SessionMetadata session = new SessionMetadata();
    workContext.setSession(session);
    session.setVDBName(vdb.getName());
    session.setVDBVersion(vdb.getVersion());
    session.setSessionId(String.valueOf(1));
    session.setUserName("foo"); //$NON-NLS-1$
    session.setVdb(vdb);
        workContext.getVDB().addAttchment(QueryMetadataInterface.class, metadata);
        if (metadata instanceof TransformationMetadata) {
          workContext.getVDB().addAttchment(TransformationMetadata.class, (TransformationMetadata)metadata);
        }
        DQPWorkContext.setWorkContext(workContext);
View Full Code Here

Examples of org.teiid.rhq.plugin.objects.SessionMetadata

  public <T> void getSessionCollectionValue(MetaValue pValue,Collection<SessionMetadata> list) throws Exception {
    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
        if (value.getMetaType().isComposite()) {
          SessionMetadata session = unwrapSessionMetaValue(value);
          list.add(session);
        } else {
          throw new IllegalStateException(pValue
              + " is not a Composite type"); //$NON-NLS-1$
        }
View Full Code Here

Examples of org.teiid.rhq.plugin.objects.SessionMetadata

    MetaType metaType = pValue.getMetaType();
    if (metaType.isCollection()) {
      for (MetaValue value : ((CollectionValueSupport) pValue).getElements()) {
        if (value.getMetaType().isComposite()) {
          if (ProfileServiceUtil.stringValue(((CompositeValueSupport)value).get("VDBName")).equals(vdbName)) { //$NON-NLS-1$
            SessionMetadata session = unwrapSessionMetaValue(value);
            list.add(session);
          }
        } else {
          throw new IllegalStateException(pValue+ " is not a Composite type"); //$NON-NLS-1$
        }
View Full Code Here

Examples of org.teiid.rhq.plugin.objects.SessionMetadata

      return null;

    if (metaValue instanceof CompositeValue) {
      CompositeValueSupport compositeValue = (CompositeValueSupport) metaValue;
     
      SessionMetadata session = new SessionMetadata();
      session.setApplicationName((String) ProfileServiceUtil.stringValue(compositeValue.get(APPLICATION_NAME)));
      session.setCreatedTime((Long) ProfileServiceUtil.longValue(compositeValue.get(CREATED_TIME)));
      session.setClientHostName((String) ProfileServiceUtil.stringValue(compositeValue.get(CLIENT_HOST_NAME)));
      session.setIPAddress((String) ProfileServiceUtil.stringValue(compositeValue.get(IP_ADDRESS)));
      session.setLastPingTime((Long) ProfileServiceUtil.longValue(compositeValue.get(LAST_PING_TIME)));
      session.setSessionId((String) ProfileServiceUtil.stringValue(compositeValue.get(SESSION_ID)));
      session.setUserName((String) ProfileServiceUtil.stringValue(compositeValue.get(USER_NAME)));
      session.setVDBName((String) ProfileServiceUtil.stringValue(compositeValue.get(VDB_NAME)));
      session.setVDBVersion((Integer) ProfileServiceUtil.integerValue(compositeValue.get(VDB_VERSION)));
      session.setSecurityDomain((String) ProfileServiceUtil.stringValue(compositeValue.get(SECURITY_DOMAIN)));
      return session;
    }
    throw new IllegalStateException("Unable to unwrap session " + metaValue); //$NON-NLS-1$
  }
View Full Code Here

Examples of org.wildfly.clustering.web.session.SessionMetaData

        SessionFactory<Object, Object> factory = mock(SessionFactory.class);
        Remover<String> remover = new ExpiredSessionRemover<>(factory);
        Session<Object> validSession = mock(Session.class);
        Session<Object> expiredSession = mock(Session.class);
        Session<Object> invalidSession = mock(Session.class);
        SessionMetaData validMetaData = mock(SessionMetaData.class);
        SessionMetaData expiredMetaData = mock(SessionMetaData.class);
        String missingSessionId = "missing";
        String expiredSessionId = "expired";
        String validSessionId = "valid";
        String invalidSessionId = "invalid";
        Object expiredValue = new Object();
        Object validValue = new Object();
        Object invalidValue = new Object();
       
        when(factory.findValue(missingSessionId)).thenReturn(null);
        when(factory.findValue(expiredSessionId)).thenReturn(expiredValue);
        when(factory.findValue(validSessionId)).thenReturn(validValue);
        when(factory.findValue(invalidSessionId)).thenReturn(invalidValue);
       
        when(factory.createSession(expiredSessionId, expiredValue)).thenReturn(expiredSession);
        when(factory.createSession(validSessionId, validValue)).thenReturn(validSession);
        when(factory.createSession(invalidSessionId, invalidValue)).thenReturn(invalidSession);
       
        when(expiredSession.isValid()).thenReturn(true);
        when(validSession.isValid()).thenReturn(true);
        when(invalidSession.isValid()).thenReturn(false);
       
        when(expiredSession.getMetaData()).thenReturn(expiredMetaData);
        when(validSession.getMetaData()).thenReturn(validMetaData);
        when(invalidSession.getMetaData()).thenReturn(validMetaData);
       
        when(expiredMetaData.isExpired()).thenReturn(true);
        when(validMetaData.isExpired()).thenReturn(false);
       
        remover.remove(missingSessionId);
        remover.remove(expiredSessionId);
        remover.remove(validSessionId);
View Full Code Here

Examples of org.wildfly.clustering.web.session.SessionMetaData

import static org.junit.Assert.*;

public class SimpleSessionMetaDataTestCase {
    @Test
    public void isNew() {
        SessionMetaData metaData = new SimpleSessionMetaData();
        assertTrue(metaData.isNew());

        metaData.setLastAccessedTime(new Date());
        assertFalse(metaData.isNew());

        metaData = new SimpleSessionMetaData(new Date(), new Date(), new Time(0, TimeUnit.SECONDS));
        assertFalse(metaData.isNew());
    }
View Full Code Here

Examples of org.wildfly.clustering.web.session.SessionMetaData

        assertFalse(metaData.isNew());
    }

    @Test
    public void isExpired() {
        SessionMetaData metaData = new SimpleSessionMetaData();
        assertFalse(metaData.isExpired());

        Date now = new Date();

        metaData.setMaxInactiveInterval(1, TimeUnit.MINUTES);
        assertFalse(metaData.isExpired());

        metaData.setLastAccessedTime(new Date(now.getTime() - metaData.getMaxInactiveInterval(TimeUnit.MILLISECONDS) - 1));
        assertTrue(metaData.isExpired());
    }
View Full Code Here

Examples of org.wildfly.clustering.web.session.SessionMetaData

        TransactionBatch batch = mock(TransactionBatch.class);
        Remover<String> remover = mock(Remover.class);
        ImmutableSession immortalSession = mock(ImmutableSession.class);
        ImmutableSession expiringSession = mock(ImmutableSession.class);
        ImmutableSession canceledSession = mock(ImmutableSession.class);
        SessionMetaData immortalMetaData = mock(SessionMetaData.class);
        SessionMetaData shortTimeoutMetaData = mock(SessionMetaData.class);
        SessionMetaData longTimeoutMetaData = mock(SessionMetaData.class);
        String immortalSessionId = "immortal";
        String expiringSessionId = "expiring";
        String canceledSessionId = "canceled";

        when(batcher.createBatch()).thenReturn(batch);

        when(immortalSession.isValid()).thenReturn(true);
        when(expiringSession.isValid()).thenReturn(true);
        when(canceledSession.isValid()).thenReturn(true);

        when(immortalSession.getMetaData()).thenReturn(immortalMetaData);
        when(expiringSession.getMetaData()).thenReturn(shortTimeoutMetaData);
        when(canceledSession.getMetaData()).thenReturn(longTimeoutMetaData);
       
        when(immortalMetaData.getMaxInactiveInterval(TimeUnit.MILLISECONDS)).thenReturn(0L);
        when(shortTimeoutMetaData.getMaxInactiveInterval(TimeUnit.MILLISECONDS)).thenReturn(1L);
        when(longTimeoutMetaData.getMaxInactiveInterval(TimeUnit.MILLISECONDS)).thenReturn(10000L);

        Date now = new Date();
        when(shortTimeoutMetaData.getLastAccessedTime()).thenReturn(now);
        when(longTimeoutMetaData.getLastAccessedTime()).thenReturn(now);
       
        when(immortalSession.getId()).thenReturn(immortalSessionId);
        when(expiringSession.getId()).thenReturn(expiringSessionId);
        when(canceledSession.getId()).thenReturn(canceledSessionId);
       
View Full Code Here

Examples of org.wildfly.clustering.web.session.SessionMetaData

        this.localContextFactory = localContextFactory;
    }

    @Override
    public Session<L> createSession(String id, FineSessionCacheEntry<L> entry) {
        SessionMetaData metaData = entry.getMetaData();
        Mutator mutator = metaData.isNew() ? Mutator.PASSIVE : new CacheEntryMutator<>(this.sessionCache, id, entry);
        SessionAttributes attributes = new FineSessionAttributes<>(id, this.attributeCache, this.marshaller);
        return new InfinispanSession<>(id, entry.getMetaData(), attributes, entry.getLocalContext(), this.localContextFactory, this.context, mutator, this);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.