io.airlift.testing.Assertions.assertNotEquals()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(16.9k)|赞(0)|评价(0)|浏览(18)

本文整理了Java中io.airlift.testing.Assertions.assertNotEquals()方法的一些代码示例,展示了Assertions.assertNotEquals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assertions.assertNotEquals()方法的具体详情如下:
包路径:io.airlift.testing.Assertions
类名称:Assertions
方法名:assertNotEquals

Assertions.assertNotEquals介绍

暂无

代码示例

代码示例来源:origin: com.teradata.airlift/testing

public static void assertNotEquals(Object actual, Object expected)
{
  assertNotEquals(actual, expected, null);
}

代码示例来源:origin: io.airlift/testing

public static void assertNotEquals(Object actual, Object expected)
{
  assertNotEquals(actual, expected, null);
}

代码示例来源:origin: airlift/airlift

public static void assertNotEquals(Object actual, Object expected)
{
  assertNotEquals(actual, expected, null);
}

代码示例来源:origin: com.teradata.airlift/configuration

private static <T> void assertAttributesNotEqual(ConfigurationMetadata<T> metadata, T actual, T expected)
{
  for (AttributeMetadata attribute : metadata.getAttributes().values()) {
    Method getter = attribute.getGetter();
    if (getter == null) {
      continue;
    }
    Object actualAttributeValue = invoke(actual, getter);
    Object expectedAttributeValue = invoke(expected, getter);
    Assertions.assertNotEquals(actualAttributeValue, expectedAttributeValue, attribute.getName());
  }
}

代码示例来源:origin: io.airlift.discovery/discovery-server

@Test
public void testCreatesDefensiveCopyOfProperties()
{
  Map<String, String> properties = Maps.newHashMap();
  properties.put("key", "value");
  StaticAnnouncement announcement = new StaticAnnouncement("testing", "type", "pool", "/a/b", properties);
  assertEquals(announcement.getProperties(), properties);
  properties.put("key2", "value2");
  assertNotEquals(announcement.getProperties(), properties);
}

代码示例来源:origin: io.airlift.discovery/discovery-server

@Test
public void testCreatesDefensiveCopyOfProperties()
{
  Map<String, String> properties = Maps.newHashMap();
  properties.put("key", "value");
  DynamicServiceAnnouncement announcement = new DynamicServiceAnnouncement(Id.<Service>random(), "type", properties);
  assertEquals(announcement.getProperties(), properties);
  properties.put("key2", "value2");
  assertNotEquals(announcement.getProperties(), properties);
}

代码示例来源:origin: io.airlift.discovery/discovery-server

@Test
public void testCreatesDefensiveCopyOfProperties()
{
  Map<String, String> properties = Maps.newHashMap();
  properties.put("key", "value");
  Service service = new Service(Id.<Service>random(), Id.<Node>random(), "type", "pool", "/location", properties);
  assertEquals(service.getProperties(), properties);
  properties.put("key2", "value2");
  assertNotEquals(service.getProperties(), properties);
}

代码示例来源:origin: io.airlift.discovery/discovery-server

@Test
public void testCreatesDefensiveCopyOfServices()
{
  Set<Service> set = Sets.newHashSet();
  set.add(new Service(Id.<Service>random(), Id.<Node>random(), "blue", "pool", "/location", ImmutableMap.of("key", "value")));
  Services services = new Services("testing", set);
  assertEquals(services.getServices(), set);
  set.add(new Service(Id.<Service>random(), Id.<Node>random(), "red", "pool", "/location", ImmutableMap.of("key", "value")));
  assertNotEquals(services.getServices(), set);
}

代码示例来源:origin: io.airlift/node

@Test
public void testTestingNode()
    throws UnknownHostException
{
  long testStartTime = System.currentTimeMillis();
  Injector injector = Guice.createInjector(new TestingNodeModule());
  NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);
  assertNotNull(nodeInfo);
  assertTrue(nodeInfo.getEnvironment().matches("test\\d+"));
  assertEquals(nodeInfo.getPool(), "general");
  assertNotNull(nodeInfo.getNodeId());
  assertNotNull(nodeInfo.getLocation());
  assertNull(nodeInfo.getBinarySpec());
  assertNull(nodeInfo.getConfigSpec());
  assertNotNull(nodeInfo.getInstanceId());
  assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  assertEquals(nodeInfo.getInternalAddress(), "127.0.0.1");
  assertEquals(nodeInfo.getBindIp(), InetAddress.getByName(nodeInfo.getInternalAddress()));
  assertEquals(nodeInfo.getExternalAddress(), "127.0.0.1");
  assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: io.airlift/http-server

