EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.main]

COVERAGE SUMMARY FOR SOURCE FILE [VersionContextHandler.java]

nameclass, %method, %block, %line, %
VersionContextHandler.java100% (1/1)100% (3/3)70%  (21/30)89%  (8/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VersionContextHandler100% (1/1)100% (3/3)70%  (21/30)89%  (8/9)
extractContext (Map): void 100% (1/1)47%  (8/17)75%  (3/4)
VersionContextHandler (String): void 100% (1/1)100% (6/6)100% (3/3)
initContext (Map): void 100% (1/1)100% (7/7)100% (2/2)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.main;
16 
17import java.util.Map;
18 
19import net.sourceforge.hiveboard.util.VersionContext;
20import net.sourceforge.hiveboard.util.VersionMismatchException;
21import net.sourceforge.hiveremoting.caucho.RemoteContextHandler;
22 
23public class VersionContextHandler implements RemoteContextHandler
24{
25        public VersionContextHandler(String clientVersion)
26        {
27                _clientVersion = clientVersion;
28        }
29        
30        @SuppressWarnings("unchecked")
31        public void                initContext(Map<String, String> context)
32        {
33                context.put(VersionContext.CLIENT_VERSION_KEY, _clientVersion);
34        }
35 
36        public void                extractContext(Map<String, String> context)
37        {
38                String serverVersion = context.get(VersionContext.SERVER_VERSION_KEY);
39                if (serverVersion == null)
40                {
41                        // The only server that does not support version checking is HiveBoard 0.1.0
42                        throw new VersionMismatchException(        "Obsolete server version",
43                                                                                                _clientVersion,
44                                                                                                "0.1.0",
45                                                                                                "0.1.0");
46                }
47        }
48        
49        private String        _clientVersion;
50}

[all classes][net.sourceforge.hiveboard.main]
EMMA 2.0.5312 (C) Vladimir Roubtsov