-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
225 changed files
with
4,536 additions
and
1,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
itext.tests/itext.commons.tests/itext/commons/actions/ProductEventHandlerIntegrationTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2022 iText Group NV | ||
Authors: iText Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System.IO; | ||
using iText.Commons.Actions.Confirmations; | ||
using iText.Commons.Actions.Sequence; | ||
using iText.Commons.Ecosystem; | ||
using iText.Commons.Utils; | ||
using iText.Test; | ||
|
||
namespace iText.Commons.Actions { | ||
public class ProductEventHandlerIntegrationTest : ExtendedITextTest { | ||
private TextWriter outBackup; | ||
|
||
[NUnit.Framework.SetUp] | ||
public virtual void InitTest() { | ||
outBackup = System.Console.Out; | ||
ProductEventHandler.INSTANCE.ClearProcessors(); | ||
} | ||
|
||
[NUnit.Framework.TearDown] | ||
public virtual void AfterEach() { | ||
System.Console.SetOut(outBackup); | ||
ProductProcessorFactoryKeeper.RestoreDefaultProductProcessorFactory(); | ||
ProductEventHandler.INSTANCE.ClearProcessors(); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void RemoveAGPLLoggingTest() { | ||
MemoryStream testOut = new MemoryStream(); | ||
System.Console.SetOut(new FormattingStreamWriter(testOut)); | ||
|
||
EventManager.AcknowledgeAgplUsageDisableWarningMessage(); | ||
for (int i = 0; i < 10001; i++) { | ||
|
||
ProductEventHandler handler = ProductEventHandler.INSTANCE; | ||
|
||
SequenceId sequenceId = new SequenceId(); | ||
|
||
NUnit.Framework.Assert.IsTrue(handler.GetEvents(sequenceId).IsEmpty()); | ||
ITextTestEvent @event = new ITextTestEvent(sequenceId, null, "test-event", | ||
ProductNameConstant.ITEXT_CORE); | ||
EventManager.GetInstance().OnEvent(@event); | ||
|
||
ConfirmEvent confirmEvent = new ConfirmEvent(sequenceId, @event); | ||
EventManager.GetInstance().OnEvent(confirmEvent); | ||
|
||
NUnit.Framework.Assert.AreEqual(1, handler.GetEvents(sequenceId).Count); | ||
NUnit.Framework.Assert.IsTrue(handler.GetEvents(sequenceId)[0] is ConfirmedEventWrapper); | ||
NUnit.Framework.Assert.AreEqual(@event, ((ConfirmedEventWrapper)handler.GetEvents(sequenceId)[0]).GetEvent | ||
()); | ||
} | ||
using (var reader = new StreamReader(testOut)) | ||
{ | ||
NUnit.Framework.Assert.AreEqual("", reader.ReadToEnd()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
itext.tests/itext.commons.tests/itext/commons/actions/ProductProcessorFactoryKeeperTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2022 iText Group NV | ||
Authors: iText Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using iText.Commons.Actions.Processors; | ||
using iText.Test; | ||
|
||
namespace iText.Commons.Actions { | ||
public class ProductProcessorFactoryKeeperTest : ExtendedITextTest { | ||
[NUnit.Framework.TearDown] | ||
public virtual void AfterEach() { | ||
ProductProcessorFactoryKeeper.RestoreDefaultProductProcessorFactory(); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void GettingDefaultFactoryFromKeeper() { | ||
IProductProcessorFactory productProcessorFactory = ProductProcessorFactoryKeeper.GetProductProcessorFactory | ||
(); | ||
NUnit.Framework.Assert.IsTrue(productProcessorFactory is DefaultProductProcessorFactory); | ||
} | ||
|
||
[NUnit.Framework.Test] | ||
public virtual void RestoringDefaultFactory() { | ||
ProductProcessorFactoryKeeper.SetProductProcessorFactory(new UnderAgplProductProcessorFactory()); | ||
NUnit.Framework.Assert.IsTrue(ProductProcessorFactoryKeeper.GetProductProcessorFactory() is UnderAgplProductProcessorFactory | ||
); | ||
ProductProcessorFactoryKeeper.RestoreDefaultProductProcessorFactory(); | ||
NUnit.Framework.Assert.IsTrue(ProductProcessorFactoryKeeper.GetProductProcessorFactory() is DefaultProductProcessorFactory | ||
); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...text.commons.tests/itext/commons/actions/processors/DefaultProductProcessorFactoryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2022 iText Group NV | ||
Authors: iText Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using iText.Commons.Actions; | ||
using iText.Test; | ||
|
||
namespace iText.Commons.Actions.Processors { | ||
public class DefaultProductProcessorFactoryTest : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void CreateDefaultProductProcessor() { | ||
DefaultProductProcessorFactory defaultProductProcessorFactory = new DefaultProductProcessorFactory(); | ||
ITextProductEventProcessor processor = defaultProductProcessorFactory.CreateProcessor(ProductNameConstant. | ||
ITEXT_CORE); | ||
NUnit.Framework.Assert.IsNotNull(processor); | ||
NUnit.Framework.Assert.IsTrue(processor is DefaultITextProductEventProcessor); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...commons.tests/itext/commons/actions/processors/UnderAgplITextProductEventProcessorTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2022 iText Group NV | ||
Authors: iText Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using iText.Commons.Actions; | ||
using iText.Commons.Actions.Confirmations; | ||
using iText.Commons.Actions.Data; | ||
using iText.Commons.Actions.Sequence; | ||
using iText.Commons.Ecosystem; | ||
using iText.Test; | ||
|
||
namespace iText.Commons.Actions.Processors { | ||
public class UnderAgplITextProductEventProcessorTest : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void MessageIsNotLoggedTest() { | ||
UnderAgplITextProductEventProcessor testProcessor = new UnderAgplITextProductEventProcessor(ProductNameConstant | ||
.ITEXT_CORE); | ||
ITextTestEvent e = new ITextTestEvent(new SequenceId(), CommonsProductData.GetInstance(), null, "test event" | ||
); | ||
NUnit.Framework.Assert.DoesNotThrow(() => testProcessor.OnEvent(new ConfirmEvent(e))); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...xt.commons.tests/itext/commons/actions/processors/UnderAgplProductProcessorFactoryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
This file is part of the iText (R) project. | ||
Copyright (c) 1998-2022 iText Group NV | ||
Authors: iText Software. | ||
This program is offered under a commercial and under the AGPL license. | ||
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. | ||
AGPL licensing: | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using iText.Commons.Actions; | ||
using iText.Test; | ||
|
||
namespace iText.Commons.Actions.Processors { | ||
public class UnderAgplProductProcessorFactoryTest : ExtendedITextTest { | ||
[NUnit.Framework.Test] | ||
public virtual void CreateUnderAgplProductProcessor() { | ||
UnderAgplProductProcessorFactory underAgplProductProcessorFactory = new UnderAgplProductProcessorFactory(); | ||
ITextProductEventProcessor processor = underAgplProductProcessorFactory.CreateProcessor(ProductNameConstant | ||
.ITEXT_CORE); | ||
NUnit.Framework.Assert.IsNotNull(processor); | ||
NUnit.Framework.Assert.IsTrue(processor is UnderAgplITextProductEventProcessor); | ||
} | ||
} | ||
} |
Oops, something went wrong.