Package org.springframework.data.neo4j.aspects.support.domain

Examples of org.springframework.data.neo4j.aspects.support.domain.Account1


    @Transactional
    @Test
    public void testFindAccountByEmailLikeNumber() throws Exception {
        String accountNumber = "test@t-online.de";
        Account1 acc1 = new Account1(accountNumber, "T-Online Test-Account");
        Account1 savedAcc1 = account1Repository.save(acc1);
        Account1 found = account1Repository.findByAccountNumber(accountNumber);
        assertEquals(acc1.getName(), found.getName());
    }
View Full Code Here


    }

    @Test @Transactional
    public void testDefaultFailOnDuplicateSetToFalseCausesMergeWhenAnotherDuplicateEntityCreated() {
        final String UPDATED_NAME = "Mr George - Current Account 2";
        Account1 acc1 = new Account1("111-222-333", "Mr George - Current Account 1");
        Account1 acc2 = new Account1("111-222-333", UPDATED_NAME);

        acc1.persist();
        Long acc1NodeId = acc1.getNodeId();
        acc2.persist(); // This should be merged
        Long acc2NodeId = acc2.getNodeId();

        assertEquals("Ids should be the same",acc1NodeId,acc2NodeId);
        Account1 loadedAcc1 = account1Repository.findBySchemaPropertyValue("accountNumber","111-222-333");
        assertNotNull(loadedAcc1);
        assertEquals("Expected name to have been updated (merged) with last value",UPDATED_NAME,loadedAcc1.getName());
    }
View Full Code Here

    @Transactional
    public void testSaveWhenFailOnDuplicateSetToFalse() {
        // Account1
        // @Indexed(unique = true, failOnDuplicate = false)
        // private String accountNumber;
        Account1 acc1 = new Account1("111-222-333", "Mr George - Current Account 1");
        Account1 acc2 = new Account1("111-222-333", "Mr George - Current Account 2");
        Account1 savedAcc1 = account1Repository.save(acc1);
        Account1 savedAcc2 = account1Repository.save(acc2);
        assertEquals("expecting the saving of the same entity result in a merge of nodes", ((NodeBacked)savedAcc1).getNodeId(), ((NodeBacked)savedAcc2).getNodeId());
        assertEquals("Mr George - Current Account 2", savedAcc2.getName() );

        Account1 loadedAcc1 = account1Repository.findBySchemaPropertyValue("accountNumber", "111-222-333");
        assertEquals("Mr George - Current Account 2", loadedAcc1.getName() );

    }
View Full Code Here

TOP

Related Classes of org.springframework.data.neo4j.aspects.support.domain.Account1

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.