@Test
public void testHttpsEnabled()
    throws Exception
{
  closeChannels(httpServerInfo);
  config.setHttpsEnabled(true);
  httpServerInfo = new HttpServerInfo(config, nodeInfo);
  assertNotNull(httpServerInfo.getHttpUri());
  assertNotNull(httpServerInfo.getHttpExternalUri());
  assertNotNull(httpServerInfo.getHttpChannel());
  assertEquals(httpServerInfo.getHttpUri().getScheme(), httpServerInfo.getHttpExternalUri().getScheme());
  assertEquals(httpServerInfo.getHttpUri().getPort(), httpServerInfo.getHttpExternalUri().getPort());
  assertEquals(httpServerInfo.getHttpUri().getScheme(), "http");
  assertNotNull(httpServerInfo.getHttpsUri());
  assertNotNull(httpServerInfo.getHttpsExternalUri());
  assertNotNull(httpServerInfo.getHttpsChannel());
  assertEquals(httpServerInfo.getHttpsUri().getScheme(), httpServerInfo.getHttpsExternalUri().getScheme());
  assertEquals(httpServerInfo.getHttpsUri().getPort(), httpServerInfo.getHttpsExternalUri().getPort());
  assertEquals(httpServerInfo.getHttpsUri().getScheme(), "https");
  assertNotNull(httpServerInfo.getAdminUri());
  assertNotNull(httpServerInfo.getAdminExternalUri());
  assertNotNull(httpServerInfo.getAdminChannel());
  assertEquals(httpServerInfo.getAdminUri().getScheme(), httpServerInfo.getAdminExternalUri().getScheme());
  assertEquals(httpServerInfo.getAdminUri().getPort(), httpServerInfo.getAdminExternalUri().getPort());
  assertEquals(httpServerInfo.getAdminUri().getScheme(), "https");
  assertNotEquals(httpServerInfo.getHttpUri().getPort(), httpServerInfo.getHttpsUri().getPort());
  assertNotEquals(httpServerInfo.getHttpUri().getPort(), httpServerInfo.getAdminUri().getPort());
}

代码示例来源:origin: io.airlift/http-server

@Test
public void testConnectorDefaults()
{
  assertTrue(config.isHttpEnabled());
  assertNotNull(httpServerInfo.getHttpUri());
  assertNotNull(httpServerInfo.getHttpExternalUri());
  assertNotNull(httpServerInfo.getHttpChannel());
  assertEquals(httpServerInfo.getHttpUri().getScheme(), httpServerInfo.getHttpExternalUri().getScheme());
  assertEquals(httpServerInfo.getHttpUri().getPort(), httpServerInfo.getHttpExternalUri().getPort());
  assertEquals(httpServerInfo.getHttpUri().getScheme(), "http");
  assertFalse(config.isHttpsEnabled());
  assertNull(httpServerInfo.getHttpsUri());
  assertNull(httpServerInfo.getHttpsExternalUri());
  assertNull(httpServerInfo.getHttpsChannel());
  assertTrue(config.isAdminEnabled());
  assertNotNull(httpServerInfo.getAdminUri());
  assertNotNull(httpServerInfo.getAdminExternalUri());
  assertNotNull(httpServerInfo.getAdminChannel());
  assertEquals(httpServerInfo.getAdminUri().getScheme(), httpServerInfo.getAdminExternalUri().getScheme());
  assertEquals(httpServerInfo.getAdminUri().getPort(), httpServerInfo.getAdminExternalUri().getPort());
  assertEquals(httpServerInfo.getAdminUri().getScheme(), "http");
  assertNotEquals(httpServerInfo.getHttpUri().getPort(), httpServerInfo.getAdminUri().getPort());
}

代码示例来源:origin: airlift/airlift

@Test
public void testTestingNode()
    throws UnknownHostException
{
  long testStartTime = System.currentTimeMillis();
  Injector injector = Guice.createInjector(new TestingNodeModule());
  NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);
  assertNotNull(nodeInfo);
  assertTrue(nodeInfo.getEnvironment().matches("test\\d+"));
  assertEquals(nodeInfo.getPool(), "general");
  assertNotNull(nodeInfo.getNodeId());
  assertNotNull(nodeInfo.getLocation());
  assertNull(nodeInfo.getBinarySpec());
  assertNull(nodeInfo.getConfigSpec());
  assertNotNull(nodeInfo.getInstanceId());
  assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  assertEquals(nodeInfo.getInternalAddress(), "127.0.0.1");
  assertEquals(nodeInfo.getBindIp(), InetAddress.getByName(nodeInfo.getInternalAddress()));
  assertEquals(nodeInfo.getExternalAddress(), "127.0.0.1");
  assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: airlift/airlift

