예제 #1
0
        private async void Connect()
        {
            if (_connector == null)
            {
                _connector = new Connector();
            }

            if (!_connector.Connect())
            {
                MessageBox.Show("Please click Connect to try connecting to Dynamics CRM again. A valid connection is required.");
                return;
            }

            IsBusy      = true;
            IsConnected = false;

            if (_importLogic == null)
            {
                _importLogic = new ImportLogic(_connector.OrganizationServiceProxy);
            }
            else
            {
                _importLogic.OrganizationService = _connector.OrganizationServiceProxy;
            }

            ConnectText = "Change from " + _connector.OrganizationFriendlyName;

            await LoadExportData();

            IsConnected = true;
            IsBusy      = false;
        }
예제 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSplitUpRelationshipTypesInBatches()
        public virtual void ShouldSplitUpRelationshipTypesInBatches()
        {
            // GIVEN
            int denseNodeThreshold      = 5;
            int numberOfNodes           = 100;
            int numberOfTypes           = 10;
            NodeRelationshipCache cache = new NodeRelationshipCache(NumberArrayFactory.HEAP, denseNodeThreshold);

            cache.NodeCount = numberOfNodes + 1;
            Direction[] directions = Direction.values();
            for (int i = 0; i < numberOfNodes; i++)
            {
                int count = Random.Next(1, denseNodeThreshold * 2);
                cache.setCount(i, count, Random.Next(numberOfTypes), Random.among(directions));
            }
            cache.CountingCompleted();
            IList <RelationshipTypeCount> types = new List <RelationshipTypeCount>();
            int numberOfRelationships           = 0;

            for (int i = 0; i < numberOfTypes; i++)
            {
                int count = Random.Next(1, 100);
                types.Add(new RelationshipTypeCount(i, count));
                numberOfRelationships += count;
            }
            types.sort((t1, t2) => Long.compare(t2.Count, t1.Count));
            DataStatistics typeDistribution = new DataStatistics(0, 0, types.ToArray());

            {
                // WHEN enough memory for all types
                long memory   = cache.CalculateMaxMemoryUsage(numberOfRelationships) * numberOfTypes;
                int  upToType = ImportLogic.NextSetOfTypesThatFitInMemory(typeDistribution, 0, memory, cache.NumberOfDenseNodes);

                // THEN
                assertEquals(types.Count, upToType);
            }

            {
                // and WHEN less than enough memory for all types
                long memory           = cache.CalculateMaxMemoryUsage(numberOfRelationships) * numberOfTypes / 3;
                int  startingFromType = 0;
                int  rounds           = 0;
                while (startingFromType < types.Count)
                {
                    rounds++;
                    startingFromType = ImportLogic.NextSetOfTypesThatFitInMemory(typeDistribution, startingFromType, memory, cache.NumberOfDenseNodes);
                }
                assertEquals(types.Count, startingFromType);
                assertThat(rounds, greaterThan(1));
            }
        }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void closeImporterWithoutDiagnosticState() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CloseImporterWithoutDiagnosticState()
        {
            ExecutionMonitor monitor = mock(typeof(ExecutionMonitor));

            using (BatchingNeoStores stores = batchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), NULL, Storage.directory().directory(), defaultFormat(), DEFAULT, Instance, EMPTY, defaults()))
            {
                //noinspection EmptyTryBlock
                using (ImportLogic logic = new ImportLogic(Storage.directory().directory(), Storage.fileSystem(), stores, DEFAULT, Instance, monitor, defaultFormat(), NO_MONITOR))
                {
                    // nothing to run in this import
                    logic.Success();
                }
            }

            verify(monitor).done(eq(true), anyLong(), contains("Data statistics is not available."));
        }
예제 #4
0
        protected override void ProcessRecord()
        {
            try
            {
                var service = ConnectToCrm();

                WriteDebug("Instantiating logic...");
                var logic = new ImportLogic(service);

                WriteDebug("Loading teams...");
                var teams = logic.DeserializeTeamsFromFile(FileName);

                WriteDebug("Upserting teams...");
                logic.Import(teams);
            }
            catch (Exception ex)
            {
                ThrowTerminatingError(new ErrorRecord(ex, ex.GetType().Name, ErrorCategory.NotSpecified, null));
            }
        }
