-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acdc25e
commit 8f14489
Showing
10 changed files
with
127 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package automation.runner | ||
|
||
import automation.services.VkGroupService | ||
import automation.services.VkTestBotConfig | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer | ||
import org.springframework.test.context.ActiveProfiles | ||
import org.springframework.test.context.ContextConfiguration | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
|
||
@ExtendWith(SpringExtension::class) | ||
@ActiveProfiles("at") | ||
@ContextConfiguration( | ||
initializers = [ConfigDataApplicationContextInitializer::class], | ||
classes = [ | ||
VkGroupService::class, | ||
VkTestBotConfig::class | ||
] | ||
) | ||
class CucumberRunnerIT ( | ||
@Autowired private val vkGroupService: VkGroupService | ||
) { | ||
@Test | ||
fun test1() { | ||
vkGroupService.post() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package automation.services | ||
|
||
import com.vk.api.sdk.client.VkApiClient | ||
import com.vk.api.sdk.client.actors.UserActor | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class VkGroupService ( | ||
private val vkApiClient: VkApiClient, | ||
private val userActor: UserActor | ||
) { | ||
fun post() { | ||
vkApiClient.wall() | ||
.post(userActor) | ||
.ownerId(224746392) | ||
.message("test") | ||
.execute() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package automation.services | ||
|
||
import com.vk.api.sdk.client.TransportClient | ||
import com.vk.api.sdk.client.VkApiClient | ||
import com.vk.api.sdk.client.actors.UserActor | ||
import com.vk.api.sdk.httpclient.HttpTransportClient | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
class VkTestBotConfig( | ||
@Value("\${forwarder.at.vk.token}") private val vkToken: String, | ||
@Value("\${forwarder.at.vk.user-id}") private val vkUserId: Long | ||
) { | ||
|
||
@Bean | ||
fun vkApiClient(): VkApiClient { | ||
val transportClient: TransportClient = HttpTransportClient() | ||
return VkApiClient(transportClient) | ||
} | ||
|
||
@Bean | ||
fun userActor(): UserActor { | ||
return UserActor(vkUserId, vkToken) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
|
||
postgres-url: jdbc:postgresql://${POSTGRES_ADDRESS:localhost}:${POSTGRES_PORT:5433}/${POSTGRES_DB:vk_forwarder_bot} | ||
|
||
spring: | ||
datasource: | ||
url: ${postgres-url} | ||
username: ${POSTGRES_APP_USER:d} | ||
password: ${POSTGRES_APP_PASSWORD:d} | ||
|
||
forwarder: | ||
at: | ||
vk: | ||
token: vk1.a.ba0S2riE8j2TtehMCLFd39Jez8LwYoQ8VWN0pjV_W_A5KuXf7nh9DAm79vEW4EhhNGNAXhunKLtZ6fwuKU3aw5PL0aBrmo4mudqggC9TrpmEIu9w3LvLGHXBodAP9fdGjDSwNG6W3Ofpgn_EWXKtFxUj6g-m0iNi83xZ-2XVBaK-sOajrrUdx1OWW9bATAi959m83Afnx1hnWE5hp3yd_g | ||
user-id: 840295095 | ||
|