Esempio n. 1
0
		void parameterizedOPIdentifierTest(TestSupport.Scenarios scenario,
			AuthenticationRequestMode requestMode, AuthenticationStatus expectedResult) {
			ProtocolVersion version = ProtocolVersion.V20; // only this version supports directed identity
			UriIdentifier claimedIdentifier = TestSupport.GetDirectedIdentityUrl(TestSupport.Scenarios.ApproveOnSetup, version);
			Identifier opIdentifier = TestSupport.GetMockOPIdentifier(TestSupport.Scenarios.ApproveOnSetup, claimedIdentifier);
			parameterizedProgrammaticOPIdentifierTest(opIdentifier, version, claimedIdentifier, requestMode, expectedResult, true);
			parameterizedProgrammaticOPIdentifierTest(opIdentifier, version, claimedIdentifier, requestMode, expectedResult, false);
		}
Esempio n. 2
0
		static ServiceEndpoint getServiceEndpoint(TestSupport.Scenarios scenario, ProtocolVersion version) {
			Protocol protocol = Protocol.Lookup(version);
			ServiceEndpoint ep = ServiceEndpoint.CreateForClaimedIdentifier(
				TestSupport.GetIdentityUrl(scenario, version),
				TestSupport.GetDelegateUrl(scenario),
				TestSupport.GetFullUrl(TestSupport.ProviderPage),
				new[] { protocol.ClaimedIdentifierServiceTypeURI },
				10,
				10
				);
			return ep;
		}
Esempio n. 3
0
		void parameterizedProgrammaticTest(TestSupport.Scenarios scenario, ProtocolVersion version, 
			Identifier claimedUrl, AuthenticationRequestMode requestMode, 
			AuthenticationStatus expectedResult, bool provideStore) {

			var request = TestSupport.CreateRelyingPartyRequest(!provideStore, scenario, version);
			request.Mode = requestMode;

			var rpResponse = TestSupport.CreateRelyingPartyResponseThroughProvider(request, 
				opReq => opReq.IsAuthenticated = expectedResult == AuthenticationStatus.Authenticated);
			Assert.AreEqual(expectedResult, rpResponse.Status);
			Assert.AreEqual(claimedUrl, rpResponse.ClaimedIdentifier);
		}
Esempio n. 4
0
 public PliskyToolTests()
 {
     uth = new UnitTestHelper();
     ts  = new TestSupport(uth);
 }
Esempio n. 5
0
		void parameterizedTest(TestSupport.Scenarios scenario, ProtocolVersion version,
			AuthenticationRequestMode requestMode, AuthenticationStatus expectedResult) {
			Identifier claimedId = TestSupport.GetMockIdentifier(scenario, version);
			parameterizedProgrammaticTest(scenario, version, claimedId, requestMode, expectedResult, true);
			parameterizedProgrammaticTest(scenario, version, claimedId, requestMode, expectedResult, false);
		}
Esempio n. 6
0
 public void SetUp()
 {
     Context.Replace(engine = new Fakes.FakeEngine(new[] { typeof(DecoratedItem), typeof(DecoratedItem2) }));
     engine.AddComponentInstance <ITemplateAggregator>(new TemplateAggregator(engine.Definitions, new ITemplateProvider[] { new TemplateProvider(TestSupport.SetupContentActivator(), map = new DefinitionMap()) }));
 }
Esempio n. 7
0
 public override void SetUp()
 {
     base.SetUp();
     base.parser = parser = TestSupport.Setup(persister, wrapper, host);
     CreateDefaultStructure();
 }
Esempio n. 8
0
 public void TestCharArray(ByteOrder order)
 {
     AssertSerialization(TestSupport.RandomArray(TestSupport.RandomChar), order);
 }
Esempio n. 9
0
 public void TestBooleanArray(ByteOrder order)
 {
     AssertSerialization(TestSupport.RandomArray(TestSupport.RandomBool), order);
 }
Esempio n. 10
0
 public void TestStringArray(ByteOrder order)
 {
     AssertSerialization(TestSupport.RandomArray(TestSupport.RandomString), order);
 }
Esempio n. 11
0
        public override void SetUp()
        {
            base.SetUp();

            var types = new[] { typeof(Items.PageItem), typeof(Items.DataItem) };

            versionRepository = TestSupport.CreateVersionRepository(types);
            var versions = TestSupport.SetupVersionManager(persister, versionRepository);
            //definitions = TestSupport.SetupDefinitions(types);

            ITemplateAggregator templates;
            ContentActivator    activator;

            TestSupport.Setup(out definitions, out templates, out activator, types);
            creator = new CreateUrlProvider(
                persister,
                new EditUrlManager(null, new EditSection()),
                definitions,
                templates,
                activator,
                new Navigator(persister, TestSupport.SetupHost(), new VirtualNodeFactory(), TestSupport.SetupContentSource()),
                versions,
                versionRepository);
            request = new NameValueCollection();

            root = CreateOneItem <Items.PageItem>(0, "root", null);
        }
