Reference Guide
Table Of Contents
- 1 Introduction
- 2 Establishing Your Test and Development Environments
- 3 Developing Applications
- Introduction
- Authentication
- REST API
- Audit Logging
- Alert Logging
- Configuration
- High Availability
- OpenFlow
- Metrics Framework
- GUI
- SKI Framework - Overview
- SKI Framework - Navigation Tree
- SKI Framework - Hash Navigation
- SKI Framework - View Life-Cycle
- SKI Framework - Live Reference Application
- UI Extension
- Introduction
- Controller Teaming
- Distributed Coordination Service
- Persistence
- Backup and Restore
- Device Driver Framework
- 4 Application Security
- 5 Including Debian Packages with Applications
- 6 Sample Application
- Application Description
- Creating Application Development Workspace
- Application Generator (Automatic Workspace Creation)
- Creating Eclipse Projects
- Updating Project Dependencies
- Building the Application
- Installing the Application
- Application Code
- 7 Testing Applications
- 8 Built-In Applications
- Appendix A
- Appendix B
- Bibliography
application source code included with the HP VAN SDN Controller SDK. SwitchTest should be
located under hm-model/src/test/java/com/hp/hm/model directory.
SwitchTest.java:
package com.hp.hm.model;
import com.hp.test.BeanTest;
import com.hp.test.EqualityTester;
import com.hp.test.SerializabilityTester;
public class SwitchTest {
...
@Test
public void testGettersAndSetters() throws Exception {
Switch device = //... create an instance
BeanTest.testGettersAndSetters(device);
}
@Test
public void testEqualsAndHashcode() {
Switch base = //... create the base object
Switch equals1 = //... create an object equal to the base
Switch equals2 = //... create an object equal to the base
Switch unequal = //... create an object unequal to the base
EqualityTester.testEqualsAndHashCode(base, equals1,
equals2, unequal);
}
@Test
public void testSerialization() {
Switch device = //... create with attributes set to non-null values
SerializabilityTester.testSerialization(device);
}
}
BeanTest utility class—A rudimentary facility for generic testing of basic bean getter and setter
functionality. It uses reflection to locate matching getter/setter pairs in the supplied bean instance.
EqualityTester class—Verifies the equivalence relation on non-null object references as
documented in the Java Object.equals(Object) method; it follows the equals contract and makes
sure its properties hold: reflexive, symmetric, transitive, consistent and non-null reference.
SerializabilityTester class—Serializes and deserializes the object being tested looking for
serialization failures (java.io.NotSerializableException) which are thrown when an instance is
required to have a Serializable interface. It is crucial to set a non-null value to all non-transient
attributes in the object under test, otherwise serialization failures won’t be detected.
155