Beispiel #1
0
 public static DataSet.SubscriberRow PublishSubscriber(AuthScheme authScheme)
 {
     DataSet.SubscriberDataTable dt = new DataSet.SubscriberDataTable();
     SubscriberTableAdapter ta = new SubscriberTableAdapter();
     dt.AddSubscriberRow(SiteConstant.Title, Guid.NewGuid().ToString("N"), authScheme.ToString(), Constant.Ago);
     ta.Update(dt);
     return dt[0];
 }
Beispiel #2
0
        public void TestNotification()
        {
            logger.Info("test");
            //            Settings.TestSettings(typeof(NotificationServiceStub), null);
            using (TransactionScope scope = new TransactionScope())
            {
                TitleTableAdapter tta = new TitleTableAdapter();
                DataSet.TitleDataTable tdt = new DataSet.TitleDataTable();
                tdt.AddTitleRow("test title", "test push message", "test site root path", "test standby path");
                tta.Update(tdt);
                DataSet.TitleRow title = tdt[0];

                CredentialTableAdapter cta = new CredentialTableAdapter();
                DataSet.CredentialDataTable cdt = new DataSet.CredentialDataTable();
                cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePathKind, SecureConstant.P12File);
                cta.Update(cdt);
                cdt.AddCredentialRow(title, Credential.ApnsPkcs12FilePasswordKind, SecureConstant.P12FilePassword);
                cta.Update(cdt);
                cdt.AddCredentialRow(title, Credential.LvlRsaKeyValueKind, "test lvlrsakeyvalue");
                cta.Update(cdt);

                SubscriberTableAdapter sta = new SubscriberTableAdapter();
                DataSet.SubscriberDataTable sdt = new DataSet.SubscriberDataTable();
                sdt.AddSubscriberRow(title, "test authkey", "web", Constant.Ago);
                sta.Update(sdt);
                DataSet.SubscriberRow subscriber = sdt[0];

                APNsTableAdapter ata = new APNsTableAdapter();
                ata.Insert(subscriber.Id, "B9C83DAE377DDEEECB7C9EA662F7BFBC5D3FA95A5AD5E3CD4B0DD843E0D9EBED", false, 0, false);

                ApnsPusher p = ApnsPusher.GetInstance(title);
                p.PushReleaseNotification("test push message 2");
                System.Threading.Thread.Sleep(10000); // �����ɏI������ƒʐM���Ԃɍ���Ȃ��i���ۂɑ��M����ꍇ�j

                DataSet.APNsDataTable adt = ata.GetDataByTitleId(title.Id);
                Expect(adt[0].UnreadRelease, Is.EqualTo(1));
            }
        }
        private DataSet.SubscriberRow PrepareExist(DataSet.TitleRow title)
        {
            SubscriberTableAdapter sta = new SubscriberTableAdapter();
            DataSet.SubscriberDataTable sdt = new DataSet.SubscriberDataTable();
            sdt.AddSubscriberRow(title, "deadbeef", AuthScheme.iOS_APNs.ToString(), Constant.Ago);
            sta.Update(sdt);
            DataSet.SubscriberRow subscriber = sdt[0];

            APNsTableAdapter ata = new APNsTableAdapter();
            DataSet.APNsDataTable adt = new DataSet.APNsDataTable();
            adt.AddAPNsRow(subscriber, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", false, 0, false);
            ata.Update(adt);

            TokenTableAdapter tta = new TokenTableAdapter();
            DataSet.TokenDataTable tdt = new DataSet.TokenDataTable();
            tdt.AddTokenRow(subscriber, DateTime.Now - new TimeSpan(48, 0, 0), "deadbeef");
            tta.Update(tdt);

            return subscriber;
        }