Esempio n. 12
0
 protected virtual UrlParser CreateUrlParser()
 {
     return(TestSupport.Setup(persister, wrapper, host));
 }
Esempio n. 13
0
        public override void SetUp()
        {
            base.SetUp();

            TestSupport.Setup(out persister, sessionProvider, schemaCreator);
        }
Esempio n. 14
0
 public virtual void TestFixtureSetup()
 {
     TestSupport.Setup(out definitions, out activator, out notifier, out sessionProvider, out finder, out schemaCreator, out proxyFactory, persistedTypes);
 }
Esempio n. 15
0
 public FakeVersionManager(FakeContentItemRepository itemRepository, StateChanger stateChanger, params Type[] definitionTypes)
     : base(TestSupport.CreateVersionRepository(definitionTypes), itemRepository, stateChanger, new N2.Configuration.EditSection())
 {
     this.itemRepository = itemRepository;
 }
Esempio n. 16
0
 public virtual void TestFixtureSetUp()
 {
     definitions = TestSupport.SetupDefinitions(typeof(PersistableItem), typeof(PersistableItem2), typeof(PersistablePart));
 }
Esempio n. 17
0
        public override void SetUp()
        {
            base.SetUp();

            var types = new[] { typeof(Items.PageItem), typeof(Items.DataItem) };

            versionRepository = TestSupport.CreateVersionRepository(ref persister, ref activator, types);
            versions          = TestSupport.SetupVersionManager(persister, versionRepository);
            mover             = new ItemMover(
                persister,
                new Navigator(persister, TestSupport.SetupHost(), new VirtualNodeFactory(), TestSupport.SetupContentSource()),
                new FakeIntegrityManager(),
                versions,
                versionRepository);
            request = new NameValueCollection();

            root = CreateOneItem <Items.PageItem>(0, "root", null);
        }
Esempio n. 18
0
 public void TestIntegerArray(ByteOrder order)
 {
     AssertSerialization(TestSupport.RandomArray(TestSupport.RandomInt), order);
 }
        public override void SetUp()
        {
            base.SetUp();

            builder = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase <IUniquelyNamed>[] { new TitleTransformer() }, TestSupport.SetupEngineSection());
        }
Esempio n. 20
0
        public void TestJavaClass(ByteOrder order)
        {
            var javaEnum = new JavaClass(TestSupport.RandomString());

            AssertSerialization(javaEnum, order);
        }
        public void CreateRequestNullIdentifier()
        {
            var consumer = TestSupport.CreateRelyingParty(null);

            consumer.CreateRequest(null, realm, returnTo);
        }
Esempio n. 22
0
 public void TestByte(ByteOrder order)
 {
     AssertSerialization(TestSupport.RandomByte(), order);
 }
        public void CreateRequestNullReturnTo()
        {
            var consumer = TestSupport.CreateRelyingParty(null);

            consumer.CreateRequest("=someEndpoint", realm, null);
        }
Esempio n. 24
0
 public void TestDoubleArray(ByteOrder order)
 {
     AssertSerialization(TestSupport.RandomArray(TestSupport.RandomDouble), order);
 }
        public void CreateRequestsPerformsImmediateValidation()
        {
            var consumer = TestSupport.CreateRelyingParty(null);

            consumer.CreateRequests(null, realm, returnTo);
        }
Esempio n. 26
0
 public void Setup()
 {
     TestSupport.ClearCreatedFiles();
     TestSupport.DiffAction = new InvokeWinMerge();
 }
Esempio n. 27
0
        void ReCreateDispatcherWithConfig(HostSection config)
        {
            IPersister persister = null;

            dispatcher = new RequestPathProvider(webContext, parser, errorHandler, config, TestSupport.CreateDraftRepository(ref persister));

            handler = new FakeRequestLifeCycleHandler(webContext, dispatcher, adapterProvider, errorHandler,
                                                      new ConfigurationManagerWrapper {
                Sections = new ConfigurationManagerWrapper.ContentSectionTable(config, null, null, new EditSection())
            });
        }
Esempio n. 28
0
 public void Initialize()
 {
     ts    = new TestSupport();
     mysql = new MySqlHelper();
 }
 public static void TestCleanup()
 {
     _testSupport.SupportCleanup();
     _testSupport = null;
 }
