use of co.aurasphere.botmill.fb.test.autoreply.template.AnnotatedTemplatedBehaviourTest in project fb-botmill by BotMill.
the class AnnotatedTemplateTest method setup.
@Before
public void setup() {
Assume.assumeTrue(isConfigurationExist());
FbBotMillContext.getInstance().setup(System.getenv("fb.page.token"), System.getenv("fb.validation.token"));
// Load the Bot manually.
List<BotDefinition> botDefs = new ArrayList<BotDefinition>();
botDefs.add(new AnnotatedTemplatedBehaviourTest());
ConfigurationUtils.setBotDefinitionInstance(botDefs);
}
use of co.aurasphere.botmill.fb.test.autoreply.template.AnnotatedTemplatedBehaviourTest in project fb-botmill by BotMill.
the class AnnotatedTemplateTest method main.
public static void main(String[] args) {
StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
// can be sourced out
enc.setPassword("password");
ConfigurationUtils.loadEncryptedConfigurationFile(enc, "botmill.properties");
List<BotDefinition> botDef = new ArrayList<BotDefinition>();
botDef.add(new AnnotatedTemplatedBehaviourTest());
ConfigurationUtils.loadBotConfig();
ConfigurationUtils.setBotDefinitionInstance(botDef);
for (int i = 0; i < 10; i++) {
new Thread(new Runnable() {
String json = "{\"sender\":{\"id\":\"1158621824216736\"},\"recipient\":{\"id\":\"1226565047419159\"},\"timestamp\":1490832021661,\"message\":{\"mid\":\"mid.$cAAUPCFn4ymdhTcignVbHH3rzpKd_\",\"seq\":844819,\"text\":\"Hi!\"}}";
MessageEnvelope envelope = FbBotMillJsonUtils.fromJson(json, MessageEnvelope.class);
@Override
public void run() {
try {
IncomingToOutgoingMessageHandler.getInstance().process(envelope);
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
Aggregations