Package com.asakusafw.windgate.core.session

Examples of com.asakusafw.windgate.core.session.SessionMirror


     * Creates a new session.
     * @throws Exception if failed
     */
    @Test
    public void create() throws Exception {
        SessionMirror session = provider.create("testing");
        session.close();
    }
View Full Code Here


     * Creates multiple sessions.
     * @throws Exception if failed
     */
    @Test
    public void create_multiple() throws Exception {
        SessionMirror session1 = provider.create("testing1");
        try {
            SessionMirror session2 = provider.create("testing2");
            session2.close();
        } finally {
            session1.close();
        }
    }
View Full Code Here

     * Creates a new session but the specified session already exists.
     * @throws Exception if failed
     */
    @Test
    public void create_exists() throws Exception {
        SessionMirror session = provider.create("testing");
        session.close();
        try {
            SessionMirror reopen = provider.create("testing");
            reopen.close();
            fail();
        } catch (SessionException e) {
            assertThat(e.getSessionId(), is("testing"));
            assertThat(e.getReason(), is(Reason.ALREADY_EXIST));
        }
View Full Code Here

     * Creates a new session but is acquired.
     * @throws Exception if failed
     */
    @Test
    public void create_acquired() throws Exception {
        SessionMirror session = provider.create("testing");
        try {
            try {
                SessionMirror reopen = provider.create("testing");
                reopen.close();
                fail();
            } catch (SessionException e) {
                assertThat(e.getSessionId(), is("testing"));
                assertThat(e.getReason(), is(Reason.ACQUIRED));
            }
View Full Code Here

     * Opens a created session.
     * @throws Exception if failed
     */
    @Test
    public void open() throws Exception {
        SessionMirror session = provider.create("testing");
        session.close();
        SessionMirror reopen = provider.open("testing");
        reopen.close();
    }
View Full Code Here

     * @throws Exception if failed
     */
    @Test
    public void open_missing() throws Exception {
        try {
            SessionMirror session = provider.open("testing");
            session.close();
            fail();
        } catch (SessionException e) {
            assertThat(e.getSessionId(), is("testing"));
            assertThat(e.getReason(), is(Reason.NOT_EXIST));
            List<String> all = new ArrayList<String>(provider.getCreatedIds());
View Full Code Here

     * Opens a session but is acquired by the creater.
     * @throws Exception if failed
     */
    @Test
    public void open_acquired() throws Exception {
        SessionMirror session = provider.create("testing");
        try {
            try {
                SessionMirror reopen = provider.open("testing");
                reopen.close();
                fail();
            } catch (SessionException e) {
                assertThat(e.getSessionId(), is("testing"));
                assertThat(e.getReason(), is(Reason.ACQUIRED));
            }
View Full Code Here

     * Opens a session but is acquired by the other.
     * @throws Exception if failed
     */
    @Test
    public void open_conflict() throws Exception {
        SessionMirror session = provider.create("testing");
        session.close();

        SessionMirror other = provider.open("testing");
        try {
            try {
                SessionMirror reopen = provider.open("testing");
                reopen.close();
            } catch (SessionException e) {
                assertThat(e.getSessionId(), is("testing"));
                assertThat(e.getReason(), is(Reason.ACQUIRED));
            }
        } finally {
View Full Code Here

     * Enumerates IDs.
     * @throws Exception if failed
     */
    @Test
    public void getIds() throws Exception {
        SessionMirror session1 = provider.create("testing1");
        session1.close();
        SessionMirror session2 = provider.create("testing2");
        session2.complete();
        SessionMirror session3 = provider.create("testing3");
        session3.close();

        List<String> all = new ArrayList<String>(provider.getCreatedIds());
        assertThat(all, hasItems("testing1", "testing3"));
        assertThat(all.size(), is(2));
    }
View Full Code Here

     * Deletes a created session.
     * @throws Exception if failed
     */
    @Test
    public void delete() throws Exception {
        SessionMirror session = provider.create("testing");
        session.close();
        provider.delete("testing");

        List<String> all = new ArrayList<String>(provider.getCreatedIds());
        assertThat(all.isEmpty(), is(true));
    }
View Full Code Here

TOP

Related Classes of com.asakusafw.windgate.core.session.SessionMirror

Copyright © 2018 www.massapicom. 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.