Conversation
… unit tests for builder structure
…ativeEngineBuilder
… to use the TacEngineBuilder. This highlights a failure which needs to be addressed.
jwrosewell
left a comment
There was a problem hiding this comment.
See the changes in the commit I've made to this branch.
I don't understand why the test isn't using the builder. I changed to use the builder for TacEngine and it requires parameters that are unneeded. This suggests the base class is wrong. It is just a simple FlowElement.
I have removed duplicate code and added a place holder for the new problem associated with the builders for Native and TAC using the same element key value.
| base(loggerFactory, dataUpdateService) | ||
| { | ||
| _elementDataKey = "native-profiles"; | ||
| _elementDataKey = "hardware"; |
There was a problem hiding this comment.
What happens if evidence is provided for Native and TAC in the same request? Sharing the same element key seems like it would create problems.
There was a problem hiding this comment.
Currently, if we make three separate requests — one with TAC evidence, one with Native evidence, and one with both — all profiles will be created under the hardware property.
For example: https://cloud.51degrees.com/api/v4/{resourceKey}.json?TAC=35189711&nativemodel=iPhone11,8
Therefore, to maintain backward compatibility, _elementDataKey is set to "hardware" in both NativeEngineBuilder.cs and TacEngineBuilder.cs.
Please let me know if I misunderstood anything or if this needs correction.
There was a problem hiding this comment.
Per James: please complete the combined test that was added as a stub in James's commit - so that we confirm that it works exactly as is in the current cloud so we preserve the logic.
| base(loggerFactory, dataUpdateService) | ||
| { | ||
| _elementDataKey = "tac-profiles"; | ||
| _elementDataKey = "hardware"; |
There was a problem hiding this comment.
See comment against the native engine.
There was a problem hiding this comment.
Currently, if we make three separate requests — one with TAC evidence, one with Native evidence, and one with both — all profiles will be created under the hardware property.
For example: https://cloud.51degrees.com/api/v4/{resourceKey}.json?TAC=35189711&nativemodel=iPhone11,8
Therefore, to maintain backward compatibility, _elementDataKey is set to "hardware" in both NativeEngineBuilder.cs and TacEngineBuilder.cs.
Please let me know if I misunderstood anything or if this needs correction.
|
Overall I think deriving the base class from |
justadreamer
left a comment
There was a problem hiding this comment.
still some cleanup is left to do
| } | ||
| if (indexedProperties == null || indexedProperties.Count == 0) |
There was a problem hiding this comment.
was moved into the base class in pipeline-dotnet, so this can be removed here
|
|
||
| /// <inheritdoc/> | ||
| public override TBuilder SetPerformanceProfile( | ||
| public TBuilder SetPerformanceProfile( |
There was a problem hiding this comment.
This should be removed, we are getting data from the upstream engine in the pipeline.
| /// <returns>This builder.</returns> | ||
| public PropertyKeyedDeviceEngineBaseBuilder<TBuilder, TEngine> | ||
| SetConcurrency(ushort concurrency) | ||
| public TBuilder SetConcurrency(ushort concurrency) |
There was a problem hiding this comment.
see above re: SetPerformanceProfile
| _requiredProperties; | ||
|
|
||
| public IReadOnlyList<IAspectEngineDataFile> DataFiles => throw new NotImplementedException(); | ||
| public IReadOnlyList<IAspectEngineDataFile> DataFiles => []; |
There was a problem hiding this comment.
why is this still needed? since we inherit from AspectEngineBase rather than OnPremiseAspectEngineBase
| /// Returns <see langword="null"/>. <see cref="RobotsTxtEngine"/> has no | ||
| /// data files of its own so there is no temp directory to configure. | ||
| /// </summary> | ||
| public string TempDataDirPath => null; |
There was a problem hiding this comment.
same question as re: DataFiles?
| /// it derives its data from <see cref="DeviceDetectionHashEngine"/> via | ||
| /// <see cref="AddPipeline"/> and has nothing to reload from disk. | ||
| /// </summary> | ||
| public void RefreshData(string dataFileIdentifier) { } |
There was a problem hiding this comment.
RefreshData probably needs to go too?
| /// Returns <see langword="null"/>. <see cref="RobotsTxtEngine"/> has no | ||
| /// data files, so there is no metadata to return for any identifier. | ||
| /// </summary> | ||
| public IAspectEngineDataFile GetDataFileMetaData( |
There was a problem hiding this comment.
this all needs to be cleaned out
Unit Tests - Mac_arm64_Release 4 files ±0 4 suites ±0 2m 8s ⏱️ ±0s Results for commit 9210209. ± Comparison against base commit 96ce45d. This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.This pull request removes 3 skipped tests and adds 1 skipped test. Note that renamed tests count towards both. |
Unit Tests - Mac_x64_Release 4 files ±0 4 suites ±0 2m 25s ⏱️ -7s Results for commit 9210209. ± Comparison against base commit 96ce45d. This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.This pull request removes 3 skipped tests and adds 1 skipped test. Note that renamed tests count towards both. |
Unit Tests - Ubuntu_x64_Release 4 files ±0 4 suites ±0 1m 40s ⏱️ -4s Results for commit 9210209. ± Comparison against base commit 96ce45d. This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.This pull request removes 3 skipped tests and adds 1 skipped test. Note that renamed tests count towards both. |
Unit Tests - Ubuntu_x64_Debug 4 files ±0 4 suites ±0 1m 40s ⏱️ -7s Results for commit 9210209. ± Comparison against base commit 96ce45d. This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.This pull request removes 3 skipped tests and adds 1 skipped test. Note that renamed tests count towards both. |
Unit Tests - Ubuntu_ARM_Release 4 files ±0 4 suites ±0 1m 37s ⏱️ +4s Results for commit 9210209. ± Comparison against base commit 96ce45d. This pull request removes 3 and adds 5 tests. Note that renamed tests count towards both.This pull request removes 3 skipped tests and adds 1 skipped test. Note that renamed tests count towards both. |
Problem
PipelineBuilder.BuildFromConfigurationusesGetRuntimeMethods()to locate a builder'sBuild()method at runtime. When a builder declarespublic new Build()to hide the inheritedprotected virtual Build()fromSingleFileAspectEngineBuilderBase, reflection sees both methods and throws a "multiple matching Build methods" error at startup.Changes
RobotsTxtBuilderand PropertyKeyedDeviceEngineBaseBuilder: changed public new Build() to protected override Build() so the base method is replaced rather than hidden — reflection now finds exactly one parameterless Build()RobotsTxtEngine: completed the IOnPremiseAspectEngine members that previously threw NotImplementedException:RefreshData(both overloads) — no-op; data comes from DeviceDetectionHashEngine via AddPipeline, not a fileGetDataFileMetaData— returns null; no data files are registeredAddDataFile— throws NotSupportedException; data files are not applicableTempDataDirPath— changed to nullTests
RobotsTxtBuilderTestsandPropertyKeyedBuilderTests: regression tests that callGetRuntimeMethods()directly and assert exactly one parameterlessBuild()is visible — will fail if public new is reintroducedUtils.AssertSingleParameterlessBuild: shared helper inTestHelpersfor reuse across builder test classes