Search in sources :

Example 16 with IMocksControl

use of org.easymock.IMocksControl in project cxf by apache.

the class LDAPCertificateRepoTest method testSaveServiceCert.

@Test
public void testSaveServiceCert() throws Exception {
    IMocksControl c = EasyMock.createControl();
    LdapSearch ldapSearch = c.createMock(LdapSearch.class);
    ldapSearch.bind(EasyMock.eq(EXPECTED_DN_FOR_SERVICE + "," + ROOT_DN), EasyMock.anyObject(Attributes.class));
    EasyMock.expectLastCall().once();
    LdapCertificateRepo ldapCertRepo = new LdapCertificateRepo(ldapSearch, LDAP_CERT_CONFIG, ROOT_DN);
    X509Certificate cert = getTestCert();
    c.replay();
    UseKeyWithType key = new UseKeyWithType();
    key.setApplication(Applications.SERVICE_NAME.getUri());
    key.setIdentifier(EXPECTED_SERVICE_URI);
    ldapCertRepo.saveCertificate(cert, key);
    c.verify();
}
Also used : IMocksControl(org.easymock.IMocksControl) Attributes(javax.naming.directory.Attributes) UseKeyWithType(org.apache.cxf.xkms.model.xkms.UseKeyWithType) X509Certificate(java.security.cert.X509Certificate) Test(org.junit.Test)

Example 17 with IMocksControl

use of org.easymock.IMocksControl in project cxf by apache.

the class LDAPCertificateRepoTest method testSaveUserCert.

@Test
public void testSaveUserCert() throws Exception {
    IMocksControl c = EasyMock.createControl();
    LdapSearch ldapSearch = c.createMock(LdapSearch.class);
    ldapSearch.bind(EasyMock.eq(EXPECTED_SUBJECT_DN2 + "," + ROOT_DN), EasyMock.anyObject(Attributes.class));
    EasyMock.expectLastCall().once();
    LdapCertificateRepo ldapCertRepo = new LdapCertificateRepo(ldapSearch, LDAP_CERT_CONFIG, ROOT_DN);
    X509Certificate cert = getTestCert();
    c.replay();
    UseKeyWithType key = new UseKeyWithType();
    key.setApplication(Applications.PKIX.getUri());
    key.setIdentifier(EXPECTED_SUBJECT_DN2);
    ldapCertRepo.saveCertificate(cert, key);
    c.verify();
}
Also used : IMocksControl(org.easymock.IMocksControl) Attributes(javax.naming.directory.Attributes) UseKeyWithType(org.apache.cxf.xkms.model.xkms.UseKeyWithType) X509Certificate(java.security.cert.X509Certificate) Test(org.junit.Test)

Example 18 with IMocksControl

use of org.easymock.IMocksControl in project cxf by apache.

the class CorbaBindingFactoryTest method testCreateBinding.

@Test
public void testCreateBinding() throws Exception {
    IMocksControl control = EasyMock.createNiceControl();
    BindingInfo bindingInfo = control.createMock(BindingInfo.class);
    CorbaBinding binding = (CorbaBinding) factory.createBinding(bindingInfo);
    assertNotNull(binding);
    assertTrue(CorbaBinding.class.isInstance(binding));
    List<Interceptor<? extends Message>> inInterceptors = binding.getInInterceptors();
    assertNotNull(inInterceptors);
    List<Interceptor<? extends Message>> outInterceptors = binding.getOutInterceptors();
    assertNotNull(outInterceptors);
    assertEquals(2, inInterceptors.size());
    assertEquals(2, outInterceptors.size());
}
Also used : IMocksControl(org.easymock.IMocksControl) Message(org.apache.cxf.message.Message) BindingInfo(org.apache.cxf.service.model.BindingInfo) Interceptor(org.apache.cxf.interceptor.Interceptor) Test(org.junit.Test)

Example 19 with IMocksControl

use of org.easymock.IMocksControl in project janusgraph by JanusGraph.

the class LockCleanerRunnableTest method setupMocks.

@Before
public void setupMocks() {
    IMocksControl relaxedCtrl = EasyMock.createControl();
    tx = relaxedCtrl.createMock(StoreTransaction.class);
    ctrl = EasyMock.createStrictControl();
    store = ctrl.createMock(KeyColumnValueStore.class);
}
Also used : IMocksControl(org.easymock.IMocksControl) KeyColumnValueStore(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore) StoreTransaction(org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction) Before(org.junit.Before)

Example 20 with IMocksControl

use of org.easymock.IMocksControl in project janusgraph by JanusGraph.

the class LockCleanerServiceTest method setupMocks.

@Before
public void setupMocks() {
    IMocksControl relaxedCtrl = EasyMock.createControl();
    tx = relaxedCtrl.createMock(StoreTransaction.class);
    ctrl = EasyMock.createStrictControl();
    store = ctrl.createMock(KeyColumnValueStore.class);
    exec = ctrl.createMock(ExecutorService.class);
}
Also used : IMocksControl(org.easymock.IMocksControl) KeyColumnValueStore(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore) StoreTransaction(org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction) ExecutorService(java.util.concurrent.ExecutorService) Before(org.junit.Before)

Aggregations

IMocksControl (org.easymock.IMocksControl)57 Test (org.junit.Test)34 HttpServletRequest (javax.servlet.http.HttpServletRequest)11 Message (org.apache.cxf.message.Message)11 HttpServletResponse (javax.servlet.http.HttpServletResponse)9 MessageImpl (org.apache.cxf.message.MessageImpl)9 QName (javax.xml.namespace.QName)7 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)7 Before (org.junit.Before)7 ArrayList (java.util.ArrayList)6 HashSet (java.util.HashSet)6 Set (java.util.Set)6 Exchange (org.apache.cxf.message.Exchange)6 FakeHttpServletRequest (com.google.gerrit.util.http.testutil.FakeHttpServletRequest)5 FakeHttpServletResponse (com.google.gerrit.util.http.testutil.FakeHttpServletResponse)5 IOException (java.io.IOException)5 HashMap (java.util.HashMap)5 Binding (javax.xml.ws.Binding)5 Handler (javax.xml.ws.handler.Handler)5 MessageContext (javax.xml.ws.handler.MessageContext)5