Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Common/TDSQASystemAPI/BL/XmlRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ public XmlDocument GetXmlContent(long fileId)
return xmlRepositoryDAL.GetXmlContent(fileId);
}

public XmlDocument GetDestinationXmlContent(long fileId)
{
return xmlRepositoryDAL.GetDestinationXmlContent(fileId);
}

public XmlDocument ProcessXmlFile(long fileId)
{
return xmlRepositoryDAL.ProcessXmlFile(fileId);
Expand Down
24 changes: 24 additions & 0 deletions Common/TDSQASystemAPI/DAL/XmlRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,30 @@ public XmlDocument GetXmlContent(long fileId)
return doc;
}

public XmlDocument GetDestinationXmlContent(long fileId)
{
XmlDocument doc = null;
using (DbCommand cmd = _db.GetStoredProcCommand("GetDestinationXmlContentByFileID"))
{
if (dbCommandTimeout != null)
cmd.CommandTimeout = dbCommandTimeout.Value;
_db.AddInParameter(cmd, "@FileID", DbType.Int64, fileId);
using (SqlDataReader rdr = (SqlDataReader)_db.ExecuteReader(cmd))
{
if (rdr.Read())
{
if (!rdr.IsDBNull(0))
{
doc = new XmlDocument();
doc.Load(rdr.GetSqlXml(0).CreateReader());
}
}
}
}

return doc;
}

public XmlDocument ProcessXmlFile(long fileId)
{
XmlDocument doc = null;
Expand Down
2 changes: 1 addition & 1 deletion TDSQAService/OSS.TIS/DAL/ARTDAL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public XmlDocument GetStudentPackageXML(string ssid, string stateAbbrviation, bo

HttpResponseMessage response = Get(ssid, stateAbbrviation, oauthToken, useAlternateStudentId);

if ((response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden) && authTokenFoundInCache)
if ((response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden || response.StatusCode == HttpStatusCode.BadRequest) && authTokenFoundInCache)
{
// try again with a fresh token; may have expired
OAuth.RemoveFromCache(artService.Authorization, oauthToken);
Expand Down
Binary file modified TDSQAService/OSS.TIS/SQL/TISDB/1_Create_Objects.sql
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override void OnAuthorization(HttpActionContext actionContext)
{
using (HttpClient client = new HttpClient())
{
response = client.GetAsync(String.Format("{0}?access_token={1}", OpenAMUrl, authKey)).Result;
response = client.GetAsync(String.Format("{0}?access_token={1}&realm=/sbac", OpenAMUrl, authKey)).Result;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it not working for you without the realm? I'm asking because we have stood TIS up and used it and we did not need to change this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, it didn't work without the realm. Should I take it out of this pull request?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. I'm going to double check before and after for that since it does seem like it should be there. I'm just surprised that we didn't see an issue with it before. So I'm confused :) . But leave at this point. Thanks.

if (response.IsSuccessStatusCode)
{
// appears to be a successful authentication.
Expand Down
20 changes: 17 additions & 3 deletions TISServices/TISServices/Services/TestResultController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
using TISServices.Utilities;
using OSS.TIS;
using TISServices.Authorization;
using System.Text;

namespace TISServices.Services
{
{
[AuthorizeOpenAM]
public class TestResultController : ApiController
{
Expand Down Expand Up @@ -100,16 +101,29 @@ public HttpResponseMessage Submit(string statusCallback)

try
{
new XmlRepository().InsertXml(XmlRepository.Location.source, doc, callBackUrl.AbsoluteUri, new TestResultSerializerFactory());
long fileId = new XmlRepository().InsertXml(XmlRepository.Location.source, doc, callBackUrl.AbsoluteUri, new TestResultSerializerFactory());
Statistics.AddToInsertedRequestCount();
return Request.CreateResponse(HttpStatusCode.OK, fileId);
}
catch (Exception ex)
{
TISServicesLogger.Log(ex);
return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Could not persist the request.");
}
}

[HttpGet]
public HttpResponseMessage Get(long fileId)
{
XmlDocument doc = new XmlRepository().GetDestinationXmlContent(fileId);

return Request.CreateResponse(HttpStatusCode.OK);
if (doc == null)
return new HttpResponseMessage(HttpStatusCode.NotFound);

return new HttpResponseMessage()
{
Content = new StringContent(doc.OuterXml, Encoding.UTF8, "application/xml")
};
}
}
}