Welcome to the new Schneider Electric Community

It's your place to connect with experts and peers, get continuous support, and share knowledge.

Close
Important Announcement: WELCOME to the new Schneider Electric Community! Community is now no longer part of Exchange, and is now rebranded under se.com. If you have any bookmarks and links saved, we request you to update them to ensure that you continue accessing our community from this new location. For any issues that you might encounter as part of this change, please reach out to SchneiderCommunity.Support@se.com, and the team will help to get your issues resolved.
Invite a Co-worker
Send a co-worker an invite to the Exchange portal.Just enter their email address and we’ll connect them to register. After joining, they will belong to the same company.
Send Invite Cancel
82614members
350254posts

Smart Connector: Tutorial Weather Extension Test Issue Error

SmartConnector Forum

Discussion of SmartConnector applications for integration of various other building management systems (BMS) into EcoStruxure Building Operation

Solved
Lydia
Lieutenant | EcoXpert Master Lieutenant | EcoXpert Master
Lieutenant | EcoXpert Master
0 Likes
1
273

Smart Connector: Tutorial Weather Extension Test Issue Error

I am currently working on the Weather Extension Smart Connector Tutorial. I was able to successfully download the GitHub sample examples, as advised in the Developer's Guide, but I am receiving multiple errors during testing (Developer's Guide: Step 6.3.6) *See SmartConnectorErrors.png*.

 

SetupProcessorFixture/ExecuteTest gave me this error: 

An error occurred while updating the entries. See the inner exception for details.
An error occurred while updating the entries. See the inner exception for details.
Cannot insert duplicate key row in object 'dbo.EwsServers' with unique index 'UQ_EwsServer_Address'. The duplicate key value is (http://localhost:56731/).
The statement has been terminated.
at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at Mongoose.Service.Data.MongooseDbContext.SaveChanges()
at Mongoose.Service.Data.MongooseDbContext.Mongoose.Common.Data.IDataSource<Mongoose.Ews.Server.Data.EwsServer>.Save()
at Mongoose.Ews.Server.Data.EwsServerDataAdapter.ConnectNew(String name, String address, String realm, String username, String password, Boolean autoStart, Boolean allowCookies, String assemblyFile, String className)
at SmartConnector.WeatherExtension.SetupProcessor.CreateEwsServer() in ...

Expected: True
But was: False

 

And I received this error at UpdateProcessorFixture/ExecuteTest :

Message:
Failed to connect to a valid EwsServerDataAdapter.
Expected: True
But was: False

 

I believe that I have a configuration issue of some kind, but I don't know where this configuration issue is and how to solve it.

 

Best,

 

Lydia

Attachments

Accepted Solutions
Nick-Iebba
Schneider Alumni (Retired)
Schneider Alumni (Retired)

Re: Smart Connector: Tutorial Weather Extension Test Issue Error

This issue has been solved. Posting back here for public education.

 

The main problem associated with this is that no connection info was set up in SmartConnector.WeatherExtension.Test's App.config file.

When you run the test, it will try to connect to Smart Connector and set up an EWS server; however, it cannot do that if no connection info was set up. You have to go to the install directory for Smart Connector (will probably be C:/Program Files (x86)/Schneider Electric/Smart Connector) and open "Mongoose.Service.exe.config" in a text editor. Locate the <connectionStrings> element and copy the entire contents between the opening XML tag and the closing one </connectionStrings>. Paste that into the App.Config file, and do the same for the encryption key setting (included in the <appsettings> element). Refer to the attached picture.

APPCONFIG.png

 

However, if freshly downloaded from the repo, you will run into more issues after this one because a couple things need to be set up that are not. The next error will have to do with licensing, most likely. You want to disable licensing, so that a valid license file will not be required to run the processor. Simply have this region of code uncommented in the WeatherProcessorBase class:

#region IsLicensed - Override

     public override bool IsLicensed => false;

#endregion 

 

After all this, one will run the ExecuteTest (for SetupProcessor) with seemingly no unit test errors, and an EWS server will be created in the SmartConnector portal. However, the server will be stopped and cannot start. Looking into the logs will show an error that "SmartConnector.WeatherExtension.dll does not exist". Because of the custom EWS implementation, a DLL for this extension must be present in the Smart Connector Install directory. Follow these final steps and everything should run without a hitch:

1. Build the "SmartConnector.WeatherExtension" project after you have removed the need for licensing

2. Open Task Manager and Stop SmartConnectorService

3. The DLL produced by your build can be found in SmartConnectorSamples-master\SmartConnector.WeatherExtension\bin\Debug. Copy that dll into the SmartConnector install folder

4. Start the service back up

5. Run your unit tests

See Answer In Context

1 Reply 1
Nick-Iebba
Schneider Alumni (Retired)
Schneider Alumni (Retired)

Re: Smart Connector: Tutorial Weather Extension Test Issue Error

This issue has been solved. Posting back here for public education.

 

The main problem associated with this is that no connection info was set up in SmartConnector.WeatherExtension.Test's App.config file.

When you run the test, it will try to connect to Smart Connector and set up an EWS server; however, it cannot do that if no connection info was set up. You have to go to the install directory for Smart Connector (will probably be C:/Program Files (x86)/Schneider Electric/Smart Connector) and open "Mongoose.Service.exe.config" in a text editor. Locate the <connectionStrings> element and copy the entire contents between the opening XML tag and the closing one </connectionStrings>. Paste that into the App.Config file, and do the same for the encryption key setting (included in the <appsettings> element). Refer to the attached picture.

APPCONFIG.png

 

However, if freshly downloaded from the repo, you will run into more issues after this one because a couple things need to be set up that are not. The next error will have to do with licensing, most likely. You want to disable licensing, so that a valid license file will not be required to run the processor. Simply have this region of code uncommented in the WeatherProcessorBase class:

#region IsLicensed - Override

     public override bool IsLicensed => false;

#endregion 

 

After all this, one will run the ExecuteTest (for SetupProcessor) with seemingly no unit test errors, and an EWS server will be created in the SmartConnector portal. However, the server will be stopped and cannot start. Looking into the logs will show an error that "SmartConnector.WeatherExtension.dll does not exist". Because of the custom EWS implementation, a DLL for this extension must be present in the Smart Connector Install directory. Follow these final steps and everything should run without a hitch:

1. Build the "SmartConnector.WeatherExtension" project after you have removed the need for licensing

2. Open Task Manager and Stop SmartConnectorService

3. The DLL produced by your build can be found in SmartConnectorSamples-master\SmartConnector.WeatherExtension\bin\Debug. Copy that dll into the SmartConnector install folder

4. Start the service back up

5. Run your unit tests