private ExpectedTimeoutRule() { this.delegate = ExpectedException.none(); }
@Test public void testExceptionThrownWhenMisConfigured() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.set("hbase.thrift.security.qop", "privacy"); conf.setBoolean("hbase.thrift.ssl.enabled", false); ThriftServer server = null; ExpectedException thrown = ExpectedException.none(); try { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false"); server = new ThriftServer(conf); server.run(); fail("Thrift HTTP Server starts up even with wrong security configurations."); } catch (Exception e) { } }
public ExpectedException expectedException = ExpectedException.none();
public ExpectedException expectedException = ExpectedException.none();
private static class TestFirehoseFactory implements FirehoseFactory<InputRowParser> { public TestFirehoseFactory() { } @Override @SuppressWarnings("unchecked") public Firehose connect(InputRowParser parser, File temporaryDirectory) throws ParseException { return new TestFirehose(parser); } }
@Override protected void doSetUpBeforeMuleContextCreation() throws Exception { if (failsDeployment) { exception.expect(RetryPolicyExhaustedException.class); exception.expectCause(sameInstance(connectionException)); } else { exception = none(); } }
public ExpectedException thrown = ExpectedException.none();
@Test public void testExceptionThrownWhenMisConfigured() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.set("hbase.thrift.security.qop", "privacy"); conf.setBoolean("hbase.thrift.ssl.enabled", false); ThriftServerRunner runner = null; ExpectedException thrown = ExpectedException.none(); try { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false"); runner = new ThriftServerRunner(conf); fail("Thrift HTTP Server starts up even with wrong security configurations."); } catch (Exception e) { } assertNull(runner); }
@Test public void testExceptionThrownWhenMisConfigured() throws Exception { Configuration conf = new Configuration(TEST_UTIL.getConfiguration()); conf.set("hbase.thrift.security.qop", "privacy"); conf.setBoolean("hbase.thrift.ssl.enabled", false); ThriftServerRunner runner = null; ExpectedException thrown = ExpectedException.none(); try { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false"); runner = new ThriftServerRunner(conf); fail("Thrift HTTP Server starts up even with wrong security configurations."); } catch (Exception e) { } assertNull(runner); }
@Test public void testMapNestedToDomain() throws MappingException { exception = ExpectedException.none(); MappingResult result = mapper.mapToDomainField(findDomainField("nestedValue"), testProtobuf, testDomain); testMappingResult(result, Result.NESTED_MAPPING, testProtobuf.getNestedValue(), testDomain); }
@Test public void testValidationSucceedsWithHBaseImportAndAsTextFile() throws Exception { SqoopOptions options = buildBaseSqoopOptions(); options.setHBaseTable(HBASE_TABLE_NAME); options.setHBaseColFamily(HBASE_COL_FAMILY); options.setFileLayout(TextFile); thrown.none(); importTool.validateOptions(options); }
@Test public void testMapNestedToProtobuf() throws MappingException { exception = ExpectedException.none(); MappingProto.MappingTest.Builder protobufBuilder = MappingProto.MappingTest.newBuilder(); MappingResult result = mapper.mapToProtobufField(findDomainField("nestedValue"), testDomain, protobufBuilder); testMappingResult(result, Result.NESTED_MAPPING, testDomain.getNestedValue(), protobufBuilder); }
@Test public void nsdManagementOnboardTest() throws NotFoundException, BadFormatException, NetworkServiceIntegrityException, CyclicDependenciesException, EntityInUseException, BadRequestException, IOException, AlreadyExistingException, PluginException, IncompatibleVNFPackage, VimException, InterruptedException, EntityUnreachableException { NetworkServiceDescriptor nsd_exp = createNetworkServiceDescriptor(); when(vnfmManagerEndpointRepository.findAll()) .thenReturn( new ArrayList<VnfmManagerEndpoint>() { { VnfmManagerEndpoint vnfmManagerEndpoint = new VnfmManagerEndpoint(); vnfmManagerEndpoint.setEndpoint("test"); vnfmManagerEndpoint.setType("test"); vnfmManagerEndpoint.setActive(true); vnfmManagerEndpoint.setEnabled(true); add(vnfmManagerEndpoint); } }); when(nsdRepository.save(nsd_exp)).thenReturn(nsd_exp); exception = ExpectedException.none(); nsdManagement.onboard(nsd_exp, projectId); assertEqualsNSD(nsd_exp); }
@Test public void testMapFieldWithDifferentNameToDomain() throws MappingException { exception = ExpectedException.none(); MappingResult result = mapper.mapToDomainField(findDomainField("boolValue"), testProtobuf, testDomain); testMappingResult(result, Result.MAPPED, testProtobuf.getBooleanValue(), testDomain); result = mapper.mapToDomainField(findDomainField("simpleListValue"), testProtobuf, testDomain); testMappingResult(result, Result.COLLECTION_MAPPING, testProtobuf.getStringListValueList(), testDomain); }
@Test public void testMapCollectionToDomain() throws MappingException { exception = ExpectedException.none(); MappingResult result = mapper.mapToDomainField(findDomainField("simpleListValue"), testProtobuf, testDomain); testMappingResult(result, Result.COLLECTION_MAPPING, testProtobuf.getStringListValueList(), testDomain); result = mapper.mapToDomainField(findDomainField("nestedListValue"), testProtobuf, testDomain); testMappingResult(result, Result.COLLECTION_MAPPING, testProtobuf.getNestedListValueList(), testDomain); }
@Test public void testMapCollectionToProtobuf() throws MappingException { exception = ExpectedException.none(); MappingProto.MappingTest.Builder protobufBuilder = MappingProto.MappingTest.newBuilder(); MappingResult result = mapper .mapToProtobufField(findDomainField("simpleListValue"), testDomain, protobufBuilder); testMappingResult(result, Result.COLLECTION_MAPPING, testDomain.getSimpleListValue(), protobufBuilder); result = mapper.mapToProtobufField(findDomainField("nestedListValue"), testDomain, protobufBuilder); testMappingResult(result, Result.COLLECTION_MAPPING, testDomain.getNestedListValue(), protobufBuilder); }
@Test public void testMapObjectToDomain() throws MappingException { exception = ExpectedException.none(); MappingResult result = mapper.mapToDomainField(findDomainField("floatValue"), testProtobuf, testDomain); testMappingResult(result, Result.MAPPED, testProtobuf.getFloatValue(), testDomain); result = mapper.mapToDomainField(findDomainField("doubleValue"), testProtobuf, testDomain); testMappingResult(result, Result.MAPPED, testProtobuf.getDoubleValue(), testDomain); result = mapper.mapToDomainField(findDomainField("intValue"), testProtobuf, testDomain); testMappingResult(result, Result.MAPPED, testProtobuf.getIntValue(), testDomain); result = mapper.mapToDomainField(findDomainField("longValue"), testProtobuf, testDomain); testMappingResult(result, Result.MAPPED, testProtobuf.getLongValue(), testDomain); result = mapper.mapToDomainField(findDomainField("stringValue"), testProtobuf, testDomain); testMappingResult(result, Result.MAPPED, testProtobuf.getStringValue(), testDomain); }
@Test public void testMapPrimitiveToProtobuf() throws MappingException { exception = ExpectedException.none(); MappingProto.MappingTest.Builder protobufBuilder = MappingProto.MappingTest.newBuilder(); MappingResult result = mapper .mapToProtobufField(findPrimitiveField("booleanValue"), primitiveTestDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, primitiveTestDomain.isBooleanValue(), protobufBuilder); result = mapper.mapToProtobufField(findPrimitiveField("floatValue"), primitiveTestDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, primitiveTestDomain.getFloatValue(), protobufBuilder); result = mapper.mapToProtobufField(findPrimitiveField("doubleValue"), primitiveTestDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, primitiveTestDomain.getDoubleValue(), protobufBuilder); result = mapper.mapToProtobufField(findPrimitiveField("intValue"), primitiveTestDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, primitiveTestDomain.getIntValue(), protobufBuilder); result = mapper.mapToProtobufField(findPrimitiveField("longValue"), primitiveTestDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, primitiveTestDomain.getLongValue(), protobufBuilder); }
@Test public void testMapObjectToProtobuf() throws MappingException { exception = ExpectedException.none(); MappingProto.MappingTest.Builder protobufBuilder = MappingProto.MappingTest.newBuilder(); MappingResult result = mapper.mapToProtobufField(findDomainField("boolValue"), testDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, testDomain.getBoolValue(), protobufBuilder); result = mapper.mapToProtobufField(findDomainField("floatValue"), testDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, testDomain.getFloatValue(), protobufBuilder); result = mapper.mapToProtobufField(findDomainField("doubleValue"), testDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, testDomain.getDoubleValue(), protobufBuilder); result = mapper.mapToProtobufField(findDomainField("intValue"), testDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, testDomain.getIntValue(), protobufBuilder); result = mapper.mapToProtobufField(findDomainField("longValue"), testDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, testDomain.getLongValue(), protobufBuilder); result = mapper.mapToProtobufField(findDomainField("stringValue"), testDomain, protobufBuilder); testMappingResult(result, Result.MAPPED, testDomain.getStringValue(), protobufBuilder); }