本文整理汇总了Java中org.edgexfoundry.domain.meta.DeviceProfile.addCommand方法的典型用法代码示例。如果您正苦于以下问题:Java DeviceProfile.addCommand方法的具体用法?Java DeviceProfile.addCommand怎么用?Java DeviceProfile.addCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.edgexfoundry.domain.meta.DeviceProfile
的用法示例。
在下文中一共展示了DeviceProfile.addCommand方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testValueDescriptorsForDeviceByName
import org.edgexfoundry.domain.meta.DeviceProfile; //导入方法依赖的package包/类
@Test
public void testValueDescriptorsForDeviceByName() {
Device device = DeviceData.newTestInstance();
DeviceProfile profile = ProfileData.newTestInstance();
Command command = CommandData.newTestInstance();
profile.addCommand(command);
device.setProfile(profile);
List<ValueDescriptor> valDes = new ArrayList<>();
valDes.add(valueDescriptor);
when(deviceClient.deviceForName(DeviceData.TEST_NAME)).thenReturn(device);
when(valDescRepos.findByName(TEST_NAME)).thenReturn(valueDescriptor);
List<ValueDescriptor> valueDescriptors =
controller.valueDescriptorsForDeviceByName(DeviceData.TEST_NAME);
checkTestData(valueDescriptors.get(0), TEST_ID);
}
示例2: testValueDescriptorsForDeviceById
import org.edgexfoundry.domain.meta.DeviceProfile; //导入方法依赖的package包/类
@Test
public void testValueDescriptorsForDeviceById() {
Device device = DeviceData.newTestInstance();
DeviceProfile profile = ProfileData.newTestInstance();
Command command = CommandData.newTestInstance();
profile.addCommand(command);
device.setProfile(profile);
List<ValueDescriptor> valDes = new ArrayList<>();
valDes.add(valueDescriptor);
when(deviceClient.device(TEST_ID)).thenReturn(device);
when(valDescRepos.findByName(TEST_NAME)).thenReturn(valueDescriptor);
List<ValueDescriptor> valueDescriptors = controller.valueDescriptorsForDeviceById(TEST_ID);
checkTestData(valueDescriptors.get(0), TEST_ID);
}
示例3: update
import org.edgexfoundry.domain.meta.DeviceProfile; //导入方法依赖的package包/类
/**
* update Command in DeviceProfile
*
* @param name name which matched with Device and addressable
* @param command updated Command
*
* @return updated DeviceProfile
*/
public DeviceProfile update(String name, Command command) {
if (deviceProfileClient == null || command == null) {
return null;
}
DeviceProfile deviceProfile = deviceProfileClient.deviceProfileForName(name);
deviceProfile.addCommand(command);
return deviceProfile;
}
示例4: setup
import org.edgexfoundry.domain.meta.DeviceProfile; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
deviceClient = new DeviceClientImpl();
srvClient = new DeviceServiceClientImpl();
proClient = new DeviceProfileClientImpl();
addrClient = new AddressableClientImpl();
commandClient = new CommandClientImpl();
client = new CmdClientImpl();
setURL();
Addressable addressable = AddressableData.newTestInstance();
addrClient.add(addressable);
DeviceService service = ServiceData.newTestInstance();
service.setAddressable(addressable);
srvClient.add(service);
Command command = CommandData.newTestInstance();
commandId = commandClient.add(command);
DeviceProfile profile = ProfileData.newTestInstance();
profile.addCommand(command);
proClient.add(profile);
Device device = DeviceData.newTestInstance();
device.setAddressable(addressable);
device.setProfile(profile);
device.setService(service);
id = deviceClient.add(device);
assertNotNull("CommandDevice did not get created correctly", id);
}