|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.carbide.remoteconnections.tests.extensions; |
|
19 |
|
20 import com.nokia.carbide.remoteconnections.interfaces.*; |
|
21 import com.nokia.carbide.trk.support.connection.TCPIPConnectionFactory; |
|
22 |
|
23 import org.osgi.framework.Version; |
|
24 |
|
25 import java.util.Collections; |
|
26 import java.util.Map; |
|
27 |
|
28 @SuppressWarnings("restriction") |
|
29 public class DefaultProvidingTCPIPService implements IService2 { |
|
30 |
|
31 public static final String DEFAULT_PORT = "4144"; |
|
32 public static String ID = DefaultProvidingTCPIPService.class.getName(); |
|
33 |
|
34 public DefaultProvidingTCPIPService() { |
|
35 } |
|
36 |
|
37 public String getAdditionalServiceInfo() { |
|
38 return "No testing available for this service"; |
|
39 } |
|
40 |
|
41 public String getDisplayName() { |
|
42 return "Default Providing Service"; |
|
43 } |
|
44 |
|
45 public String getIdentifier() { |
|
46 return ID; |
|
47 } |
|
48 |
|
49 public IRemoteAgentInstallerProvider getInstallerProvider() { |
|
50 return null; |
|
51 } |
|
52 |
|
53 public boolean isTestable() { |
|
54 return false; |
|
55 } |
|
56 |
|
57 public Map<String, String> getDefaults() { |
|
58 return Collections.singletonMap(TCPIPConnectionFactory.IP_PORT, DEFAULT_PORT); |
|
59 } |
|
60 |
|
61 public IConnectedService createInstance(IConnection connection) { |
|
62 final IConnectedService[] connectedService = { null }; |
|
63 IConnectedService cs = new IConnectedService() { |
|
64 private boolean enabled; |
|
65 |
|
66 public void addStatusChangedListener(IStatusChangedListener listener) { |
|
67 } |
|
68 |
|
69 public void dispose() { |
|
70 } |
|
71 |
|
72 public IService getService() { |
|
73 return DefaultProvidingTCPIPService.this; |
|
74 } |
|
75 |
|
76 public IStatus getStatus() { |
|
77 return new IStatus() { |
|
78 public IConnectedService getConnectedService() { |
|
79 return connectedService[0]; |
|
80 } |
|
81 |
|
82 public EStatus getEStatus() { |
|
83 return EStatus.UNKNOWN; |
|
84 } |
|
85 |
|
86 public String getLongDescription() { |
|
87 return "This is for testing only"; |
|
88 } |
|
89 |
|
90 public String getShortDescription() { |
|
91 return "Unknown status"; |
|
92 } |
|
93 }; |
|
94 } |
|
95 |
|
96 public boolean isEnabled() { |
|
97 return enabled; |
|
98 } |
|
99 |
|
100 public void removeStatusChangedListener(IStatusChangedListener listener) { |
|
101 } |
|
102 |
|
103 public void setDeviceOS(String familyName, Version version) { |
|
104 } |
|
105 |
|
106 public void setEnabled(boolean enabled) { |
|
107 this.enabled = enabled; |
|
108 } |
|
109 |
|
110 public void testStatus() { |
|
111 } |
|
112 }; |
|
113 |
|
114 connectedService[0] = cs; |
|
115 return cs; |
|
116 } |
|
117 |
|
118 public boolean wantsDeviceOS() { |
|
119 return false; |
|
120 } |
|
121 |
|
122 public Object getAdapter(Class adapter) { |
|
123 return null; |
|
124 } |
|
125 } |