Exemple #1
0
def undeploy(name, server_group):
    builder = OperationRequestBuilder()
    builder.deployment(name)
    builder.remove()
    remove_content = builder.build()

    builder = OperationRequestBuilder()
    builder.target(server_group)
    builder.undeploy()
    builder.deployment(name)
    undeploy_operation = builder.build()

    return [undeploy_operation, remove_content]
Exemple #2
0
def deploy(name, src, server_group):
    add_builder = OperationRequestBuilder()
    add_builder.deployment(name)
    add_builder.content(src)
    add_builder.add()
    add_content = add_builder.build()

    deploy_builder = OperationRequestBuilder()
    deploy_builder.target(server_group)
    deploy_builder.deploy()
    deploy_builder.deployment(name)
    deploy_operation = deploy_builder.build()

    return [add_content, deploy_operation]
Exemple #3
0
def test_address_from_path():
    builder = OperationRequestBuilder()
    builder.address_from('/subsystem=datasources/data-source=DemoDS')
    request = builder.build()

    assert request == dict(
        address=[{'subsystem': 'datasources'}, {'data-source': 'DemoDS'}])
Exemple #4
0
def test_content_src():
    builder = OperationRequestBuilder()
    builder.content('/tmp/hawtio.war')
    request = builder.build()

    assert request == dict(
        content=[dict(url='file:/tmp/hawtio.war')], address=[])
Exemple #5
0
def test_deploy_no_server_group():
    builder = OperationRequestBuilder()
    builder.target(None)
    builder.deploy()
    request = builder.build()

    assert request == dict(operation='deploy', address=[])
Exemple #6
0
def deploy_only(name, bytes_value, server_group):
    builder = OperationRequestBuilder()
    builder.content_reference(bytes_value)
    builder.target(server_group)
    builder.add()
    builder.payload(dict(enabled=True))
    builder.deployment(name)
    return builder.build()
Exemple #7
0
def test_composite_operation():
    builder = OperationRequestBuilder()
    builder.add()
    add_operation = builder.build()

    builder = OperationRequestBuilder()
    builder.deploy()
    deploy_operation = builder.build()

    builder = OperationRequestBuilder()
    builder.composite([add_operation, deploy_operation])

    request = builder.build()

    assert request == dict(address=[],
                           operation='composite',
                           steps=[add_operation, deploy_operation])
Exemple #8
0
def test_write_attribute_operation():
    builder = OperationRequestBuilder()
    builder.write('min-pool-size', 10)
    request = builder.build()

    assert request == dict(operation='write-attribute',
                           name='min-pool-size',
                           value=10,
                           address=[])
Exemple #9
0
def test_deploy_with_server_group():
    builder = OperationRequestBuilder()
    builder.target('main-server-group')
    builder.deploy()

    request = builder.build()

    assert request == dict(operation='add',
                           address=[{'server-group': 'main-server-group'}])
Exemple #10
0
def test_deployment_address():
    builder = OperationRequestBuilder()
    builder.deployment('hawtio.war')
    request = builder.build()

    assert request == dict(address=[dict(deployment='hawtio.war')])
Exemple #11
0
def execute(operation, parameters, path):
    builder = OperationRequestBuilder()
    builder.address_from(path)
    builder.payload(parameters)
    builder.operation(operation)
    return builder.build()
Exemple #12
0
def test_target_server_group():
    builder = OperationRequestBuilder()
    builder.target('main-server-group')
    request = builder.build()

    assert request == dict(address=[{'server-group': 'main-server-group'}])
Exemple #13
0
def write_attribute(path, name, value):
    builder = OperationRequestBuilder()
    builder.address_from(path)
    builder.write(name, value)
    return builder.build()
Exemple #14
0
def test_read_operation():
    builder = OperationRequestBuilder()
    builder.read()
    request = builder.build()

    assert request == dict(operation='read-resource', address=[])
Exemple #15
0
def remove(path):
    builder = OperationRequestBuilder()
    builder.address_from(path)
    builder.remove()
    return builder.build()
Exemple #16
0
def test_undeploy_no_server_group():
    builder = OperationRequestBuilder()
    builder.undeploy()
    request = builder.build()

    assert request == dict(operation='undeploy', address=[])
Exemple #17
0
def test_add_operation():
    builder = OperationRequestBuilder()
    builder.add()
    request = builder.build()

    assert request == dict(operation='add', address=[])
Exemple #18
0
def composite(operations):
    builder = OperationRequestBuilder()
    builder.composite(operations)
    return builder.build()
Exemple #19
0
def test_remove_operation():
    builder = OperationRequestBuilder()
    builder.remove()
    request = builder.build()

    assert request == dict(operation='remove', address=[])
Exemple #20
0
def add(path, attributes):
    builder = OperationRequestBuilder()
    builder.address_from(path)
    builder.add()
    builder.payload(attributes)
    return builder.build()