This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@MockBean | |
private lateinit var mailSenderProxy: MailSenderProxyService; | |
@Test | |
@WithMockUser(authorities = ["SEND_MAIL"]) | |
@Throws(Exception::class) | |
fun shouldSendMail() { | |
val mockMessage = mock(MimeMessage::class.java) | |
Mockito.`when`(mailSenderProxy.createMimeMessage()).thenReturn(mockMessage) | |
val builder = MockMvcRequestBuilders.multipart("/email/sendMail") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | |
@AutoConfigureMockMvc | |
@TestPropertySource(locations = ["classpath:application-integration-tests.properties"]) | |
class EmailApiIntegrationTests : IntegrationTestBase() { | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PreAuthorize("@authorizationService.hasPermission('SEND_MAIL', authentication)") | |
@Override | |
public void sendMail(SendMailRequest request) { | |
MimeMessage message = makeMessage(request); | |
addEmailLog(request); | |
sendMessage(message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping("/email") | |
public class EmailApiController { | |
private final EmailService emailService; | |
public EmailApiController(EmailService emailService) { | |
this.emailService = emailService; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-test</artifactId> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.junit.jupiter</groupId> | |
<artifactId>junit-jupiter-engine</artifactId> | |
<version>5.1.0</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* \author Lars Gröber | |
*/ | |
#include <iostream> | |
#include <fstream> | |
#include <vector> | |
#include <unordered_map> | |
#include <thread> | |
#include <map> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp1.1</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<Folder Include="wwwroot\" /> | |
</ItemGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" /> | |
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script watches the local folder for files with the ending in 'file_endings' | |
# and uploads them to a server specified in 'server'. | |
# | |
server_name="" # include login name if necessary | |
target_directory="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# | |
# small script to send spam mails using mutt (excercise project for a course) | |
# @author: Lars Groeber | |
# | |
# Usage: | |
# SCRIPTNAME [-T %Y%m%d%H%M] [-t timeInterval-in-min] [-m maxMails] | |
# (-s subject,email,body) | (-f subject,file-with-emails,body) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/gnuplot | |
set terminal wxt size 350,262 enhanced font 'Verdana,10' persist | |
# set terminal dumb | |
file="`echo $plot_file`" # make sure to set the $plot_file environment variable first | |
f(x) = a*x+b | |
a = 1 | |
b = 1 | |
fit f(x) file via a,b |
NewerOlder