Package org.apache.tuscany.sca.interfacedef

Examples of org.apache.tuscany.sca.interfacedef.Operation


    }

    @Test
    public void testBasic() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        Operation opSource1 = newOperation("op1");
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());
        InterfaceContract target = new MockContract("FooContract");
        Operation opSource2 = newOperation("op1");
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opSource2);
        target.getInterface().getOperations().addAll(targetOperations.values());
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here


    }

    @Test
    public void testBasicIncompatibleOperationNames() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        Operation opSource1 = newOperation("op1");
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());
        InterfaceContract target = new MockContract("FooContract");
        Operation opSource2 = newOperation("op2");
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op2", opSource2);
        target.getInterface().getOperations().addAll(targetOperations.values());
        try {
            mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
View Full Code Here

    public void testInputTypes() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        List<DataType> sourceInputTypes = new ArrayList<DataType>();
        sourceInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
        DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
        Operation opSource1 = newOperation("op1");
        opSource1.setInputType(inputType);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        List<DataType> targetInputTypes = new ArrayList<DataType>();
        targetInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
        DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);

        Operation opTarget = newOperation("op1");
        opTarget.setInputType(targetInputType);
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here

    public void testIncompatibleInputTypes() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        List<DataType> sourceInputTypes = new ArrayList<DataType>();
        sourceInputTypes.add(new DataTypeImpl<Type>(Integer.class, Integer.class));
        DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
        Operation opSource1 = newOperation("op1");
        opSource1.setInputType(inputType);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        List<DataType> targetInputTypes = new ArrayList<DataType>();
        targetInputTypes.add(new DataTypeImpl<Type>(String.class, String.class));
        DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);

        Operation opTarget = newOperation("op1");
        opTarget.setInputType(targetInputType);
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
        try {
            mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
View Full Code Here

        InterfaceContract source = new MockContract("FooContract");
        DataType sourceStringType =  new DataTypeImpl<Type>(String.class, String.class);
        ArrayList sourceTypes = new ArrayList();
        sourceTypes.add(sourceStringType);
        DataType sourceOutputType = new DataTypeImpl(Object[].class, sourceTypes);
        Operation opSource1 = newOperation("op1");
        opSource1.setOutputType(sourceOutputType);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        DataType stringType = new DataTypeImpl<Type>(String.class, String.class);
        ArrayList types = new ArrayList();
        types.add(stringType);
        DataType targetOutputType = new DataTypeImpl(Object[].class, types);
        Operation opTarget = newOperation("op1");
        opTarget.setOutputType(targetOutputType);
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here

        InterfaceContract source = new MockContract("FooContract");
        DataType sourceType = new DataTypeImpl<Type>(String.class, String.class);
        ArrayList sourceTypes = new ArrayList();
        sourceTypes.add(sourceType);
        DataType sourceOutputType = new DataTypeImpl(Object[].class, sourceTypes);
        Operation opSource1 = newOperation("op1");
        opSource1.setOutputType(sourceOutputType);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        DataType targetType = new DataTypeImpl<Type>(Integer.class, Integer.class);
        ArrayList targetTypes = new ArrayList();
        targetTypes.add(targetType);
        DataType targetOutputType = new DataTypeImpl(Object[].class, targetTypes);
        Operation opTarget = newOperation("op1");
        opTarget.setOutputType(targetOutputType);
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
        try {
            mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
View Full Code Here

    public void testFaultTypes() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
        List<DataType> sourceFaultTypes = new ArrayList<DataType>();
        sourceFaultTypes.add(0, sourceFaultType);
        Operation opSource1 = newOperation("op1");
        opSource1.setFaultTypes(sourceFaultTypes);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        DataType targetFaultType = new DataTypeImpl<Type>(String.class, String.class);
        List<DataType> targetFaultTypes = new ArrayList<DataType>();
        targetFaultTypes.add(0, targetFaultType);

        Operation opTarget = newOperation("op1");
        opTarget.setFaultTypes(targetFaultTypes);
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here

    public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
        InterfaceContract source = new MockContract("FooContract");
        DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
        List<DataType> sourceFaultTypes = new ArrayList<DataType>();
        sourceFaultTypes.add(0, sourceFaultType);
        Operation opSource1 = newOperation("op1");
        opSource1.setFaultTypes(sourceFaultTypes);
        Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
        sourceOperations.put("op1", opSource1);
        source.getInterface().getOperations().addAll(sourceOperations.values());

        InterfaceContract target = new MockContract("FooContract");
        Operation opTarget = newOperation("op1");
        Map<String, Operation> targetOperations = new HashMap<String, Operation>();
        targetOperations.put("op1", opTarget);
        target.getInterface().getOperations().addAll(targetOperations.values());
        mapper.checkCompatibility(source, target, Compatibility.SUBSET, false, false);
    }
View Full Code Here

            setInterface(jInterface);
        }
    }

    private static Operation newOperation(String name) {
        Operation operation = new OperationImpl();
        operation.setName(name);
        ArrayList<Object> outputTypes = new ArrayList<Object>();
        outputTypes.add(new DataTypeImpl(Object.class, Object.class));
        operation.setOutputType(new DataTypeImpl(Object[].class, outputTypes));
        return operation;
    }
View Full Code Here

    @Before
    public void setUp() throws Exception {
        contract = new MockInterfaceContract();
        Interface i1 = new MockInterface();
        contract.setInterface(i1);
        Operation op1 = newOperation("op1");
        i1.getOperations().add(op1);
        Interface i2 = new MockInterface();
        contract.setCallbackInterface(i2);
        Operation callbackOp1 = newOperation("callbackOp1");
        i2.getOperations().add(callbackOp1);
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.interfacedef.Operation

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.