예제 #5
0
        public void TestInitialize()
        {
            area = new AreaEntity
            {
                Id     = 1,
                Name   = "Limpieza",
                Topics = new List <TopicEntity>()
            };

            topic = new TopicEntity
            {
                Id           = 1,
                Name         = "Contenedores de basura",
                AreaEntityId = 1,
                RequestTypes = new List <TypeReqEntity>()
            };

            type = new TypeReqEntity
            {
                Id               = 1,
                Name             = "Roto",
                AdditionalFields = new List <AdditionalFieldEntity>(),
                TopicEntityId    = 1
            };

            unitOfWork      = new Mock <IUnitOfWork>();
            areaRepository  = new Mock <IRepository <AreaEntity> >();
            topicRepository = new Mock <IRepository <TopicEntity> >();
            typeRepository  = new Mock <IRepository <TypeReqEntity> >();
            unitOfWork.Setup(u => u.AreaRepository).Returns(areaRepository.Object);
            unitOfWork.Setup(u => u.TopicRepository).Returns(topicRepository.Object);
            unitOfWork.Setup(u => u.TypeReqRepository).Returns(typeRepository.Object);

            var configuration = new Mock <IConfiguration>();

            configuration.Setup(c => c["DataImport:Path"]).Returns(".\\Assemblies\\DataImport");
            areaLogic   = new AreaLogic(unitOfWork.Object);
            topicLogic  = new TopicLogic(unitOfWork.Object);
            typeLogic   = new TypeReqLogic(unitOfWork.Object);
            importLogic = new ImportLogic(unitOfWork.Object, configuration.Object, areaLogic, topicLogic, typeLogic);
        }
예제 #6
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldUseDataStatisticsCountsForPrintingFinalStats() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldUseDataStatisticsCountsForPrintingFinalStats()
        {
            // given
            ExecutionMonitor monitor = mock(typeof(ExecutionMonitor));

            using (BatchingNeoStores stores = batchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), NULL, Storage.directory().directory(), defaultFormat(), DEFAULT, Instance, EMPTY, defaults()))
            {
                // when
                RelationshipTypeCount[] relationshipTypeCounts = new RelationshipTypeCount[]
                {
                    new RelationshipTypeCount(0, 33),
                    new RelationshipTypeCount(1, 66)
                };
                DataStatistics dataStatistics = new DataStatistics(100123, 100456, relationshipTypeCounts);
                using (ImportLogic logic = new ImportLogic(Storage.directory().directory(), Storage.fileSystem(), stores, DEFAULT, Instance, monitor, defaultFormat(), NO_MONITOR))
                {
                    logic.PutState(dataStatistics);
                    logic.Success();
                }

                // then
                verify(monitor).done(eq(true), anyLong(), contains(dataStatistics.ToString()));
            }
        }
예제 #7
0
 public CsvImportController(ImportLogic importLogic)
 {
     _importLogic = importLogic;
 }
예제 #8
0
 public ImportExcel()
 {
     InitializeComponent();
     importLogic = new ImportLogic();
 }
예제 #9
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void doImport(org.neo4j.unsafe.impl.batchimport.input.Input input) throws java.io.IOException
        public override void DoImport(Input input)
        {
            using (BatchingNeoStores store = instantiateNeoStores(_fileSystem, _directoryStructure.databaseDirectory(), _externalPageCache, _recordFormats, _config, _logService, _additionalInitialIds, _dbConfig, _jobScheduler), ImportLogic logic = new ImportLogic(_directoryStructure.databaseDirectory(), _fileSystem, store, _config, _logService, _executionMonitor, _recordFormats, _monitor))
            {
                store.CreateNew();
                logic.Initialize(input);

                logic.ImportNodes();
                logic.PrepareIdMapper();
                logic.ImportRelationships();
                logic.CalculateNodeDegrees();
                logic.LinkRelationshipsOfAllTypes();
                logic.DefragmentRelationshipGroups();
                logic.BuildCountsStore();

                logic.Success();
            }
        }