author | dadubrow |
Tue, 19 May 2009 15:33:01 -0500 | |
changeset 164 | 88b7eb94b003 |
permissions | -rw-r--r-- |
164
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
1 |
/* |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
3 |
* All rights reserved. |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
8 |
* |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
9 |
* Initial Contributors: |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
11 |
* |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
12 |
* Contributors: |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
13 |
* |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
14 |
* Description: |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
15 |
* |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
16 |
*/ |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
17 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
18 |
package com.nokia.carbide.remoteconnections.tests; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
19 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
20 |
import com.nokia.carbide.remoteconnections.RemoteConnectionsActivator; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
21 |
import com.nokia.carbide.remoteconnections.interfaces.*; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
22 |
import com.nokia.carbide.remoteconnections.tests.extensions.DefaultProvidingTCPIPService; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
23 |
import com.nokia.carbide.remoteconnections.tests.extensions.TestFilter; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
24 |
import com.nokia.carbide.trk.support.connection.TCPIPConnectionType; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
25 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
26 |
import java.util.Map; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
27 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
28 |
import junit.framework.TestCase; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
29 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
30 |
@SuppressWarnings("restriction") |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
31 |
public class TCPIPConnectionTypeTests extends TestCase { |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
32 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
33 |
private static IConnectionType connectionType; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
34 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
35 |
protected void setUp() throws Exception { |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
36 |
TestFilter.isTest = true; |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
37 |
IConnectionTypeProvider connectionTypeProvider = RemoteConnectionsActivator.getConnectionTypeProvider(); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
38 |
if (connectionType == null) |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
39 |
connectionType = connectionTypeProvider.getConnectionType(TCPIPConnectionType.ID); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
40 |
} |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
41 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
42 |
protected void tearDown() throws Exception { |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
43 |
} |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
44 |
|
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
45 |
public void testTCPIPDefaultMappings() throws Exception { |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
46 |
Map<String, String> settings = connectionType.getConnectionFactory().getSettingsFromUI(); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
47 |
IConnection connection = connectionType.getConnectionFactory().createConnection(settings); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
48 |
RemoteConnectionsActivator.getConnectionsManager().addConnection(connection); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
49 |
settings = connection.getSettings(); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
50 |
String defaultPort = settings.get(DefaultProvidingTCPIPService.ID); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
51 |
assertEquals(DefaultProvidingTCPIPService.DEFAULT_PORT, defaultPort); |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
52 |
} |
88b7eb94b003
[Bug 9085] Add new TCP/IP connection type with port mappings and new service interface to optionally provide defaults.
dadubrow
parents:
diff
changeset
|
53 |
} |