assertNotNull(nodeInfo.getInstanceId());
assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());

代码示例来源:origin: airlift/airlift

@Test
public void testDefaultConfig()
    throws UnknownHostException
{
  long testStartTime = System.currentTimeMillis();
  ConfigurationFactory configFactory = new ConfigurationFactory(ImmutableMap.<String, String>of("node.environment", "environment"));
  Injector injector = Guice.createInjector(new NodeModule(), new ConfigurationModule(configFactory));
  NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);
  assertNotNull(nodeInfo);
  assertEquals(nodeInfo.getEnvironment(), "environment");
  assertEquals(nodeInfo.getPool(), "general");
  assertNotNull(nodeInfo.getNodeId());
  assertNotNull(nodeInfo.getLocation());
  assertNull(nodeInfo.getBinarySpec());
  assertNull(nodeInfo.getConfigSpec());
  assertNotNull(nodeInfo.getInstanceId());
  assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  assertNotNull(nodeInfo.getInternalAddress());
  assertFalse(InetAddress.getByName(nodeInfo.getInternalAddress()).isAnyLocalAddress());
  assertNotNull(nodeInfo.getBindIp());
  assertTrue(nodeInfo.getBindIp().isAnyLocalAddress());
  assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: com.teradata.airlift/node

@Test
public void testTestingNode()
{
  long testStartTime = System.currentTimeMillis();
  Injector injector = Guice.createInjector(new TestingNodeModule());
  NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);
  assertNotNull(nodeInfo);
  assertTrue(nodeInfo.getEnvironment().matches("test\\d+"));
  assertEquals(nodeInfo.getPool(), "general");
  assertNotNull(nodeInfo.getNodeId());
  assertNotNull(nodeInfo.getLocation());
  assertNull(nodeInfo.getBinarySpec());
  assertNull(nodeInfo.getConfigSpec());
  assertNotNull(nodeInfo.getInstanceId());
  assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  assertEquals(nodeInfo.getInternalIp().toString(), "localhost/127.0.0.1");
  assertEquals(nodeInfo.getBindIp(), nodeInfo.getInternalIp());
  assertEquals(nodeInfo.getExternalAddress(), "127.0.0.1");
  assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: io.airlift/node

@Test
public void testDefaultConfig()
    throws UnknownHostException
{
  long testStartTime = System.currentTimeMillis();
  ConfigurationFactory configFactory = new ConfigurationFactory(ImmutableMap.<String, String>of("node.environment", "environment"));
  Injector injector = Guice.createInjector(new NodeModule(), new ConfigurationModule(configFactory));
  NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);
  assertNotNull(nodeInfo);
  assertEquals(nodeInfo.getEnvironment(), "environment");
  assertEquals(nodeInfo.getPool(), "general");
  assertNotNull(nodeInfo.getNodeId());
  assertNotNull(nodeInfo.getLocation());
  assertNull(nodeInfo.getBinarySpec());
  assertNull(nodeInfo.getConfigSpec());
  assertNotNull(nodeInfo.getInstanceId());
  assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  assertNotNull(nodeInfo.getInternalAddress());
  assertFalse(InetAddress.getByName(nodeInfo.getInternalAddress()).isAnyLocalAddress());
  assertNotNull(nodeInfo.getBindIp());
  assertTrue(nodeInfo.getBindIp().isAnyLocalAddress());
  assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: com.teradata.airlift/node

