Package com.facebook.swift.codec.metadata

Examples of com.facebook.swift.codec.metadata.ThriftCatalog


    @Test
    public void testOneOfEverythingFieldManual()
            throws Exception
    {
        ThriftCatalog catalog = codecManager.getCatalog();
        ThriftType bonkFieldType = catalog.getThriftType(BonkField.class);
        BonkFieldThriftCodec bonkFieldCodec = new BonkFieldThriftCodec(bonkFieldType);

        ThriftType oneOfEverythingType = catalog.getThriftType(OneOfEverything.class);
        OneOfEverythingThriftCodec codec = new OneOfEverythingThriftCodec(
                oneOfEverythingType,
                bonkFieldCodec,
                new SetThriftCodec<>(ThriftType.BOOL, new BooleanThriftCodec()));
View Full Code Here


    private <T> T testRoundTripSerialize(ThriftCodec<T> codec, T structInstance)
            throws Exception
    {
        Class<T> structClass = (Class<T>) structInstance.getClass();

        ThriftCatalog catalog = codecManager.getCatalog();
        ThriftStructMetadata<T> metadata = catalog.getThriftStructMetadata(structClass);
        assertNotNull(metadata);

        TMemoryBuffer transport = new TMemoryBuffer(10 * 1024);
        TCompactProtocol protocol = new TCompactProtocol(transport);
        codec.write(structInstance, protocol);
View Full Code Here

        assertExceptions("uninferrableException");
    }

    private void assertExceptions(String methodName, Class<? extends Exception>... expectedExceptions) throws Exception
    {
        ThriftMethodMetadata metadata = new ThriftMethodMetadata(DummyService.class.getMethod(methodName), new ThriftCatalog());
        Map<Short, Type> actualIdMap = new TreeMap<>();
        Map<Short, Type> expectedIdMap = new TreeMap<>();

        for (Map.Entry<Short, ThriftType> entry : metadata.getExceptions().entrySet()) {
            actualIdMap.put(entry.getKey(), entry.getValue().getJavaType());
View Full Code Here

        assertExceptions("uninferrableException");
    }

    private void assertExceptions(String methodName, Class<? extends Exception>... expectedExceptions) throws Exception
    {
        ThriftMethodMetadata metadata = new ThriftMethodMetadata("DummyService", DummyService.class.getMethod(methodName), new ThriftCatalog());
        Map<Short, Type> actualIdMap = new TreeMap<>();
        Map<Short, Type> expectedIdMap = new TreeMap<>();

        for (Map.Entry<Short, ThriftType> entry : metadata.getExceptions().entrySet()) {
            actualIdMap.put(entry.getKey(), entry.getValue().getJavaType());
View Full Code Here

TOP

Related Classes of com.facebook.swift.codec.metadata.ThriftCatalog

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.