AdapterAgent extends ScheduleAgent implements AdapterAgentInterface { public void addAccount(@Name("adapterId") String adapterId, @Name("accountId") String accountId) throws Exception { AdapterConfig config = AdapterConfig.getAdapterConfig(adapterId); if (config == null) throw new Exception("No adapter with this id"); config.addAccount(accountId); config.update(); }  void startAllInboundSceduler(); void stopAllInboundSceduler(); String startEmailInboundSceduler(); ScheduledTask getEmailInboundScedulerDetails(); String stopEmailInboundSceduler(); String startTwitterInboundSceduler(); String stopTwitterInboundSceduler(); ScheduledTask getTwitterInboundScedulerDetails(); void checkInBoundEmails(); void checkInBoundTwitterPosts(); RestResponse createComsysAdapter(@Name("address") String address,
        @Name("username") @Optional String username,@Name("password") @Optional String password, 
        @Name("preferredLanguage") @Optional String preferredLanguage,
        @Name("accountId") @Optional String accountId, @Name("anonymous") boolean anonymous,
        @Name("accountType") @Optional String accountType, @Name("isPrivate") @Optional Boolean isPrivate); RestResponse createBroadSoftAdapter(@Name("username") @Optional String username,
        @Name("password") @Optional String password, @Name("preferredLanguage") @Optional String preferredLanguage,
        @Name("accountId") @Optional String accountId, @Name("anonymous") boolean anonymous,
        @Name("accountType") @Optional String accountType, @Name("isPrivate") @Optional Boolean isPrivate); Map<String, String> createMultipleTwilioAdapters(@Name("accountSid") String accountSid,
        @Name("authToken") String authToken, @Name("count") Integer count, @Name("countryCode") String countryCode,
        @Name("contains") @Optional String contains, @Name("preferredLanguage") @Optional String preferredLanguage,
        @Name("accountId") @Optional String accountId, @Name("anonymous") @Optional Boolean anonymous,
        @Name("isPrivate") @Optional Boolean isPrivate); String createTwilioAdapter(@Name("address") String address, @Name("accountSid") String accountSid,
        @Name("authToken") String authToken, @Name("preferredLanguage") @Optional String preferredLanguage,
        @Name("accountId") @Optional String accountId, @Name("anonymous") @Optional Boolean anonymous,
        @Name("isPrivate") @Optional Boolean isPrivate); ArrayNode moveTwilioAdaptersToSubAccount(@Name("accountId") String accountId, @Name("accountSid") String accountSid,
                                                   @Name("authToken") String authToken); String moveTwilioAdapterToSubAccount(@Name("adapterId") String adapterId, @Name("accountSid") String accountSid,
        @Name("authToken") String authToken); String moveTwilioAdapterToMainAccount(@Name("adapterId") String adapterId, @Name("accountSid") String accountSid,
                                                @Name("authToken") String authToken); String createThinkingPhonesAdapter(@Name("address") String address, 
                                              @Name("tenantKey") String tenantKey, @Name("token") String token, 
                                              @Name("preferredLanguage") @Optional String preferredLanguage, 
                                              @Name("accountId") @Optional String accountId,
                                              @Name("isPrivate") @Optional Boolean isPrivate); String createEmailAdapter(@Name("emailAddress") String emailAddress, @Name("password") String password,
        @Name("name") @Optional String name, @Name("preferredLanguage") @Optional String preferredLanguage,
        @Name("sendingProtocol") @Optional String sendingProtocol, @Name("sendingHost") @Optional String sendingHost,
        @Name("sendingPort") @Optional String sendingPort,
        @Name("receivingProtocol") @Optional String receivingProtocol,
        @Name("receivingHost") @Optional String receivingHost, @Name("accountId") @Optional String accountId,
        @Name("initialAgentURL") @Optional String initialAgentURL, @Name("accountType") @Optional String accountType,
        @Name("isPrivate") @Optional Boolean isPrivate); String createXMPPAdapter(@Name("xmppAddress") String xmppAddress, @Name("password") String password,
                                    @Name("name") @Optional String name,
                                    @Name("preferredLanguage") @Optional String preferredLanguage,
                                    @Name("host") @Optional String host, @Name("port") @Optional String port,
                                    @Name("service") @Optional String service,
                                    @Name("accountId") @Optional String accountId,
                                    @Name("initialAgentURL") @Optional String initialAgentURL,
                                    @Name("accountType") @Optional String accountType, @Name("isPrivate") @Optional Boolean isPrivate); String createUSSDAdapter(@Name("address") String address, @Name("keyword") @Optional String keyword,
        @Name("username") String username, @Name("password") String password,
        @Name("preferredLanguage") @Optional String preferredLanguage, @Name("accountId") @Optional String accountId,
        @Name("accountType") @Optional String accountType, @Name("isPrivate") @Optional Boolean isPrivate); String createPushAdapter(@Name("address") String address, @Name("keyword") @Optional String keyword,
        @Name("username") String username, @Name("password") String password,
        @Name("preferredLanguage") @Optional String preferredLanguage, @Name("accountId") @Optional String accountId,
        @Name("accountType") @Optional String accountType, @Name("isPrivate") @Optional Boolean isPrivate); String registerASKFastXMPPAdapter(@Name("xmppAddress") String xmppAddress,
        @Name("password") String password, @Name("name") @Optional String name, @Name("email") @Optional String email,
        @Name("preferredLanguage") @Optional String preferredLanguage, @Name("accountId") @Optional String accountId,
        @Name("initialAgentURL") @Optional String initialAgentURL, @Name("accountType") @Optional String accountType,
        @Name("isPrivate") @Optional Boolean isPrivate); String deregisterASKFastXMPPAdapter(@Name("xmppAddress") @Optional String xmppAddress,
        @Name("accountId") String accountId, @Name("adapterId") @Optional String adapterId); String createMBAdapter(@Name("address") String address, @Name("keyword") @Optional String keyword,
        @Name("username") String username, @Name("password") String password,
        @Name("preferredLanguage") @Optional String preferredLanguage, @Name("accountId") @Optional String accountId,
        @Name("accountType") @Optional String accountType, @Name("isPrivate") @Optional Boolean isPrivate); String createGenericSMSAdapter(@Name("address") String address,
        @Name("provider") @Optional AdapterProviders provider, @Name("keyword") @Optional String keyword,
        @Name("username") String username, @Name("password") String password,
        @Name("preferredLanguage") @Optional String preferredLanguage, @Name("accountId") @Optional String accountId,
        @Name("accountType") @Optional String accountType, @Name("isPrivate") @Optional Boolean isPrivate); String createNexmoAdapter(@Name("address") String address, @Name("keyword") @Optional String keyword,
        @Name("username") String username, @Name("password") String password,
        @Name("preferredLanguage") @Optional String preferredLanguage, @Name("accountId") @Optional String accountId,
        @Name("isPrivate") @Optional Boolean isPrivate); String attachTwitterAdapterToUser( @Name( "adapterID" ) @Optional String adapterID,
        @Name( "twitterUserName" ) @Optional String twitterUserName, @Name( "accountId" ) String accountId ); String createFacebookAdapter(); void setOwner(@Name("adapterId") String adapterId, @Name("accountId") String accountId); void addAccount(@Name("adapterId") String adapterId, @Name("accountId") String accountId); RestResponse getAdapter(@Name("accoutId") String accountId, @Name("adapterId") String adapterId); Object updateAdapter(@Name("accoutId") String accountId, @Name("adapterId") String adapterId,
                                @Name("adapter") Adapter adapter); void setAllAdapterAccountType(@Name("accountId") String accountId, @Name("accountType") AccountType type); void removeAdapter(@Name("adapterId") String adapterId, @Name("accountId") String accountId); ArrayNode getAdapters(@Name("accoutId") String accountId, @Name("adapterType") @Optional String adapterType,
        @Name("address") @Optional String address); ArrayNode getOwnedAdapters( @Name( "accoutId" ) String accountId, @Name( "adapterType" ) @Optional String adapterType, 
                                       @Name( "address" ) @Optional String address ); ArrayNode findAdapters(@Name("adapterType") @Optional String type,
        @Name("address") @Optional String address, @Name("keyword") @Optional String keyword); Object setProviderForAdapters(@Name("adapterId") String adapterId,
        @Name("provider") AdapterProviders provider); Object removeProviderForAdapters(@Name("adapterId") String adapterId); ArrayNode findFreeAdapters(@Name("adapterType") @Optional String adapterType,
        @Name("address") @Optional String address); HashMap<String, String> updateAllAdaptersWithProviders(); AdapterConfig setDialogToAdapter(@Name("accountId") String accountId, @Name("adapterId") String adapterId,
        @Name("dialogId") String dialogId); String getApplicationId(@Name("accountSID") String accountSid, @Name("authToken") String authToken); String getVersion(); static final int EMAIL_SCHEDULER_INTERVAL; static final int TWITTER_SCHEDULER_INTERVAL; static final String ADAPTER_TYPE_CALL; static final String ADAPTER_TYPE_SMS; static final String ADAPTER_TYPE_FACEBOOK; static final String ADAPTER_TYPE_EMAIL; static final String ADAPTER_TYPE_XMPP; static final String ADAPTER_TYPE_TWITTER; static final String ADAPTER_TYPE_USSD; static final String ADAPTER_TYPE_PUSH; }
@Test public void attachIngAnAdapterAddsATimestampTest() throws Exception { AdapterConfig adapter = createAdapterConfig(AdapterType.CALL.toString(), null, null, localFullAddressBroadsoft, null); Assert.assertThat(adapter, Matchers.notNullValue()); AdapterAgent adapterAgent = new AdapterAgent(); adapterAgent.addAccount(adapter.getConfigId(), TEST_PUBLIC_KEY); adapterAgent.addAccount(adapter.getConfigId(), TEST_PRIVATE_KEY); AdapterConfig adapterConfig = AdapterConfig.getAdapterConfig(adapter.getConfigId()); Assert.assertThat( adapterConfig.getAttachTimestamp(TEST_PRIVATE_KEY), Matchers.greaterThan(adapterConfig.getCreationTimestamp())); Assert.assertThat(adapterConfig.getAttachTimestamp(TEST_PRIVATE_KEY), Matchers.notNullValue()); Assert.assertThat(adapterConfig.getAttachTimestamp(TEST_PRIVATE_KEY), Matchers.greaterThanOrEqualTo(adapterConfig.getAttachTimestamp(TEST_PUBLIC_KEY))); }