Package org.axonframework.commandhandling

Examples of org.axonframework.commandhandling.VersionedAggregateIdentifier


                    format("Invalid command. It does not identify the target aggregate. "
                                   + "Make sure at least one of the fields or methods in the [%s] class contains the "
                                   + "@TargetAggregateIdentifier annotation and that it returns a non-null value.",
                           command.getPayloadType().getSimpleName()));
        }
        return new VersionedAggregateIdentifier(aggregateIdentifier, aggregateVersion);
    }
View Full Code Here


        unitOfWork.attachResource(ParameterResolverFactory.class.getName(), parameterResolverFactory);
        return handlers.get(commandMessage.getCommandName()).handle(commandMessage, unitOfWork);
    }

    private T loadAggregate(CommandMessage<?> command) {
        VersionedAggregateIdentifier iv = commandTargetResolver.resolveTarget(command);
        return repository.load(iv.getIdentifier(), iv.getVersion());
    }
View Full Code Here

    }

    @Test
    public void testResolveTarget_WithAnnotatedMethod() {
        final UUID aggregateIdentifier = UUID.randomUUID();
        VersionedAggregateIdentifier actual = testSubject.resolveTarget(asCommandMessage(new Object() {
            @TargetAggregateIdentifier
            private UUID getIdentifier() {
                return aggregateIdentifier;
            }
        }));

        assertSame(aggregateIdentifier, actual.getIdentifier());
        assertNull(actual.getVersion());
    }
View Full Code Here

    }

    @Test
    public void testResolveTarget_WithAnnotatedMethodAndVersion() {
        final UUID aggregateIdentifier = UUID.randomUUID();
        VersionedAggregateIdentifier actual = testSubject.resolveTarget(asCommandMessage(new Object() {
            @TargetAggregateIdentifier
            private UUID getIdentifier() {
                return aggregateIdentifier;
            }

            @TargetAggregateVersion
            private Long version() {
                return 1L;
            }
        }));

        assertSame(aggregateIdentifier, actual.getIdentifier());
        assertEquals((Long) 1L, actual.getVersion());
    }
View Full Code Here

    }

    @Test
    public void testResolveTarget_WithAnnotatedMethodAndStringVersion() {
        final UUID aggregateIdentifier = UUID.randomUUID();
        VersionedAggregateIdentifier actual = testSubject.resolveTarget(asCommandMessage(new Object() {
            @TargetAggregateIdentifier
            private UUID getIdentifier() {
                return aggregateIdentifier;
            }

            @TargetAggregateVersion
            private String version() {
                return "1000230";
            }
        }));

        assertEquals(aggregateIdentifier, actual.getIdentifier());
        assertEquals((Long) 1000230L, actual.getVersion());
    }
View Full Code Here

    @Test
    public void testResolveTarget_WithAnnotatedFields() {
        final UUID aggregateIdentifier = UUID.randomUUID();
        final Object version = 1L;
        VersionedAggregateIdentifier actual = testSubject.resolveTarget(
                asCommandMessage(new FieldAnnotatedCommand(aggregateIdentifier, version)));
        assertEquals(aggregateIdentifier, actual.getIdentifier());
        assertEquals(version, actual.getVersion());
    }
View Full Code Here

    @Test
    public void testResolveTarget_WithAnnotatedFields_StringIdentifier() {
        final UUID aggregateIdentifier = UUID.randomUUID();
        final Object version = 1L;
        VersionedAggregateIdentifier actual = testSubject.resolveTarget(
                asCommandMessage(new FieldAnnotatedCommand(aggregateIdentifier, version)));
        assertEquals(aggregateIdentifier, actual.getIdentifier());
        assertEquals(version, actual.getVersion());
    }
View Full Code Here

    @Test
    public void testResolveTarget_WithAnnotatedFields_ObjectIdentifier() {
        final Object aggregateIdentifier = new Object();
        final Object version = 1L;
        VersionedAggregateIdentifier actual = testSubject.resolveTarget(
                asCommandMessage(new FieldAnnotatedCommand(aggregateIdentifier, version)));
        assertEquals(aggregateIdentifier, actual.getIdentifier());
        assertEquals(version, actual.getVersion());
    }
View Full Code Here

    @Test
    public void testResolveTarget_WithAnnotatedFields_ParsableVersion() {
        final UUID aggregateIdentifier = UUID.randomUUID();
        final Object version = "1";
        VersionedAggregateIdentifier actual = testSubject.resolveTarget(
                asCommandMessage(new FieldAnnotatedCommand(aggregateIdentifier, version)));
        assertEquals(aggregateIdentifier, actual.getIdentifier());
        assertEquals((Long) 1L, actual.getVersion());
    }
View Full Code Here

TOP

Related Classes of org.axonframework.commandhandling.VersionedAggregateIdentifier

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.