I am writing a tsqlt unit testing where I am not faking the table and I am using the real SQL table ex:sendEmail to test the email sending functionality.
I am inserting the value like below from tsqlt to the sendEmail table
Email: 'test#test.com'
Status : 0
Template : 'New User Creation'
There is an automation job outside of tsqlt that will look for these table entries which have Status :0 process the email to the sender address and update back to the table's column value as Status:1
But I am not seeing the automation job is able to do success with email sending during this tsqlt regression scenario. Can't we access the SQL table and its value outside use when tsqlt is running? Any guidance would be highly appreciated.
tSqlt will be running only in the isolated way and can't integrate with any other code or application?
Related
I am having a multi-tenancy application developed with Spring boot. In the master table I hold information about the tenant databases. I am trying to create a service, that receives a row from the master table and creates the database for it. Is there a known way to do this in Spring boot? The only information I can find on internet is creating at start up of the application and this is not desired. The master-tenant table is in a master schema and has the following structure:
The method from the service is as follows:
public void createTenant(TenantDTO tenantDTO) {
tenantepository.save(new Tenant(tenantDTO));
MasterTenant masterTenant = new MasterTenant();
masterTenant.setDbName(tenantDTO.getTenantId());
masterTenant.setDriverClass("com.mysql.jdbc.Driver");
masterTenant.setTenantId(tenantDTO.getTenantId());
masterTenant.setPassword("password");
masterTenant.setStatus(EStatus.ACTIVE.name());
masterTenant.setUserName("root");
masterTenant.setUrl("jdbc:mysql://localhost:3306/"+tenantDTO.getTenantId());
DBContextHolder.setCurrentDb(masterTenant.getDbName());
masterTenantRepository.save(masterTenant);
multiTenantConnectionProvider.selectDataSource(masterTenant.getTenantId());
//create schema + create tables from existing entities or run a script of sql
}
I would need help figuring out the part with create schema and tables.
One Option that I can think of is having a back-end like Jenkins or AWS Lambda to which you can give the request to create the database in your server pool.
In case of choosing a Jenkins job, you have REST API exposed by Jenkins, which you can make use of to trigger the job. As it is more tied to the dev-ops you can use terraform like script in the jenkins job that accepts the tenant id as a parameter to set that as the database name etc.
Some advantages of using a Jenkins job are
The job can be long running
Supports queueing
Can easily integrate with devops and remove those dependencies with the application
API based access to trigger a job, view status and logs etc.
here is my scenario:
I have an entry screen, where an Operator requests to download a recipe (Entity “E1”)
“E1” sends a request to SQL Server to prepare the recipe (Entity “E2” a SP on SQL Server)
“E2” prepares the recipe data and sets it in a table for Wonderware to download (Entity “E3”)
“E3” Currently has a script that keeps polling the table to find out if data is available for it at a 2” interval.
What I am trying to obtain is this:
“E1” sends the request to SQL Server to prepare the recipe (Entity “E2”)
“E2” prepares the recipe data and sets it in a table for Wonderware to download (Entity “E3”)
“E2” sets a value in a specific Field Attribute of “E3” named (BoolRecipeAvailable) to true, (maybe call a DLL to do it?)
“E3” has a script that gets activated by BoolRecipeAvailable going to True or on a DataChange.
I have a Wonderware toolkit that can read/write inside a running Galaxy.
How can I call one of its methods from the SQL Server stored procedure that prepares the requested data? This would allow me to use the DataChange or OnTrue events to start the script performing the download, without having to be time-activated.
Anyone ever ran into a similar situation?
Thank you,
Marco
The current system has a script that every 2" queries a SQL table to check if there is data prepared for it, but due to the fact that 'When' is determined by the operator, most of this script runs are useless.
I have a load test solution with one load test and one web test. I have created a Agent where the load test solution lies and a Controller which has a SQL server set up. So i am using the Controller to store the Load test results in database. While running the test case i am facing the below issue -
The load test results database could not be opened. Check that the load test results database specified by the connect string for your test controller (or local machine) specifies a database that contains the load test schema and that is currently available. For more information, see the Visual Studio help topic 'About the Load Test Results Store'. The connection error was: An error occurred while attempting to create the load test results repository schema: To create the database 'LoadTest2010' your user account must have the either the SQL Server 'sysadmin' role or both the 'serveradmin' and 'dbcreator' roles
Note - The same solution runs fine for two of my colleagues. So i think it is something to do with permissions. I have matched the permissions which i and my colleague share on controller, agent, database, they are exactly the same.
I am blocked from two days, it would be great if anyone can spend some time and help me.
Thanks in advance.
Load Test Repository is configured at Controller Level. So, if someone else can do Load Tests, configuration is ok.
Maybe, you are not using a remote Test Controller in your Test (Local Testing only).
You should create a remote test settings in VS and specify the remote test controller.
I have a bunch of stored procs doing the business logic job in a SQL Server instance within a web application. When something goes wrong all of them queue a message in a specific table (let's say 'warnings') keeping track of the error severity and issue description. I want the web application using the stored procs to be able to query the message table at the end of the run but getting a list of the proper message only, i.e. the message created during the specific session or that specific connection: so I am in doubt if
have the web application send to the db a guid to INSERT as column value in the message records (but somehow I have to keep track of it in several stored procs running at the page level, so I need something "global")
OR
if I can use some id related to the connection opened by the application - and this would be definitely more sane. Something like (this is pseudo code):
SELECT #sessionid = sessionid FROM sys.something where this = that
Have some hints?
Thanks a lot for your ideas
To retrieve your current SessionId in SQL Server you can simply execute the following:
select ##SPID
See:
http://msdn.microsoft.com/en-us/library/ms189535.aspx
I'm developing a asp.net MVC 3 web application project. The project is simple, it provides a web page listing stored procedures in SQL Server. when user selects a stored procedure and hit "run" button, it is invoked to execute in SQL Server and return some execution result.
My stored procedure is logically divided into several steps, say 10 steps, each step prints a message like step 1: doing A..., step2: dong B..., until step 10: done or step 10: fail. (with error message).
I don't want the user just hang on to wait until stored procedure finishes and just see the final result message. I want them to see some kind of live execution of stored procedure, so that user is well updated of where the stored procedure is.Some stored procedures are quick and take few seconds to finish, some are very slow and take even 1 hour to finish.
Now the question is: how could I push theses step messages from SQL Server to web application, so that in web browser, user can see each step message get printed in real-time fashion?
I search lots of info, the best i can see is model controller notifies view once there's change in model, but still need model controller to pull from SQL Server, I don't see any real push from SQL Server to web application. Your advice is highly appreciated.
One approach would be to create a log table at the start of the procedure, with a unique name. The MVC code would display a grid or other element showing this log table, the stored procedure would simply add rows to the table after each step is complete...
Grab the session ID of the connection
The procedure creates a file called LOG_SessID
The MVC opens the table and uses the Meta Refresh or a Timer to redisplay the page
Each redisplay checks to see if the table still exists, if not, it
assumes the procedure is done and prints the appropriate message
One possible solution can be that you break your SP into steps and call each Step's SP and update the User screen (even have separate MVC VIEWS/PARTIAL VIEWS for each step's success and failure) based on the result!