<commit_before>sap.ui.define([
	"sap/ui/core/UIComponent",
	"sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess",
	"sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant",
	"sap/ui/model/json/JSONModel",
	"sap/m/App",
	"sap/ui/core/mvc/XMLView"
], function(
	UIComponent,
	ABAPAccess,
	ABAPExtensibilityVariant,
	JSONModel,
	App,
	XMLView
) {
	"use strict";

	return UIComponent.extend("sap.ui.rta.test.additionalElements.Component", {
		metadata: {
			manifest: "json"
		},

		init: function() {
			this._enableExtensibility();

			this._bShowAdaptButton = !!this.getComponentData().showAdaptButton;
			UIComponent.prototype.init.apply(this, arguments);
		},

		/**
		 * Initialize the application
		 *
		 * @returns {sap.ui.core.Control} the content
		 */
		createContent: function() {
			var oApp = new App();

			var oModel = new JSONModel({
				showAdaptButton: this._bShowAdaptButton
			});
			this.oView = XMLView.create({
				id: this.createId("idMain1"),
				viewName: "sap.ui.rta.test.additionalElements.ComplexTest"
			}).then(function(oPage) {
				oPage.setModel(oModel, "view");
				oApp.addPage(oPage);
				return oPage;
			});

			return oApp;
		},

		/**
		 * Create stub answers from extensibility service
		 * @private
		 */
		_enableExtensibility: function () {
			var aExtensionData;
			ABAPAccess.getExtensionData = function(sServiceUri, sEntityTypeName, sEntitySetName) {
				aExtensionData = [{ businessContext: sEntityTypeName + " EntityTypeContext", description: "Other BusinessContext description" }, { businessContext: sEntitySetName + " EntitySetContext", description: "Some BusinessContext description"}];
				return Promise.resolve({
					extensionData: aExtensionData,
					entityType: sEntityTypeName,
					serviceVersion: "some dummy ServiceVersion 0.0.1",
					serviceName: sServiceUri
				});
			};

			ABAPExtensibilityVariant.prototype.getNavigationUri = function() {
				return Promise.resolve("./testdata/additionalElements/extensibilityTool.html");
			};

			ABAPAccess.isExtensibilityEnabled = function() {
				return Promise.resolve(true);
			};

			sap.ushell = Object.assign({}, sap.ushell, {
				Container: {
					getService: function() {
						return {
							hrefForExternal: function() {},
							parseShellHash: function() {},
							registerNavigationFilter: function() {},
							unregisterNavigationFilter: function() {},
							getUser: function() {},
							toExternal: function() {}
						};
					},
					getLogonSystem: function() {
						return {
							getName: function() {
								return "ABC";
							},
							getClient: function() {
								return "123";
							},
							isTrial: function() {
								return false;
							}
						};
					},
					setDirtyFlag: function() {
						return true;
					}
				}
			});<commit_msg>[INTERNAL] sap.ui.rta - Fix AdditionalElements Test App<commit_after>sap.ui.define([
	"sap/ui/core/UIComponent",
	"sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess",
	"sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant",
	"sap/ui/model/json/JSONModel",
	"sap/m/App",
	"sap/ui/core/mvc/XMLView"
], function(
	UIComponent,
	ABAPAccess,
	ABAPExtensibilityVariant,
	JSONModel,
	App,
	XMLView
) {
	"use strict";

	return UIComponent.extend("sap.ui.rta.test.additionalElements.Component", {
		metadata: {
			manifest: "json"
		},

		init: function() {
			this._enableExtensibility();

			this._bShowAdaptButton = !!this.getComponentData().showAdaptButton;
			UIComponent.prototype.init.apply(this, arguments);
		},

		/**
		 * Initialize the application
		 *
		 * @returns {sap.ui.core.Control} the content
		 */
		createContent: function() {
			var oApp = new App();

			var oModel = new JSONModel({
				showAdaptButton: this._bShowAdaptButton
			});
			this.oView = XMLView.create({
				id: this.createId("idMain1"),
				viewName: "sap.ui.rta.test.additionalElements.ComplexTest"
			}).then(function(oPage) {
				oPage.setModel(oModel, "view");
				oApp.addPage(oPage);
				return oPage;
			});

			return oApp;
		},

		/**
		 * Create stub answers from extensibility service
		 * @private
		 */
		_enableExtensibility: function () {
			var aExtensionData;
			ABAPAccess.getExtensionData = function(sServiceUri, sEntityTypeName, sEntitySetName) {
				aExtensionData = [{ businessContext: sEntityTypeName + " EntityTypeContext", description: "Other BusinessContext description" }, { businessContext: sEntitySetName + " EntitySetContext", description: "Some BusinessContext description"}];
				return Promise.resolve({
					extensionData: aExtensionData,
					entityType: sEntityTypeName,
					serviceVersion: "some dummy ServiceVersion 0.0.1",
					serviceName: sServiceUri
				});
			};

			ABAPExtensibilityVariant.prototype.getNavigationUri = function() {
				return Promise.resolve("./testdata/additionalElements/extensibilityTool.html");
			};

			ABAPAccess.isExtensibilityEnabled = function() {
				return Promise.resolve(true);
			};

			sap.ushell = Object.assign({}, sap.ushell, {
				Container: {
					getServiceAsync: function() {
						return Promise.resolve({
							hrefForExternal: function() {},
							parseShellHash: function() {},
							registerNavigationFilter: function() {},
							unregisterNavigationFilter: function() {},
							getUser: function() {},
							toExternal: function() {}
						});
					},
					//TODO: Remove when all calls are using Async
					getService: function() {
						return {
							hrefForExternal: function() {},
							parseShellHash: function() {},
							registerNavigationFilter: function() {},
							unregisterNavigationFilter: function() {},
							getUser: function() {},
							toExternal: function() {}
						};
					},
					getLogonSystem: function() {
						return {
							getName: function() {
								return "ABC";
							},
							getClient: function() {
								return "123";
							},
							isTrial: function() {
								return false;
							}
						};
					},
					setDirtyFlag: function() {
						return true;
					}
				}
			});
{'fraction_non_alphanumeric': 0.1331233421750663, 'fraction_numerical': 0.0023209549071618036, 'mean_word_length': 3.198329853862213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7324285', 'n_tokens_mistral': 2421, 'n_tokens_neox': 1834, 'n_words': 329}