[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r557 - in /projects/zb4osgi/trunk/zigbee.zcl.library/src: main/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/ test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/

scm-notify at zb4osgi.aaloa.org scm-notify at zb4osgi.aaloa.org
Tue Oct 23 12:30:11 CEST 2012


Author: stefano.lenzi
Date: Tue Oct 23 12:30:11 2012
New Revision: 557

Log:
Adde Test Unit GetGroupMembership and fixed automatic generation of Group Count field (refs #153 )

Added:
    projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java   (with props)
Modified:
    projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommand.java

Modified: projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommand.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommand.java (original)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommand.java Tue Oct 23 12:30:11 2012
@@ -44,8 +44,9 @@
 	
 	public byte[] getPayload(){	
 		if( payload == null){			
-			payload = new byte[groupList.length * 2];
+			payload = new byte[groupList.length * 2 + 1];
 			ZBSerializer serializer = new DefaultSerializer(payload,0);
+			serializer.append_byte((byte) groupList.length);
 			for (int i = 0; i < groupList.length; i++) {
 				serializer.append_short((short)groupList[i]);
 			}

Added: projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java (added)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java Tue Oct 23 12:30:11 2012
@@ -1,0 +1,48 @@
+/*
+   Copyright 2008-2010 CNR-ISTI, http://isti.cnr.it
+   Institute of Information Science and Technologies 
+   of the Italian National Research Council 
+
+
+   See the NOTICE file distributed with this work for additional 
+   information regarding copyright ownership
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+package it.cnr.isti.zigbee.zcl.library.impl.general.groups;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+/**
+ * 
+ * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
+ * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @since 0.8.0
+ *
+ */
+public class GetGroupMembershipCommandTest {
+
+	@Test
+	public void testGetPayload() {
+		GetGroupMembershipCommand req = new GetGroupMembershipCommand(new int[]{512, 32768, -512});
+		assertArrayEquals( new byte[]{
+				0x03,
+				0x00, 0x02, 		//   512
+				0x00, (byte) 0x80,	// 32768
+				0x00, (byte) 0xFE 	// - 512
+		},req.getPayload());
+	}
+
+}

Propchange: projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: projects/zb4osgi/trunk/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/groups/GetGroupMembershipCommandTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the Commit mailing list