Esempio n. 30
0
        public async Task AddProjectSettingsGoodPath()
        {
            const string testText = "Project settings test 1";

            Msg.Title(testText, "Add project settings for a standard project");
            var ts          = new TestSupport();
            var customerUid = Guid.NewGuid();
            var response    = ExecutorTestFixture.CreateCustomerProject(customerUid.ToString(), testText, Boundaries.Boundary1);

            ts.ProjectUid = new Guid(response.Result.Id);

            // Now create the settings
            var projectSettings1 = "{ useMachineTargetPassCount: false,customTargetPassCountMinimum: 5,customTargetPassCountMaximum: 7,useMachineTargetTemperature: false,customTargetTemperatureMinimum: 75," +
                                   "customTargetTemperatureMaximum: 150,useMachineTargetCmv: false,customTargetCmv: 77,useMachineTargetMdp: false,customTargetMdp: 88,useDefaultTargetRangeCmvPercent: false," +
                                   "customTargetCmvPercentMinimum: 75,customTargetCmvPercentMaximum: 105,useDefaultTargetRangeMdpPercent: false,customTargetMdpPercentMinimum: 85,customTargetMdpPercentMaximum: 115," +
                                   "useDefaultTargetRangeSpeed: false,customTargetSpeedMinimum: 10,customTargetSpeedMaximum: 30,useDefaultCutFillTolerances: false,customCutFillTolerances: [3, 2, 1, 0, -1, -2, -3]," +
                                   "useDefaultVolumeShrinkageBulking: false, customShrinkagePercent: 5, customBulkingPercent: 7.5}";

            projectSettings1 = projectSettings1.Replace(" ", string.Empty);

            var projSettings1 = ProjectSettingsRequest.CreateProjectSettingsRequest(ts.ProjectUid.ToString(), projectSettings1, ProjectSettingsType.Targets);
            var configJson1   = JsonConvert.SerializeObject(projSettings1, new JsonSerializerSettings {
                DateTimeZoneHandling = DateTimeZoneHandling.Unspecified
            });
            var putresponse1 = await ts.CallProjectWebApi("api/v4/projectsettings", HttpMethod.Put, configJson1, customerUid.ToString());

            var putobjresp1 = JsonConvert.DeserializeObject <ProjectSettingsResult>(putresponse1);

            var tempSettings = JsonConvert.SerializeObject(putobjresp1.Settings).Replace("\"", string.Empty);

            //Assert.Equal(projectSettings1, putobjresp1.settings, "Actual project settings 1 do not match expected");
            Assert.Equal(projectSettings1, tempSettings);
            Assert.Equal(ts.ProjectUid.ToString(), putobjresp1.ProjectUid);

            // create settings for a second user for same project
            var projectSettings2 = "{ useMachineTargetPassCount: false,customTargetPassCountMinimum: 6,customTargetPassCountMaximum: 6,useMachineTargetTemperature: false,customTargetTemperatureMinimum: 70," +
                                   "customTargetTemperatureMaximum: 140,useMachineTargetCmv: false,customTargetCmv: 71,useMachineTargetMdp: false,customTargetMdp: 81,useDefaultTargetRangeCmvPercent: false," +
                                   "customTargetCmvPercentMinimum: 80,customTargetCmvPercentMaximum: 100,useDefaultTargetRangeMdpPercent: false,customTargetMdpPercentMinimum: 80,customTargetMdpPercentMaximum: 100," +
                                   "useDefaultTargetRangeSpeed: false,customTargetSpeedMinimum: 12,customTargetSpeedMaximum: 27,useDefaultCutFillTolerances: false,customCutFillTolerances: [3, 2, 1, 0, -1, -2, -3]," +
                                   "useDefaultVolumeShrinkageBulking: false, customShrinkagePercent: 6, customBulkingPercent: 5.2}";

            projectSettings2 = projectSettings2.Replace(" ", string.Empty);

            var projSettings2 = ProjectSettingsRequest.CreateProjectSettingsRequest(ts.ProjectUid.ToString(), projectSettings2, ProjectSettingsType.Targets);
            var configJson2   = JsonConvert.SerializeObject(projSettings2, new JsonSerializerSettings {
                DateTimeZoneHandling = DateTimeZoneHandling.Unspecified
            });
            var putresponse2 = await ts.CallProjectWebApi("api/v4/projectsettings", HttpMethod.Put, configJson2, customerUid.ToString(), RestClient.ANOTHER_JWT);

            var putobjresp2 = JsonConvert.DeserializeObject <ProjectSettingsResult>(putresponse2);

            tempSettings = JsonConvert.SerializeObject(putobjresp2.Settings).Replace("\"", string.Empty);

            //Assert.Equal(projectSettings2, putobjresp2.setting);
            Assert.Equal(projectSettings2, tempSettings);
            Assert.Equal(ts.ProjectUid.ToString(), putobjresp2.ProjectUid);

            // get call
            var getresponse1 = await ts.CallProjectWebApi($"api/v4/projectsettings/{ts.ProjectUid}", HttpMethod.Get, null, customerUid.ToString());

            var getobjresp1 = JsonConvert.DeserializeObject <ProjectSettingsResult>(getresponse1);

            tempSettings = JsonConvert.SerializeObject(getobjresp1.Settings).Replace("\"", string.Empty);

            //Assert.Equal(projectSettings1, getobjresp1.settings);
            Assert.Equal(projectSettings1, tempSettings);
            Assert.Equal(ts.ProjectUid.ToString(), getobjresp1.ProjectUid);
        }
