All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.shapestone.session.adapters.MockSessionRepository Maven / Gradle / Ivy

The newest version!
package com.shapestone.session.adapters;

import com.shapestone.session.Session;
import com.shapestone.session.SessionRepository;
import rx.Observable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static rx.Observable.just;

/**
 * Name: Michael Williams
 * Date: 9/14/16.
 */
public class MockSessionRepository implements SessionRepository {

  private Map sessionDataMap = new HashMap<>();

  public Observable> store(Session session) {
    sessionDataMap.put(session.getSessionId(), session);
    ArrayList sessions = new ArrayList<>();
    sessions.add(session);
    return just(sessions);
  }

  @Override
  public Observable addSession(Session session) {
    return null;
  }

  @Override
  public Observable updateSession(Session session) {
    return null;
  }

  @Override
  public Observable> readSessionById(String sessionId) {
    final Session session = sessionDataMap.get(sessionId);
    final ArrayList arrayList = new ArrayList<>();
    arrayList.add(session);
    return just(arrayList);
  }

  @Override
  public Observable> readPartyActiveSessions(String partyId, long startTime) {
    return null;
  }

  @Override
  public Observable> readActiveSessions(String sessionId, long startTime) {
    return null;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy