Package de.fhkn.in.uce.connectivitymanager

Examples of de.fhkn.in.uce.connectivitymanager.NATTraversalTechniqueMock$NATTraversalTechniqueMockMetaData


    }

    @Test
    public void testGetNATTraversalTechniquesForNATSituation() {
        final List<NATTraversalTechnique> expected = new ArrayList<NATTraversalTechnique>();
        expected.add(new NATTraversalTechniqueMock("Relaying", 7, false));
        final NATSituation natSituation = new NATSituation(NATFeatureRealization.CONNECTION_DEPENDENT,
                NATFeatureRealization.CONNECTION_DEPENDENT, NATFeatureRealization.CONNECTION_DEPENDENT,
                NATFeatureRealization.CONNECTION_DEPENDENT);
        final List<NATTraversalTechnique> actual = this.selection
                .getNATTraversalTechniquesForNATSituation(natSituation);
View Full Code Here


        this.selector = new ConnectionSetupTimeSelection(NATTraversalRegistryImpl.getInstance(), decisionTree);
    }

    @Test
    public void testUnknownNATSituation() {
        this.expectedResult.add(new NATTraversalTechniqueMock("DirectConnection", 3, true));
        this.expectedResult.add(new NATTraversalTechniqueMock("Reversal", 3, true));
        this.expectedResult.add(new NATTraversalTechniqueMock("HolePunching", Integer.MAX_VALUE, true));
        this.expectedResult.add(new NATTraversalTechniqueMock("Relaying", 7, false));

        this.actualResult = this.selector.getNATTraversalTechniquesForNATSituation(new NATSituation());

        assertEquals(this.expectedResult, this.actualResult);
    }
View Full Code Here

    }

    @Test
    public void testGetAllSupportedNATTraversalTechniques() {
        final List<NATTraversalTechnique> expectedResult = new ArrayList<NATTraversalTechnique>();
        expectedResult.add(new NATTraversalTechniqueMock("DirectConnection", 3, true));
        expectedResult.add(new NATTraversalTechniqueMock("Reversal", 3, true));
        expectedResult.add(new NATTraversalTechniqueMock("HolePunching", 3, true));
        expectedResult.add(new NATTraversalTechniqueMock("Relaying", 7, false));
        final List<NATTraversalTechnique> actualResult = this.registry.getAllSupportedNATTraversalTechniques();

        assertTrue(this.containsAll(expectedResult, actualResult));
    }
View Full Code Here

        assertTrue(this.containsAll(expectedResult, actualResult));
    }

    @Test
    public void testGetDirectConnectionTechnique() throws Exception {
        final NATTraversalTechnique expectedResult = new NATTraversalTechniqueMock("DirectConnection", 3, true);
        final NATTraversalTechnique actualResult = this.registry.getNATTraversalTechniqueByName("DirectConnection");

        assertEquals("DirectConnection is requested.", expectedResult, actualResult);
    }
View Full Code Here

    // @Test
    // commented out until dt parameters are correct
    public void testGetRulesForDecisionTree() {
        final List<NATTraversalTechnique> natTravListDV = new ArrayList<NATTraversalTechnique>();
        natTravListDV.add(new NATTraversalTechniqueMock("DirectConnection", 3, true));
        final List<NATTraversalTechnique> natTravListCR = new ArrayList<NATTraversalTechnique>();
        natTravListCR.add(new NATTraversalTechniqueMock("Reversal", 3, true));
        final List<NATTraversalTechnique> natTravListDVCR = new ArrayList<NATTraversalTechnique>();
        natTravListDVCR.add(new NATTraversalTechniqueMock("DirectConnection", 3, true));
        natTravListDVCR.add(new NATTraversalTechniqueMock("Reversal", 3, true));
        final Set<NATTraversalRule> expectedResult = new HashSet<NATTraversalRule>();

        expectedResult.add(new NATTraversalRule(new NATSituation(NATFeatureRealization.NOT_REALIZED,
                NATFeatureRealization.NOT_REALIZED, NATFeatureRealization.ENDPOINT_INDEPENDENT,
                NATFeatureRealization.ENDPOINT_INDEPENDENT), natTravListDVCR));
View Full Code Here

    }

    @Test
    public void testGetAllFallbackTechniques() {
        final List<NATTraversalTechnique> expectedResult = new ArrayList<NATTraversalTechnique>();
        expectedResult.add(new NATTraversalTechniqueMock("Relaying", 6, false));

        final List<NATTraversalTechnique> actualResult = this.registry.getAllFallbackTechniques();

        assertTrue("All fallback techniques should be returned.", this.containsAll(expectedResult, actualResult));
    }