@Test
public void testDefaultConfig()
{
  long testStartTime = System.currentTimeMillis();
  ConfigurationFactory configFactory = new ConfigurationFactory(ImmutableMap.<String, String>of("node.environment", "environment"));
  Injector injector = Guice.createInjector(new NodeModule(), new ConfigurationModule(configFactory));
  NodeInfo nodeInfo = injector.getInstance(NodeInfo.class);
  Assert.assertNotNull(nodeInfo);
  Assert.assertEquals(nodeInfo.getEnvironment(), "environment");
  Assert.assertEquals(nodeInfo.getPool(), "general");
  Assert.assertNotNull(nodeInfo.getNodeId());
  Assert.assertNotNull(nodeInfo.getLocation());
  Assert.assertNull(nodeInfo.getBinarySpec());
  Assert.assertNull(nodeInfo.getConfigSpec());
  Assert.assertNotNull(nodeInfo.getInstanceId());
  Assertions.assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  Assert.assertNotNull(nodeInfo.getInternalIp());
  Assert.assertFalse(nodeInfo.getInternalIp().isAnyLocalAddress());
  Assert.assertNotNull(nodeInfo.getBindIp());
  Assert.assertTrue(nodeInfo.getBindIp().isAnyLocalAddress());
  Assertions.assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  Assert.assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: com.teradata.airlift/node

@Test
public void testBasicNodeInfo()
{
  long testStartTime = System.currentTimeMillis();
  String nodeId = "nodeId";
  String location = "location";
  String binarySpec = "binary";
  String configSpec = "config";
  InetAddress internalIp = InetAddresses.forString("10.0.0.22");
  InetAddress bindIp = InetAddresses.forString("10.0.0.33");
  String externalAddress = "external";
  NodeInfo nodeInfo = new NodeInfo(ENVIRONMENT, POOL, nodeId, internalIp, bindIp, externalAddress, location, binarySpec, configSpec);
  Assert.assertEquals(nodeInfo.getEnvironment(), ENVIRONMENT);
  Assert.assertEquals(nodeInfo.getPool(), POOL);
  Assert.assertEquals(nodeInfo.getNodeId(), nodeId);
  Assert.assertEquals(nodeInfo.getLocation(), location);
  Assert.assertEquals(nodeInfo.getBinarySpec(), binarySpec);
  Assert.assertEquals(nodeInfo.getConfigSpec(), configSpec);
  Assert.assertNotNull(nodeInfo.getInstanceId());
  Assertions.assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  Assert.assertEquals(nodeInfo.getInternalIp(), internalIp);
  Assert.assertEquals(nodeInfo.getExternalAddress(), externalAddress);
  Assert.assertEquals(nodeInfo.getBindIp(), bindIp);
  Assertions.assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  Assert.assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: airlift/airlift

@Test
public void testBasicNodeInfo()
{
  long testStartTime = System.currentTimeMillis();
  String nodeId = "nodeId";
  String location = "location";
  String binarySpec = "binary";
  String configSpec = "config";
  String internalIp = "10.0.0.22";
  InetAddress bindIp = InetAddresses.forString("10.0.0.33");
  String externalAddress = "external";
  NodeInfo nodeInfo = new NodeInfo(ENVIRONMENT, POOL, nodeId, internalIp, bindIp, externalAddress, location, binarySpec, configSpec, IP);
  assertEquals(nodeInfo.getEnvironment(), ENVIRONMENT);
  assertEquals(nodeInfo.getPool(), POOL);
  assertEquals(nodeInfo.getNodeId(), nodeId);
  assertEquals(nodeInfo.getLocation(), location);
  assertEquals(nodeInfo.getBinarySpec(), binarySpec);
  assertEquals(nodeInfo.getConfigSpec(), configSpec);
  assertNotNull(nodeInfo.getInstanceId());
  assertNotEquals(nodeInfo.getNodeId(), nodeInfo.getInstanceId());
  assertEquals(nodeInfo.getInternalAddress(), internalIp);
  assertEquals(nodeInfo.getExternalAddress(), externalAddress);
  assertEquals(nodeInfo.getBindIp(), bindIp);
  assertGreaterThanOrEqual(nodeInfo.getStartTime(), testStartTime);
  // make sure toString doesn't throw an exception
  assertNotNull(nodeInfo.toString());
}

代码示例来源:origin: airlift/airship

@Test
public void testRestart()
    throws Exception
{
  initializeOneAgent();
  appleSlot1.start();
  coordinator.updateAllAgentsAndWait();
  assertEquals(appleSlot1.status().getState(), RUNNING);
  File pidFile = newFile(appleSlot1.status().getInstallPath(), "..", "installation", "launcher.pid").getCanonicalFile();
  String pidBeforeRestart = Files.readFirstLine(pidFile, Charsets.UTF_8);
  Request request = Request.Builder.preparePut()
      .setUri(coordinatorUriBuilder().appendPath("/v1/slot/lifecycle").addParameter("binary", "*:apple:*").build())
      .setBodyGenerator(createStaticBodyGenerator("restarting", UTF_8))
      .build();
  List<SlotStatusRepresentation> actual = httpClient.execute(request, createJsonResponseHandler(slotStatusesCodec, Status.OK.getStatusCode()));
  List<SlotStatusRepresentation> expected = ImmutableList.of(
      slotStatusRepresentationFactory.create(appleSlot1.status().changeInstanceId(agentInstanceId)),
      slotStatusRepresentationFactory.create(appleSlot2.status().changeInstanceId(agentInstanceId)));
  assertEqualsNoOrder(actual, expected);
  assertEquals(appleSlot1.status().getState(), RUNNING);
  assertEquals(appleSlot2.status().getState(), RUNNING);
  assertEquals(bananaSlot.status().getState(), STOPPED);
  String pidAfterRestart = Files.readFirstLine(pidFile, Charsets.UTF_8);
  assertNotEquals(pidAfterRestart, pidBeforeRestart);
}

相关文章