当前位置: 首页>>代码示例>>Java>>正文


Java MqttTopic.validate方法代码示例

本文整理汇总了Java中org.eclipse.paho.client.mqttv3.MqttTopic.validate方法的典型用法代码示例。如果您正苦于以下问题:Java MqttTopic.validate方法的具体用法?Java MqttTopic.validate怎么用?Java MqttTopic.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.paho.client.mqttv3.MqttTopic的用法示例。


在下文中一共展示了MqttTopic.validate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onViewClicked

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@OnClick(R.id.btn_subscribe)
public void onViewClicked() {
    String topic = mTopic.getText().toString().trim();
    try {
        MqttTopic.validate(topic, true/*allow wildcards*/);
    } catch (IllegalArgumentException e) {
        TipUtil.showSnackbar(mLinearLayout, e.getMessage());
        return;
    }

    int qos = mQoSLayout.getQoS();

    Subscription subscription = new Subscription(topic, qos);

    Intent intent = new Intent();
    intent.putExtra(Constant.ExtraConstant.EXTRA_SUBSCRIPTION, subscription);
    setResult(RESULT_OK, intent);
    finish();

}
 
开发者ID:emqtt,项目名称:EMQ-Android-Toolkit,代码行数:21,代码来源:SubscriptionActivity.java

示例2: onViewClicked

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@OnClick(R.id.btn_publish)
public void onViewClicked() {
    String topic = mTopic.getText().toString().trim();

    try{
        MqttTopic.validate(topic, false/*wildcards NOT allowed*/);
    }catch (IllegalArgumentException e){
        TipUtil.showSnackbar(mLinearLayout, e.getMessage());
        return;
    }
    int qos = mQoSChooseLayout.getQoS();
    String payload = mPayload.getText().toString().trim();
    boolean isRetained = mRetainedSwitch.isChecked();

    Publication publication = new Publication(topic, payload, qos, isRetained);

    Intent intent = new Intent();
    intent.putExtra(Constant.ExtraConstant.EXTRA_PUBLICATION, publication);
    setResult(RESULT_OK, intent);
    finish();
}
 
开发者ID:emqtt,项目名称:EMQ-Android-Toolkit,代码行数:22,代码来源:PublicationActivity.java

示例3: testValidTopicFilterWildcards

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test
public void testValidTopicFilterWildcards() throws Exception {
  String methodName = Utility.getMethodName();
  LoggingUtilities.banner(log, cclass, methodName);
  String[] topics = new String[] { 
          "+", "+/+", "+/foo", 
          "+/tennis/#",
          "foo/+", "foo/+/bar", 
          "/+", "/+/sport/+/player1",
          "#", "/#",
          "sport/#",
          "sport/tennis/#"
   };
  
  for(String topic:topics){
      MqttTopic.validate(topic, true);
  }
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:19,代码来源:MqttTopicTest.java

示例4: onAddSubscription

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Override
public void onAddSubscription(Subscription subscription) {
    try {
        MqttTopic.validate(subscription.getTopic(),true);
    }catch (IllegalArgumentException e){
        TipUtil.showSnackbar(mCoordinatorLayout,e.getMessage());
        return;
    }
    subscription.setConnectionId(mConnection.getId());
    mSubscription = subscription;
    RealmHelper.getInstance().addSubscription(mSubscription);
    subscribe(subscription);
}
 
开发者ID:emqtt,项目名称:EMQ-Android-Toolkit,代码行数:14,代码来源:DashboardActivity.java

示例5: testInvalidTopicFilterWildcards1

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards1() throws Exception {
  String methodName = Utility.getMethodName();
  LoggingUtilities.banner(log, cclass, methodName);
  MqttTopic.validate("sport/tennis#", true);
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:7,代码来源:MqttTopicTest.java

示例6: testInvalidTopicFilterWildcards2

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards2() throws Exception {
  String methodName = Utility.getMethodName();
  LoggingUtilities.banner(log, cclass, methodName);
  MqttTopic.validate("sport/tennis/#/ranking", true);
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:7,代码来源:MqttTopicTest.java

示例7: testInvalidTopicFilterWildcards3

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards3() throws Exception {
  String methodName = Utility.getMethodName();
  LoggingUtilities.banner(log, cclass, methodName);
  MqttTopic.validate("sport+", true);
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:7,代码来源:MqttTopicTest.java

示例8: testInvalidTopicFilterWildcards4

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards4() throws Exception {
  String methodName = Utility.getMethodName();
  LoggingUtilities.banner(log, cclass, methodName);
  MqttTopic.validate("sport/+aa", true);
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:7,代码来源:MqttTopicTest.java

示例9: testInvalidTopicFilterWildcards5

import org.eclipse.paho.client.mqttv3.MqttTopic; //导入方法依赖的package包/类
@Test(expected = IllegalArgumentException.class)
public void testInvalidTopicFilterWildcards5() throws Exception {
  String methodName = Utility.getMethodName();
  LoggingUtilities.banner(log, cclass, methodName);
  MqttTopic.validate("sport/#/ball/+/aa", true);
}
 
开发者ID:gulliverrr,项目名称:hestia-engine-dev,代码行数:7,代码来源:MqttTopicTest.java


注:本文中的org.eclipse.paho.client.mqttv3.MqttTopic.validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。