Search in sources :

Example 1 with SalesForceDao

use of org.orcid.core.salesforce.dao.SalesForceDao in project ORCID-Source by ORCID.

the class GetSalesForceAccessToken method main.

@SuppressWarnings("resource")
public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("orcid-core-context.xml");
    SalesForceDao salesForceDao = (SalesForceDao) context.getBean("salesForceDao");
    String accessToken = salesForceDao.getAccessToken();
    System.out.println(accessToken);
    System.exit(0);
}
Also used : ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) SalesForceDao(org.orcid.core.salesforce.dao.SalesForceDao)

Example 2 with SalesForceDao

use of org.orcid.core.salesforce.dao.SalesForceDao in project ORCID-Source by ORCID.

the class SalesForceManagerImplTest method testUpdateContact2.

@Test
public void testUpdateContact2() {
    // Switch from main to technical contact
    Contact contact = new Contact();
    contact.setId("contact2Id");
    contact.setAccountId("account1");
    ContactRole role = new ContactRole(ContactRoleType.TECHNICAL_CONTACT);
    role.setId("contact2Idrole1Id");
    contact.setRole(role);
    salesForceManager.updateContact(contact);
    verify(salesForceDao, times(1)).createContactRole(argThat(r -> {
        return "contact2Id".equals(r.getContactId()) && "account1Id".equals(r.getAccountId()) && ContactRoleType.TECHNICAL_CONTACT.equals(r.getRoleType());
    }));
    verify(salesForceDao, times(1)).removeContactRole(eq("contact2Idrole1Id"));
}
Also used : SalesForceManager(org.orcid.core.manager.SalesForceManager) SalesForceConnectionDao(org.orcid.persistence.dao.SalesForceConnectionDao) TargetProxyHelper(org.orcid.test.TargetProxyHelper) SelfPopulatingCache(net.sf.ehcache.constructs.blocking.SelfPopulatingCache) Mock(org.mockito.Mock) Mockito.times(org.mockito.Mockito.times) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) ArrayList(java.util.ArrayList) MockitoAnnotations(org.mockito.MockitoAnnotations) List(java.util.List) SalesForceConnectionEntity(org.orcid.persistence.jpa.entities.SalesForceConnectionEntity) Matchers.argThat(org.mockito.Matchers.argThat) Matchers.eq(org.mockito.Matchers.eq) SourceManager(org.orcid.core.manager.SourceManager) Contact(org.orcid.core.salesforce.model.Contact) ContactRole(org.orcid.core.salesforce.model.ContactRole) ContactRoleType(org.orcid.core.salesforce.model.ContactRoleType) Before(org.junit.Before) SalesForceDao(org.orcid.core.salesforce.dao.SalesForceDao) ContactRole(org.orcid.core.salesforce.model.ContactRole) Contact(org.orcid.core.salesforce.model.Contact) Test(org.junit.Test)

Aggregations

SalesForceDao (org.orcid.core.salesforce.dao.SalesForceDao)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 SelfPopulatingCache (net.sf.ehcache.constructs.blocking.SelfPopulatingCache)1 Before (org.junit.Before)1 Test (org.junit.Test)1 Matchers.argThat (org.mockito.Matchers.argThat)1 Matchers.eq (org.mockito.Matchers.eq)1 Mock (org.mockito.Mock)1 Mockito.times (org.mockito.Mockito.times)1 Mockito.verify (org.mockito.Mockito.verify)1 Mockito.when (org.mockito.Mockito.when)1 MockitoAnnotations (org.mockito.MockitoAnnotations)1 SalesForceManager (org.orcid.core.manager.SalesForceManager)1 SourceManager (org.orcid.core.manager.SourceManager)1 Contact (org.orcid.core.salesforce.model.Contact)1 ContactRole (org.orcid.core.salesforce.model.ContactRole)1 ContactRoleType (org.orcid.core.salesforce.model.ContactRoleType)1 SalesForceConnectionDao (org.orcid.persistence.dao.SalesForceConnectionDao)1 SalesForceConnectionEntity (org.orcid.persistence.jpa.entities.SalesForceConnectionEntity)1