Exemplo n.º 1
0
        public void DicomInstancesTransferredAuditTest()
        {
            AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
                                                                          new IPEndPoint(new IPAddress(new byte[] { 2, 2, 2, 2 }),
                                                                                         2));

            parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] { 1, 1, 1, 1 }),
                                                 1);


            DicomInstancesTransferredAuditHelper helper =
                new DicomInstancesTransferredAuditHelper(
                    new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
                    EventIdentificationContentsEventOutcomeIndicator.Success,
                    EventIdentificationContentsEventActionCode.R,
                    parms);

            DicomAttributeCollection collection = new DicomAttributeCollection();

            SetupMultiframeXA(collection, 128, 128, 2);
            helper.AddPatientParticipantObject(new AuditPatientParticipantObject(collection));
            helper.AddStorageInstance(new StorageInstance(new DicomMessage(new DicomAttributeCollection(), collection)));

            string output = helper.Serialize(true);

            Assert.IsNotEmpty(output);

            Assert.Ignore("Skipping schema validation due to schema bug #9455");
            Exception exception;

            if (!helper.Verify(out exception))
            {
                throw exception;
            }
        }
        public static void InstancesTransferredAuditLogger(DicomScpContext context, ServerAssociationParameters assocParams, List <StorageInstance> instances)
        {
            Dictionary <string, AuditPatientParticipantObject> list = new Dictionary <string, AuditPatientParticipantObject>();

            foreach (StorageInstance instance in instances)
            {
                string key = instance.PatientId + instance.PatientsName;
                if (!list.ContainsKey(key))
                {
                    AuditPatientParticipantObject patient =
                        new AuditPatientParticipantObject(instance.PatientsName, instance.PatientId);
                    list.Add(key, patient);
                }
            }

            foreach (AuditPatientParticipantObject patient in list.Values)
            {
                // Audit Log
                DicomInstancesTransferredAuditHelper helper =
                    new DicomInstancesTransferredAuditHelper(ServerPlatform.AuditSource,
                                                             EventIdentificationContentsEventOutcomeIndicator.Success,
                                                             EventIdentificationContentsEventActionCode.E,
                                                             assocParams);

                foreach (StorageInstance instance in instances)
                {
                    if (patient.PatientId.Equals(instance.PatientId) &&
                        patient.PatientsName.Equals(instance.PatientsName))
                    {
                        helper.AddStorageInstance(instance);
                    }
                }

                ServerPlatform.LogAuditMessage(helper);
            }
        }
Exemplo n.º 3
0
		public void DicomInstancesTransferredAuditTest()
		{
			AssociationParameters parms = new ClientAssociationParameters("CLIENT", "SERVER",
			                                                              new IPEndPoint(new IPAddress(new byte[] {2, 2, 2, 2}),
			                                                                             2));
			parms.LocalEndPoint = new IPEndPoint(new IPAddress(new byte[] {1, 1, 1, 1}),
			                                     1);


			DicomInstancesTransferredAuditHelper helper =
				new DicomInstancesTransferredAuditHelper(
					new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
					EventIdentificationTypeEventOutcomeIndicator.Success,
					EventIdentificationTypeEventActionCode.R,
					parms);

			DicomAttributeCollection collection = new DicomAttributeCollection();
			SetupMultiframeXA(collection,128,128,2);
			helper.AddPatientParticipantObject(new AuditPatientParticipantObject(collection));
			helper.AddStorageInstance(new StorageInstance(new DicomMessage(new DicomAttributeCollection(), collection)));

			string output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			string failure;
			bool result = helper.Verify(out failure);

			Assert.IsTrue(result, failure);
		}