View Full Code Here

    public void testGetAppropriateNATTraversalTechniques() {
        final NATSituation natSituation = new NATSituation(NATFeatureRealization.ENDPOINT_INDEPENDENT,
                NATFeatureRealization.ENDPOINT_INDEPENDENT, NATFeatureRealization.ENDPOINT_INDEPENDENT,
                NATFeatureRealization.ENDPOINT_INDEPENDENT);
        final List<NATTraversalTechnique> expectedResult = new ArrayList<NATTraversalTechnique>();
        expectedResult.add(new NATTraversalTechniqueMock("Reversal", 0, true));
        expectedResult.add(new NATTraversalTechniqueMock("HolePunching", 0, true));
        expectedResult.add(new NATTraversalTechniqueMock("Relaying", 0, false));
        final List<NATTraversalTechnique> actualResult = this.tree.getAppropriateNATTraversalTechniques(natSituation);
        assertTrue(this.util.compareLists(actualResult, expectedResult));
    }
View Full Code Here

    @Test
    public void testGetTravTechsForUnknownSituation() {
        final NATSituation natSituation = new NATSituation(NATFeatureRealization.DONT_CARE,
                NATFeatureRealization.DONT_CARE, NATFeatureRealization.DONT_CARE, NATFeatureRealization.DONT_CARE);
        final List<NATTraversalTechnique> expectedResult = new ArrayList<NATTraversalTechnique>();
        expectedResult.add(new NATTraversalTechniqueMock("DirectConnection", 3, true));
        expectedResult.add(new NATTraversalTechniqueMock("Reversal", 3, true));
        expectedResult.add(new NATTraversalTechniqueMock("HolePunching", Integer.MAX_VALUE, true));
        expectedResult.add(new NATTraversalTechniqueMock("Relaying", 7, false));
        final List<NATTraversalTechnique> actualResult = this.tree.getAppropriateNATTraversalTechniques(natSituation);

        assertTrue(this.containsSameElements(expectedResult, actualResult));
    }
View Full Code Here

        this.expectedResult = new ArrayList<NATTraversalTechnique>();
    }

    @Test
    public void testSortedConnectionSetupTime() {
        this.expectedResult.add(new NATTraversalTechniqueMock("ConnectionReversal", 3, true));
        this.expectedResult.add(new NATTraversalTechniqueMock("HolePunching", 5, true));
        this.expectedResult.add(new NATTraversalTechniqueMock("Relaying", 0, false));

        this.actualResult.add(new NATTraversalTechniqueMock("Relaying", 0, false));
        this.actualResult.add(new NATTraversalTechniqueMock("HolePunching", 5, true));
        this.actualResult.add(new NATTraversalTechniqueMock("ConnectionReversal", 3, true));

        Collections.sort(this.actualResult, ConnectionSetupTimeComparator.getInstance());

        assertEquals("The list has to be sorted by the ConnectionSetupTime correctly.", this.expectedResult,
                this.actualResult);
View Full Code Here

                this.actualResult);
    }

    @Test
    public void testSortedConnectionSetupTimeWithFallback() {
        this.expectedResult.add(new NATTraversalTechniqueMock("ConnectionReversal", 3, true));
        this.expectedResult.add(new NATTraversalTechniqueMock("HolePunching", 5, true));
        this.expectedResult.add(new NATTraversalTechniqueMock("Relaying", 0, false));
        this.expectedResult.add(new NATTraversalTechniqueMock("Relaying2", 7, false));

        this.actualResult.add(new NATTraversalTechniqueMock("Relaying2", 7, false));
        this.actualResult.add(new NATTraversalTechniqueMock("HolePunching", 5, true));
        this.actualResult.add(new NATTraversalTechniqueMock("Relaying", 0, false));
        this.actualResult.add(new NATTraversalTechniqueMock("ConnectionReversal", 3, true));

        Collections.sort(this.actualResult, ConnectionSetupTimeComparator.getInstance());

        assertEquals("The list has to be sorted by the ConnectionSetupTime and fallback technique correctly.",
                this.expectedResult, this.actualResult);
View Full Code Here

TOP

Related Classes of de.fhkn.in.uce.connectivitymanager.NATTraversalTechniqueMock$NATTraversalTechniqueMockMetaData

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.