Skip to content

Instantly share code, notes, and snippets.

View Lutando's full-sized avatar
💻
developing.

Lutando Ngqakaza Lutando

💻
developing.
View GitHub Profile
# we make a new schema
$newApiManagementSchemaParams = @{
Context = $ApiManagementContext
ApiId = $newApiRevision.ApiId
SchemaDocumentContentType = "application/json"
SchemaDocumentFilePath = $apiSpecificationPath
}
New-AzApiManagementApiSchema @newApiManagementSchemaParams
# increment the revision based off the current revision number
$newRevision = [int]$apiSpecification.ApiRevision + 1;
# now lets create an api revision
$newApiRevisionParams = @{
Context = $apiManagementContext
ApiId = $apiSpecification.ApiId
ApiRevision = $newRevision
SourceApiRevision = $apiSpecification.ApiRevision
}
$apiSpecifications = Get-AzApiManagementApi -Context $apiManagementContext
#now we filter out the specification object that we want
$apiSpecification = $apiSpecifications | Where-Object { $_.Name -eq $apiName }
# lets get the API Management context
$apiManagementContextParams = @{
ResourceGroupName = $resourceGroupName
ServiceName = $apimServiceName
}
$apiManagementContext = New-AzApiManagementContext @apiManagementContextParams
$resourceGroupName = "<the-rg-name>"
$apimServiceName = "<the-apim-servcie-name>"
$apiSpecificationPath = "some/path/to/spec.json"
$apiName = "<the-api-name>"
@Lutando
Lutando / akkatecture logs
Created August 7, 2019 08:03
test problem logs
Akkatecture.Tests.UnitTests.Jobs.ScheduledJobsTests.SchedulingJob_For5minutes_DispatchesJobMessage
Failed: Expected no messages during 00:00:01, instead we received <Akkatecture.TestHelpers.Jobs.TestJobDone> from [akka://jobs-tests/user/$a/test-job-runner-supervisor/test-job-runner#1730104005] after 00:00:00.0000030
Expected: True
Actual: False
at Akka.TestKit.TestKitBase.InternalExpectNoMsg(TimeSpan duration)
at Akka.TestKit.TestKitBase.ExpectNoMsg(TimeSpan duration)
at Akkatecture.Tests.UnitTests.Jobs.ScheduledJobsTests.SchedulingJob_For5minutes_DispatchesJobMessage() in /Users/lutandongqakaza/Workspace/Akkatecture/Akkatecture/test/Akkatecture.Tests/UnitTests/Jobs/ScheduledJobsTests.cs:line 89
public class CustomAdapter : DefaultEventAdapter
{
protected override byte[] ToBytes(object @event, JObject metadata, out string type, out bool isJson)
{
var bytes = base.ToBytes(@event, metadata, out type, out isJson);
//Add some additional metadata:
metadata["additionalProp"] = true;
public static class WebSockets
{
public static void Main(string[] args)
{
RunWebSockets().GetAwaiter().GetResult();
}
private static async Task RunWebSockets()
{
var ws = new ClientWebSocket(); //------v please use a fresh token to test out this is just a PoC client
using Forum.Interfaces;
using System;
using System.Threading.Tasks;
using Formum.Api.Authorization.Models;
using Formum.Api.Authorization.Operations;
using Forum.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Forum.Api.Controllers
[Fact]
[Trait("Category", Category)]
public async void HandleDelete_WhenCalledWithNonResourceOwner_ShouldFail()
{
var resource = make_PostDefault();
var authorizationModel = PostAuthorizationModel.From(resource);
//we use an invalid user this time
var user = new ClaimsPrincipal(new ClaimsIdentity(new List<Claim> { new Claim("sub", InvalidUserIdDefault.ToString()) }));
var requirement = PostOperations.Delete;
var authorizationContext = new AuthorizationHandlerContext(new List<IAuthorizationRequirement> { requirement }, user, authorizationModel);