forked from community/device-mgt-core
parent
9b76760c4a
commit
4d9357876d
@ -0,0 +1,65 @@
|
||||
package org.wso2.carbon.device.mgt.extensions.device.type.template;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.wso2.carbon.CarbonConstants;
|
||||
import org.wso2.carbon.base.MultitenantConstants;
|
||||
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||
import org.wso2.carbon.context.RegistryType;
|
||||
import org.wso2.carbon.context.internal.OSGiDataHolder;
|
||||
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
||||
import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypeMetaDefinition;
|
||||
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration;
|
||||
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Feature;
|
||||
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.Operation;
|
||||
import org.wso2.carbon.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException;
|
||||
import org.wso2.carbon.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder;
|
||||
import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager;
|
||||
import org.wso2.carbon.device.mgt.extensions.utils.Utils;
|
||||
import org.wso2.carbon.governance.api.util.GovernanceArtifactConfiguration;
|
||||
import org.wso2.carbon.governance.api.util.GovernanceUtils;
|
||||
import org.wso2.carbon.registry.core.Registry;
|
||||
import org.wso2.carbon.registry.core.exceptions.RegistryException;
|
||||
import org.wso2.carbon.registry.core.service.RegistryService;
|
||||
import org.wso2.carbon.registry.core.session.UserRegistry;
|
||||
import org.wso2.carbon.utils.FileUtil;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.wso2.carbon.governance.api.util.GovernanceUtils.getGovernanceArtifactConfiguration;
|
||||
|
||||
/**
|
||||
* This test case contains the tests for {@link HTTPDeviceTypeManagerService}
|
||||
*/
|
||||
public class HttpDeviceTypeManagerServiceTest {
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws RegistryException, IOException, SAXException, ParserConfigurationException,
|
||||
DeviceTypeConfigurationException, JAXBException {
|
||||
|
||||
|
||||
}
|
||||
|
||||
private DeviceTypeMetaDefinition sampleDeviceTypeMetaDefinition() {
|
||||
DeviceTypeMetaDefinition deviceTypeMetaDefinition = new DeviceTypeMetaDefinition();
|
||||
Feature feature = new Feature();
|
||||
Operation operation = new Operation();
|
||||
operation.setContext("/test");
|
||||
operation.setMethod("Get");
|
||||
operation.setType("COMMAND");
|
||||
feature.setCode("TEST");
|
||||
feature.setDescription("This is a test feature");
|
||||
feature.setName("TEST");
|
||||
deviceTypeMetaDefinition.setClaimable(true);
|
||||
deviceTypeMetaDefinition.setDescription("This is a new device type");
|
||||
// deviceTypeMetaDefinition.setInitialOperationConfig();
|
||||
return deviceTypeMetaDefinition;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~
|
||||
~ WSO2 Inc. licenses this file to you 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.
|
||||
-->
|
||||
<DeviceTypeConfiguration name="arduino">
|
||||
<Features>
|
||||
<Feature code="bulb">
|
||||
<Name>Control Bulb</Name>
|
||||
<Description>Control Bulb on Arduino Uno</Description>
|
||||
<Operation context="/arduino/device/{deviceId}/bulb" method="POST">
|
||||
<QueryParameters>
|
||||
<Parameter>state</Parameter>
|
||||
</QueryParameters>
|
||||
</Operation>
|
||||
</Feature>
|
||||
</Features>
|
||||
|
||||
<ProvisioningConfig>
|
||||
<SharedWithAllTenants>true</SharedWithAllTenants>
|
||||
</ProvisioningConfig>
|
||||
|
||||
<License>
|
||||
<Language>en_US</Language>
|
||||
<Version>1.0.0</Version>
|
||||
<Text>This is license text</Text>
|
||||
</License>
|
||||
|
||||
</DeviceTypeConfiguration>
|
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0"?>
|
||||
<artifactType type="application/vnd.wso2-license+xml" shortName="license" singularLabel="License" pluralLabel="Licenses"
|
||||
hasNamespace="false" iconSet="10">
|
||||
<storagePath>/device-mgt/license/@{overview_name}/@{overview_language}/@{overview_version}</storagePath>
|
||||
<nameAttribute>overview_name</nameAttribute>
|
||||
<ui>
|
||||
<list>
|
||||
<column name="Device Type">
|
||||
<data type="path" value="overview_name" href="@{storagePath}"/>
|
||||
</column>
|
||||
<column name="Language">
|
||||
<data type="path" value="overview_language" href="@{storagePath}"/>
|
||||
</column>
|
||||
<column name="Version">
|
||||
<data type="path" value="overview_version" href="@{storagePath}"/>
|
||||
</column>
|
||||
</list>
|
||||
</ui>
|
||||
<content>
|
||||
<table name="Overview">
|
||||
<field type="text" required="true">
|
||||
<name>Name</name>
|
||||
</field>
|
||||
<field type="text" required="true">
|
||||
<name>Language</name>
|
||||
</field>
|
||||
<field type="text" required="true">
|
||||
<name>Version</name>
|
||||
</field>
|
||||
<field type="text">
|
||||
<name>Validity From</name>
|
||||
</field>
|
||||
<field type="text">
|
||||
<name>Validity To</name>
|
||||
</field>
|
||||
<field type="text-area">
|
||||
<name>License</name>
|
||||
</field>
|
||||
</table>
|
||||
</content>
|
||||
</artifactType>
|
Loading…
Reference in new issue