Package info.archinnov.achilles.listener.CASResultListener

Examples of info.archinnov.achilles.listener.CASResultListener.CASResult


                Operation operation = UPDATE;
                if (isCASInsert(queryString)) {
                    operation = INSERT;
                }
                notifyCASError(new CASResult(operation, TypedMap.fromMap(currentValues)));
            } else {
                notifyCASSuccess();
            }

        }
View Full Code Here


        //When
        wrapper.checkForCASSuccess(resultSet);

        //Then
        final CASResult actual = atomicCASResult.get();
        assertThat(actual).isNotNull();
        assertThat(actual.operation()).isEqualTo(UPDATE);
        assertThat(actual.currentValues()).contains(MapEntry.entry("[applied]", false), MapEntry.entry("name", "Helen"));
    }
View Full Code Here

        Map<String, Object> expectedCurrentValues = ImmutableMap.<String, Object>of("id", 10L, "[applied]", false, "consistency_level", EACH_QUORUM.name(), "name", "name");
        manager.insert(entityWithEnum);

        manager.insert(entityWithEnum, OptionsBuilder.ifNotExists().casResultListener(listener));

        final CASResult casResult = atomicCASResult.get();
        assertThat(casResult.operation()).isEqualTo(INSERT);
        assertThat(casResult.currentValues()).isEqualTo(expectedCurrentValues);
        assertThat(casResult.toString()).isEqualTo("CAS operation INSERT cannot be applied. Current values are: {[applied]=false, consistency_level=EACH_QUORUM, id=10, name=name}");
    }
View Full Code Here

        manager.insert(entityWithEnum);

        manager.insert(entityWithEnum, OptionsBuilder.ifNotExists()
                .withTtl(100).casResultListener(listener));

        final CASResult casResult = atomicCASResult.get();
        assertThat(casResult.operation()).isEqualTo(INSERT);
        assertThat(casResult.currentValues()).isEqualTo(expectedCurrentValues);
        assertThat(casResult.toString()).isEqualTo("CAS operation INSERT cannot be applied. Current values are: {[applied]=false, consistency_level=EACH_QUORUM, id=10, name=name}");
    }
View Full Code Here

        //When
        manager.update(managed,
                ifConditions(new CASCondition("name", "name"), new CASCondition("consistency_level", EACH_QUORUM))
                        .casResultListener(listener));

        final CASResult casResult = atomicCASResult.get();
        assertThat(casResult).isNotNull();
        assertThat(casResult.operation()).isEqualTo(UPDATE);
        assertThat(casResult.currentValues()).isEqualTo(expectedCurrentValues);
        assertThat(casResult.toString()).isEqualTo("CAS operation UPDATE cannot be applied. Current values are: {[applied]=false, consistency_level=EACH_QUORUM, name=John}");
    }
View Full Code Here

        manager.update(managed,
                ifConditions(new CASCondition("name", "name"), new CASCondition("consistency_level", EACH_QUORUM))
                        .casResultListener(listener)
                        .withTtl(100));

        final CASResult casResult = atomicCASResult.get();
        assertThat(casResult).isNotNull();
        assertThat(casResult.operation()).isEqualTo(UPDATE);
        assertThat(casResult.currentValues()).isEqualTo(expectedCurrentValues);
        assertThat(casResult.toString()).isEqualTo("CAS operation UPDATE cannot be applied. Current values are: {[applied]=false, consistency_level=EACH_QUORUM, name=John}");
    }
View Full Code Here

        //When
        manager.update(managed, ifConditions(new CASCondition("name", "Helen")).casResultListener(listener));

        //Then
        final CASResult casResult = atomicCASResult.get();
        assertThat(casResult).isNotNull();
        assertThat(casResult.operation()).isEqualTo(UPDATE);
        assertThat(casResult.currentValues()).isEqualTo(expectedCurrentValues);

    }
View Full Code Here

        //When
        final NativeQuery nativeQuery = manager.nativeQuery(statement,casResultListener(listener));
        nativeQuery.execute();

        //Then
        final CASResult casResult = atomicCASResult.get();

        assertThat(casResult).isNotNull();
        assertThat(casResult.operation()).isEqualTo(UPDATE);
        assertThat(casResult.currentValues()).isEqualTo(expectedCurrentValues);
    }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.listener.CASResultListener.CASResult

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.