Giter VIP home page Giter VIP logo

dnscontrol's Introduction

OpenPojo Build Status Coverage Status Maven Central

POJO Testing & Identity Management Made Trivial

Maven Group Plugin Latest Version
com.openpojo.openpojo 0.9.1

Testing Example

public class PojoTest {
  // Configured for expectation, so we know when a class gets added or removed.
  private static final int EXPECTED_CLASS_COUNT = 1;

  // The package to test
  private static final String POJO_PACKAGE = "com.openpojo.sample";

  @Test
  public void ensureExpectedPojoCount() {
    List <PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(POJO_PACKAGE,
                                                                   new FilterPackageInfo());
    Affirm.affirmEquals("Classes added / removed?", EXPECTED_CLASS_COUNT, pojoClasses.size());
  }

  @Test
  public void testPojoStructureAndBehavior() {
    Validator validator = ValidatorBuilder.create()
                            // Add Rules to validate structure for POJO_PACKAGE
                            // See com.openpojo.validation.rule.impl for more ...
                            .with(new GetterMustExistRule())
                            .with(new SetterMustExistRule())
                            // Add Testers to validate behaviour for POJO_PACKAGE
                            // See com.openpojo.validation.test.impl for more ...
                            .with(new SetterTester())
                            .with(new GetterTester())
                            .build();

    validator.validate(POJO_PACKAGE, new FilterPackageInfo());
  }
}

Identity Management Example

public class Person {
  @BusinessKey(caseSensitive = false)  //Configure your field(s)
  private String lastName;

  @Override
  public boolean equals(Object obj) {
    return BusinessIdentity.areEqual(this, obj);
  }

  @Override
  public int hashCode() {
    return BusinessIdentity.getHashCode(this);
  }

  @Override
  public String toString() {
      return BusinessIdentity.toString(this);
  }
}

For more examples and the tutorials see the Wiki

dnscontrol's People

Contributors

oshoukry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dnscontrol's Issues

Error starting up if system attempts lookup for localhost.

Currently exceptions are thrown if service attempts to access "localhost".

The main reason is due to throwing an exception other than "UnknownHostException()" which is currently being trapped by InetAddress and handled if the hostname in question is "localhost"

Add support for Java 9

Java 9 seems to have abandoned the NameService architecture all together and doesn't provide a way to provide your own implementation, a work around will be necessary should DNSControl survive beyond Java 8.

Change default setting for dns lookup to utilize Edns 0

When using the library to lookup TXT records, it is highly likely that record size will be greater than 512 bytes.

It would be advantageous to allow the library to run with EDNS0 by default and up to 4000 bytes buffer limit.

If InetAddress has not been initialized, and a call was made to DNSControl.getInstance() a null pointer exception is thrown.

If InetAddress hasn't been initialized yet and provider is set to dnscontrol any call to the DNSControl will trigger the constructor which attempts to lookup default dns servers making calls back to InetAddress which intern attempts to initialize by calling the NameService, which requires DNSControl instance to register. This loop throw a null pointer exception.

DNSControl constructor should not make any calls that yield to InetAddress getting loaded.

Remove OpenPojo Loggers upon startup.

An attempt to call Loggers upon startup will cause Null pointer exception:

09:33:14,854 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@2:16 - RuntimeException in Action for tag [configuration] java.lang.NullPointerException
	at java.lang.NullPointerException
	at 	at java.net.InetAddress.getLocalHost(InetAddress.java:1485)
	at 	at ch.qos.logback.core.util.ContextUtil.getLocalHostName(ContextUtil.java:37)
	at 	at ch.qos.logback.core.util.ContextUtil.addHostNameAsProperty(ContextUtil.java:67)
	at 	at ch.qos.logback.classic.joran.action.ConfigurationAction.begin(ConfigurationAction.java:65)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.callBeginAction(Interpreter.java:269)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:145)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.startElement(Interpreter.java:128)
	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:50)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:155)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:142)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:103)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at 	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
	at 	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at 	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at 	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
	at 	at com.openpojo.log.impl.SLF4JLogger.<init>(SLF4JLogger.java:42)
	at 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at 	at com.openpojo.log.LoggerFactory.createNewLoggerInstance(LoggerFactory.java:106)
	at 	at com.openpojo.log.LoggerFactory.getLogger(LoggerFactory.java:81)
	at 	at com.openpojo.log.LoggerFactory.reportActiveLogger(LoggerFactory.java:123)
	at 	at com.openpojo.log.LoggerFactory.setActiveLogger(LoggerFactory.java:93)
	at 	at com.openpojo.log.LoggerFactory.autoDetect(LoggerFactory.java:58)
	at 	at com.openpojo.log.LoggerFactory.<clinit>(LoggerFactory.java:47)
	at 	at com.openpojo.dns.service.JavaNameService.<clinit>(JavaNameService.java:35)
	at 	at com.openpojo.dns.service.JavaNameServiceDescriptor.<init>(JavaNameServiceDescriptor.java:37)
	at 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at 	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at 	at java.lang.Class.newInstance(Class.java:442)
	at 	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
	at 	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at 	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at 	at java.net.InetAddress$3.run(InetAddress.java:945)
	at 	at java.net.InetAddress$3.run(InetAddress.java:939)
	at 	at java.security.AccessController.doPrivileged(Native Method)
	at 	at java.net.InetAddress.createNSProvider(InetAddress.java:938)
	at 	at java.net.InetAddress.<clinit>(InetAddress.java:983)
	at 	at java.net.InetSocketAddress.<init>(InetSocketAddress.java:220)
	at 	at java.net.Socket.<init>(Socket.java:211)
	at 	at com.intellij.rt.execution.application.AppMainV2$1.run(AppMainV2.java:59)

Hosts file reload

Reload hosts file if changed while running using file timestamps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.