Esempio n. 31
0
        public override void SetUp()
        {
            base.SetUp();

            CreatePersister();

            parser = mocks.StrictMock <IUrlParser>();

            ITypeFinder       typeFinder = CreateTypeFinder();
            DefinitionBuilder builder    = new DefinitionBuilder(new DefinitionMap(), typeFinder, new TransformerBase <IUniquelyNamed> [0], TestSupport.SetupEngineSection());
            IItemNotifier     notifier   = mocks.DynamicMock <IItemNotifier>();

            mocks.Replay(notifier);
            var changer = new N2.Edit.Workflow.StateChanger();

            activator       = new ContentActivator(changer, notifier, new EmptyProxyFactory());
            definitions     = new DefinitionManager(new[] { new DefinitionProvider(builder) }, activator, changer, new DefinitionMap());
            integrityManger = new IntegrityManager(definitions, persister.Repository, parser);
            IntegrityEnforcer enforcer = new IntegrityEnforcer(persister, integrityManger, activator);

            enforcer.Start();
        }
 public static void ClassInitialize(TestContext context)
 {
     _testSupport = new TestSupport();
 }
Esempio n. 33
0
        public void TestInvalidationDistortionSequenceAndGuid()
        {
            var mapName  = "nearCachedMapDistortion";
            var mapSize  = 100000;
            var stopTest = new AtomicBoolean(false);

            Assert.True(PopulateMapFromServer(mapName, mapSize).Success);
            var clientMap = Client.GetMap <int, int>(mapName);

            var populateNearCache = new Thread(() =>
            {
                while (!stopTest.Get())
                {
                    for (int i = 0; i < mapSize; i++)
                    {
                        clientMap.Get(i);
                    }
                }
            });

            var distortSequence = new Thread(() =>
            {
                while (!stopTest.Get())
                {
                    var response = DistortRandomPartitionSequence(mapName);
                    Assert.True(response.Success, response.Message);
                    Thread.Sleep(TimeSpan.FromSeconds(1));
                }
            });

            var distortUuid = new Thread(() =>
            {
                while (!stopTest.Get())
                {
                    var response = DistortRandomPartitionUuid();
                    Assert.True(response.Success, response.Message);
                    Thread.Sleep(TimeSpan.FromSeconds(5));
                }
            });

            var putOnMember = new Thread(() =>
            {
                var random = new Random();
                // change some data
                while (!stopTest.Get())
                {
                    var key   = random.Next(mapSize);
                    var value = random.Next(int.MaxValue);
                    Assert.True(PutOnMember(key, value, mapName).Success);
                    Thread.Sleep(100);
                }
            });

            // start threads
            putOnMember.Start();
            populateNearCache.Start();
            distortSequence.Start();
            distortUuid.Start();

            Thread.Sleep(TimeSpan.FromSeconds(60));

            // stop threads
            stopTest.Set(true);
            distortUuid.Join();
            distortSequence.Join();
            populateNearCache.Join();
            putOnMember.Join();

            TestSupport.AssertTrueEventually(() =>
            {
                var allValueFromMember = GetAllValueFromMember(mapSize, mapName);
                for (int i = 0; i < mapSize; i++)
                {
                    var valueSeenFromMember = allValueFromMember[i] as int?;
                    var valueSeenFromClient = clientMap.Get(i);
                    Assert.AreEqual(valueSeenFromMember, valueSeenFromClient);
                }
            });
        }
Esempio n. 34
0
 public void TestFloatArray(ByteOrder order)
 {
     AssertSerialization(TestSupport.RandomArray(TestSupport.RandomFloat), order);
 }
Esempio n. 35
0
 public void TestFixtureSetUp()
 {
     definitions = TestSupport.SetupDefinitions(typeof(PersistableItem), typeof(PersistableItem2), typeof(PersistablePart));
     server      = new IndexerServer();
     server.Start();
 }