org.apache.commons.collections.TransformerUtils Java Examples

The following examples show how to use org.apache.commons.collections.TransformerUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddressServiceTest.java    From java-client with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetAddress() throws BlockCypherException, IOException {
    String addressM = "mvYwMT3aZ5jNcRNNjv7ckxjbqMDtvQbAHz";
    Address address = blockCypherContext.getAddressService().getAddress(addressM);

    logger.info(MessageFormat.format("Adress {0} has the following transactions: ", addressM));
    logger.info(StringUtils.join(CollectionUtils.collect(address.getTxrefs(),
            TransformerUtils.invokerTransformer("getTxHash")), "\n"));

    TransactionSummary transactionSummary = (TransactionSummary) CollectionUtils.find(address.getTxrefs(),
            new Predicate() {
                public boolean evaluate(Object object) {
                    return ((TransactionSummary) object).getTxHash()
                            .equals("f8c652d90b1aa2e510ab0963525836e1e1bcc1f93f7beca65a8902c54ed77d5e");
                }
            });
    assertNotNull(transactionSummary);
    assertEquals(new Long(271558), transactionSummary.getBlockHeight());
    assertEquals(new BigDecimal(100270000), transactionSummary.getValue());
}
 
Example #2
Source File: PxtSessionDelegateImplTest.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
public final void testLoadPxtSessionWhenPxtSessionIdIsNull() {
    setUpLoadPxtSession();

    context().checking(new Expectations() { {
        allowing(mockRequest).getCookies();
        will(returnValue(null));
    } });

    pxtSessionDelegate.setCreatePxtSessionCallback(
            TransformerUtils.constantTransformer(getPxtSession()));

    pxtSessionDelegate.loadPxtSession(getRequest());
}
 
Example #3
Source File: PxtSessionDelegateImplTest.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
public final void testLoadPxtSessionWhenPxtSessionIdIsInvalid() {
    setUpLoadPxtSession();

    context().checking(new Expectations() { {
        allowing(mockRequest).getCookies();
        will(returnValue(new Cookie[] {getPxtCookie()}));
    } });

    pxtSessionDelegate.setCreatePxtSessionCallback(
            TransformerUtils.constantTransformer(getPxtSession()));

    pxtSessionDelegate.loadPxtSession(getRequest());
}
 
Example #4
Source File: PxtSessionDelegateImplTest.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
public final void testLoadPxtSessionWhenPxtSessionIdIsNull() {
    setUpLoadPxtSession();

    context().checking(new Expectations() { {
        allowing(mockRequest).getCookies();
        will(returnValue(null));
    } });

    pxtSessionDelegate.setCreatePxtSessionCallback(
            TransformerUtils.constantTransformer(getPxtSession()));

    pxtSessionDelegate.loadPxtSession(getRequest());
}
 
Example #5
Source File: PxtSessionDelegateImplTest.java    From spacewalk with GNU General Public License v2.0 5 votes vote down vote up
public final void testLoadPxtSessionWhenPxtSessionIdIsInvalid() {
    setUpLoadPxtSession();

    context().checking(new Expectations() { {
        allowing(mockRequest).getCookies();
        will(returnValue(new Cookie[] {getPxtCookie()}));
    } });

    pxtSessionDelegate.setCreatePxtSessionCallback(
            TransformerUtils.constantTransformer(getPxtSession()));

    pxtSessionDelegate.loadPxtSession(getRequest());
}
 
Example #6
Source File: PxtSessionDelegateImplTest.java    From uyuni with GNU General Public License v2.0 4 votes vote down vote up
PxtSessionDelegateImplStub() {
    findPxtSessionByIdCallback = TransformerUtils.nullTransformer();
    createPxtSessionCallback = TransformerUtils.nullTransformer();
}
 
Example #7
Source File: PxtSessionDelegateImplTest.java    From spacewalk with GNU General Public License v2.0 4 votes vote down vote up
PxtSessionDelegateImplStub() {
    findPxtSessionByIdCallback = TransformerUtils.nullTransformer();
    createPxtSessionCallback = TransformerUtils.nullTransformer();
}