当我尝试连接到 aws 上的 dynamoDB 时,我遇到了某种凭据问题。在本地,一切正常,我可以使用环境变量进行连接AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY然后AWS_DEFAULT_REGION
dynamoConnection = boto3.resource('dynamodb', endpoint_url='http://localhost:8000')
Run Code Online (Sandbox Code Playgroud)
当更改为环境变量中的实时信用并将端点_url 设置为 aws 上的 dynamoDB 时,会失败并显示:
“botocore.exceptions.ClientError:调用查询操作时发生错误 (InvalidSignatureException):我们计算的请求签名与您提供的签名不匹配。请检查您的 AWS 秘密访问密钥和签名方法。有关详细信息,请参阅服务文档。”
这些信用是有效的,因为它们在与同一 dynamoDB 通信的不同应用程序中使用。我也尝试过不使用环境变量,而是直接在方法中使用,但错误仍然存在。此外,为了避免尾随空格出现任何问题,我什至直接在代码中使用了凭据。我使用 Python v3.4.4。
是否还应该设置一个我不知道的标头?任何提示将不胜感激。
编辑
我现在还创建了新的凭据(以确保只有字母数字符号),但仍然没有骰子。
我想build.gradle使用Gradle Script Kotlin将我的Android项目中的文件从Groovy 转换为Kotlin.我喜欢Kotlin中的所有这些,但如果有一些限制,那么尽可能多.
让我们假设我只有一个空项目,刚从Android Studio"新应用程序"模板创建(minSdkVersion 15如果重要的话,使用AppCompat).我需要采取哪些步骤才能将此项目转换为Gradle Script Kotlin.
我希望这应该是我(以及其他所有人)的一个很好的起点,我可以处理我自己转换任何自定义逻辑.
android gradle kotlin android-gradle-plugin gradle-kotlin-dsl
如果我有一个项目有java,groovy和kotlin插件应用每个代码编写的代码,我如何创建(我应该)创建一个javadoc.jar包含所有代码文档的分发?
该java插件给我的javadoc课,groovy插件给我的groovydoc任务,但这些似乎并没有合作.
如何将此文档"合并"为单个内聚工件?
我创建了.jar文件并将其移至dir,但是我不明白以后如何更改该文件的权限。
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class':'com.asd.App',
'Class-Path': 'com.asd'
}
baseName = project.name + '-all'
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
def file = file('/home/master/project/asd')
fileMode = 755
destinationDir = file
with jar
}
Run Code Online (Sandbox Code Playgroud) 使用Spock 0.7和Grails 2.04.试图建立一个测试环境.我需要一些关于测试对象列表的帮助.
我有一个位置对象列表.我想测试每个对象的日期.我正在迭代但不确定如果日期不相等,测试会如何失败.有没有一种好方法来测试列表中的对象?我在下面列出了我的代码块.
then:
weatherList != null
weatherList.empty != null
weatherList.size() == 3
weatherList.each {
Calendar today = Calendar.getInstance();
today.clearTime()
if(it.forecastDate != today) {
return false
}
}
Run Code Online (Sandbox Code Playgroud) 我看到一些我无法理解的行为,并且想知道是否有人能够准确地解释这里发生了什么.这是我目前的代码.
public class MyClass {
ArrayList<String> myList = new ArrayList<String>();
public MyClass() {
populate();
removeData(myList);
}
private void populate() {
myList.add("Some data");
myList.add("Some more data");
myList.add("Even more data");
}
private void removeData(ArrayList<String> list) {
ArrayList<String> temp = new ArrayList<String>();
temp = list;
temp.remove("Some data");
}
}
Run Code Online (Sandbox Code Playgroud)
现在由于某种原因,在我运行此代码后,数据将从ArrayList"myList"中删除.即使我只是从方法"removeData"中的变量中删除数据而不是从字段"myList"中删除数据,为什么会发生这种情况?
我们有两个 AWS 账户。一个用于生产,另一个用于测试。我们需要区分我们正在运行的环境。我们可以看到一个简单的方法是获取帐户名称,一旦我们得到它就会非常简单。但是,我们不知道如何从 AWS 凭证或属性中获取它。有没有人知道如何使用 AWS 凭证获取账户信息?我考虑了账户权限、账户类型等的可能性,但我认为这不应该阻止我们获取账户名?
我的macbook上有一个默认的Datastax enterprise安装.我能够创建我的键空间并设置我的所有应用程序,包括使用solr.
我正在尝试开发一组步骤来为我们的开发群集启用密码身份验证.
到目前为止,我已更新/usr/local/dse/resources/cassandra/conf/cassandra.yaml并更改了以下属性:authenticator:PasswordAuthenticator authorizer:CassandraAuthorizer
我重新启动了节点,可以使用cqlsh登录并查询我的密钥空间:cqlsh -u cassandra -p cassandra
此时,我尝试在"会话"构建器上设置"凭据":主机为:cassandra.host = localhost
authenticator: PasswordAuthenticator
authorizer: CassandraAuthorizer
Run Code Online (Sandbox Code Playgroud)
但是我无法成功连接.所以我添加了一个新用户,并且能够再次通过cqlsh登录,但仍然无法连接Java驱动程序.
cqlsh -u cassandra -p cassandra
Run Code Online (Sandbox Code Playgroud)
我通过gradle为驱动程序使用'com.datastax.cassandra:cassandra-driver-dse:2.1.9'.
我总是得到以下堆栈跟踪,通过调试可以看到用户名和密码设置正确:
Session session = keyspaceToSessionMap.get(keyspace);
if( session == null){
Cluster cluster = Cluster.builder().addContactPoints(hosts)
.withCredentials(username, password)
//.withSSL()
.build();
session = cluster.connect(keyspace);
keyspaceToSessionMap.put(keyspace,session);
}
Run Code Online (Sandbox Code Playgroud)
这似乎应该很简单,但我很难过.
与cassandra驱动程序相关的依赖关系图包含以下内容:
cqlsh -u username -p password
Connected to LocalCluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.1.8.689 | DSE 4.7.3 | CQL spec 3.2.0 | Native protocol v3]
Run Code Online (Sandbox Code Playgroud)
我创建了以下测试通过.
Caused by: com.datastax.driver.core.exceptions.AuthenticationException: Authentication error …Run Code Online (Sandbox Code Playgroud) 所需 Jenkins 管道的描述:
我目前的代码是:
try {
timeout(1) {
input message: 'Do you want to release this build?',
parameters: [[$class: 'BooleanParameterDefinition',
defaultValue: false,
description: 'Ticking this box will do a release',
name: 'Release']]
}
} catch (err) {
def hi = err.getCauses()
echo "Exception thrown:\n ${hi}"
echo err.getLocalizedMessage()
echo err.getCause()
echo err.toString()
echo err.getClass().getName()
}
Run Code Online (Sandbox Code Playgroud)
但这给出了相同的(据我所知)行为并捕获了用户按下“中止”和输入超时的错误。
这是超时的输出:
[Pipeline] timeout
[Pipeline] {
[Pipeline] input
Input requested
[Pipeline] }
[Pipeline] // timeout
[Pipeline] echo
Exception …Run Code Online (Sandbox Code Playgroud) gradle中有没有一种方法可以将junit xml报告合并到单个测试报告文件中。
当我们在ant中使用cp-suite执行IntegrationTestSuite.java时,只有一个junit报告。在gradle上创建了多个junit报告。
IntegrationTestSuite.java
@RunWith(Categories.class)
@Categories.IncludeCategory(IntegrationTests.class)
@Categories.ExcludeCategory(DebugJenkinsTests.class)
@Suite.SuiteClasses(AllTestSuite.class)
public class IntegrationTestSuite { /* nop */
}
Run Code Online (Sandbox Code Playgroud)
摘自 build.xml
<junit>
<formatter type="xml" />
<batchtest todir="${testreport.dir}">
<fileset dir="${test-src.dir}">
<include name="**/IntegrationTestSuite.java" />
</fileset>
</batchtest>
</junit>
Run Code Online (Sandbox Code Playgroud)
摘自 build.gradle
task integrationTestSandro(type: Test) {
reports.html.enabled = false
include '**/IntegrationTestSuite*'
reports.junitXml.destination = "$buildDir/test-results/integration"
maxHeapSize = testTaskMaxHeapSize
jvmArgs testTaskJVMArgs
}
Run Code Online (Sandbox Code Playgroud) gradle ×4
java ×2
amazon-iam ×1
android ×1
arraylist ×1
aws-sdk ×1
boto3 ×1
build.gradle ×1
cassandra ×1
datastax ×1
grails-2.0 ×1
groovydoc ×1
javadoc ×1
jenkins ×1
junit ×1
kdoc ×1
kotlin ×1
python-3.4 ×1
spock ×1