Skip to content

Commit

Permalink
Refactor: Classes for checking components and ensembles moved to
Browse files Browse the repository at this point in the history
separate package .deeco.annotations.checking.
  • Loading branch information
jiracekz committed Mar 17, 2015
1 parent 3e4afeb commit 58c8b72
Show file tree
Hide file tree
Showing 21 changed files with 94 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;

import java.util.Arrays;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import cz.cuni.mff.d3s.deeco.annotations.processor.AnnotationProcessor;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance;
import cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

/**
* Thrown when validating a component/ensemble definition. Used by classes that implement {@link AnnotationChecker}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.Type;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

public class KnowledgePathCheckException extends Exception {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.Type;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.Field;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

public class ParameterException extends Exception {

private static final long serialVersionUID = 1L;

public ParameterException() {
// TODO Auto-generated constructor stub
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgePath;
import cz.cuni.mff.d3s.deeco.model.runtime.api.Parameter;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ParameterKind;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNode;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeComponentId;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeCoordinator;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeField;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMapKey;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMember;
import cz.cuni.mff.d3s.deeco.task.ParamHolder;

public class ParameterKnowledgePathExtractor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.Type;

import cz.cuni.mff.d3s.deeco.annotations.CoordinatorRole;
import cz.cuni.mff.d3s.deeco.annotations.MemberRole;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.Field;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand All @@ -16,18 +13,14 @@
import cz.cuni.mff.d3s.deeco.annotations.MemberRole;
import cz.cuni.mff.d3s.deeco.annotations.PlaysRole;
import cz.cuni.mff.d3s.deeco.annotations.Role;
import cz.cuni.mff.d3s.deeco.annotations.processor.ParameterKnowledgePathExtractor.KnowledgePathAndType;
import cz.cuni.mff.d3s.deeco.annotations.checking.ParameterKnowledgePathExtractor.KnowledgePathAndType;
import cz.cuni.mff.d3s.deeco.annotations.processor.AnnotationProcessor;
import cz.cuni.mff.d3s.deeco.logging.Log;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ComponentInstance;
import cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition;
import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgePath;
import cz.cuni.mff.d3s.deeco.model.runtime.api.Parameter;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ParameterKind;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNode;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeComponentId;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeCoordinator;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeField;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMapKey;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMember;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.lang.reflect.Type;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @author Zbyněk Jiráček
*
*/
package cz.cuni.mff.d3s.deeco.annotations.checking;
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
import cz.cuni.mff.d3s.deeco.annotations.RoleDefinition;
import cz.cuni.mff.d3s.deeco.annotations.RoleParam;
import cz.cuni.mff.d3s.deeco.annotations.TriggerOnChange;
import cz.cuni.mff.d3s.deeco.annotations.checking.AnnotationChecker;
import cz.cuni.mff.d3s.deeco.annotations.checking.AnnotationCheckerException;
import cz.cuni.mff.d3s.deeco.annotations.checking.RoleAnnotationsHelper;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ComponentIdentifier;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ParseException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.PathOrigin;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,17 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.atMost;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.times;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import cz.cuni.mff.d3s.deeco.annotations.Component;
import cz.cuni.mff.d3s.deeco.annotations.PlaysRole;
import cz.cuni.mff.d3s.deeco.annotations.Role;

public class GenericTypeComparerTest {

@Rule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand All @@ -13,7 +13,6 @@
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;

import org.junit.Rule;
Expand All @@ -22,9 +21,13 @@
import org.mockito.Mockito;

import cz.cuni.mff.d3s.deeco.annotations.Role;
import cz.cuni.mff.d3s.deeco.annotations.checking.KnowledgePathCheckException;
import cz.cuni.mff.d3s.deeco.annotations.checking.KnowledgePathCheckerImpl;
import cz.cuni.mff.d3s.deeco.annotations.checking.TypeComparer;
import cz.cuni.mff.d3s.deeco.annotations.checking.KnowledgePathCheckerImpl.PathNodeCheckingException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ParseException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.PathOrigin;
import cz.cuni.mff.d3s.deeco.annotations.processor.KnowledgePathCheckerImpl.PathNodeCheckingException;
import cz.cuni.mff.d3s.deeco.annotations.processor.AnnotationProcessorException;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNode;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeField;
import cz.cuni.mff.d3s.deeco.task.KnowledgePathHelper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand All @@ -16,9 +16,12 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;

import cz.cuni.mff.d3s.deeco.annotations.checking.ParameterException;
import cz.cuni.mff.d3s.deeco.annotations.checking.ParameterKnowledgePathExtractor;
import cz.cuni.mff.d3s.deeco.annotations.checking.ParameterKnowledgePathExtractor.KnowledgePathAndType;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ParseException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.PathOrigin;
import cz.cuni.mff.d3s.deeco.annotations.processor.ParameterKnowledgePathExtractor.KnowledgePathAndType;
import cz.cuni.mff.d3s.deeco.annotations.processor.AnnotationProcessorException;
import cz.cuni.mff.d3s.deeco.model.runtime.api.Parameter;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ParameterKind;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;
package cz.cuni.mff.d3s.deeco.annotations.checking;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
Expand All @@ -10,7 +10,6 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -32,18 +31,22 @@
import cz.cuni.mff.d3s.deeco.annotations.MemberRole;
import cz.cuni.mff.d3s.deeco.annotations.PlaysRole;
import cz.cuni.mff.d3s.deeco.annotations.Role;
import cz.cuni.mff.d3s.deeco.annotations.processor.ParameterKnowledgePathExtractor.KnowledgePathAndType;
import cz.cuni.mff.d3s.deeco.annotations.checking.AnnotationCheckerException;
import cz.cuni.mff.d3s.deeco.annotations.checking.KnowledgePathCheckException;
import cz.cuni.mff.d3s.deeco.annotations.checking.KnowledgePathChecker;
import cz.cuni.mff.d3s.deeco.annotations.checking.ParameterException;
import cz.cuni.mff.d3s.deeco.annotations.checking.ParameterKnowledgePathExtractor;
import cz.cuni.mff.d3s.deeco.annotations.checking.RolesAnnotationChecker;
import cz.cuni.mff.d3s.deeco.annotations.checking.TypeComparer;
import cz.cuni.mff.d3s.deeco.annotations.checking.ParameterKnowledgePathExtractor.KnowledgePathAndType;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ParseException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.PathOrigin;
import cz.cuni.mff.d3s.deeco.annotations.processor.AnnotationProcessorException;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongCE1;
import cz.cuni.mff.d3s.deeco.model.runtime.api.EnsembleDefinition;
import cz.cuni.mff.d3s.deeco.model.runtime.api.Parameter;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ParameterKind;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeCoordinator;
import cz.cuni.mff.d3s.deeco.model.runtime.impl.PathNodeCoordinatorImpl;
import cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataFactory;
import cz.cuni.mff.d3s.deeco.task.KnowledgePathHelper;
import cz.cuni.mff.d3s.deeco.task.ParamHolder;

public class RolesAnnotationCheckerTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
package cz.cuni.mff.d3s.deeco.annotations.processor;

import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import static org.hamcrest.CoreMatchers.isA;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

Expand All @@ -19,7 +26,6 @@
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand All @@ -29,18 +35,47 @@

import cz.cuni.mff.d3s.deeco.annotations.CoordinatorRole;
import cz.cuni.mff.d3s.deeco.annotations.Ensemble;
import cz.cuni.mff.d3s.deeco.annotations.In;
import cz.cuni.mff.d3s.deeco.annotations.InOut;
import cz.cuni.mff.d3s.deeco.annotations.KnowledgeExchange;
import cz.cuni.mff.d3s.deeco.annotations.MemberRole;
import cz.cuni.mff.d3s.deeco.annotations.Membership;
import cz.cuni.mff.d3s.deeco.annotations.Out;
import cz.cuni.mff.d3s.deeco.annotations.PeriodicScheduling;
import cz.cuni.mff.d3s.deeco.annotations.Role;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ParseException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.PathOrigin;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.TokenMgrError;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.*;
import cz.cuni.mff.d3s.deeco.annotations.checking.AnnotationChecker;
import cz.cuni.mff.d3s.deeco.annotations.checking.AnnotationCheckerException;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.C1C2C3E1E2E3;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.ChildOfCorrectC1;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC1;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC2;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC3;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC4;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC5;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectC6;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectE1;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectE2;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectE3;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.CorrectE4;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC1;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC10;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC11;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC12;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC13;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC2;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC3;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC4;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC4WithSecurity;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC6;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC7;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC8;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongC9;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongCE1;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongE1;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongE2;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongE3;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongE4;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongE5;
import cz.cuni.mff.d3s.deeco.annotations.processor.input.samples.WrongE6;
import cz.cuni.mff.d3s.deeco.integrity.ReadonlyRatingsHolder;
import cz.cuni.mff.d3s.deeco.knowledge.ChangeSet;
import cz.cuni.mff.d3s.deeco.knowledge.CloningKnowledgeManagerFactory;
Expand All @@ -55,17 +90,12 @@
import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgePath;
import cz.cuni.mff.d3s.deeco.model.runtime.api.KnowledgeSecurityTag;
import cz.cuni.mff.d3s.deeco.model.runtime.api.ParameterKind;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeComponentId;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeCoordinator;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeField;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathNodeMapKey;
import cz.cuni.mff.d3s.deeco.model.runtime.api.PathSecurityRoleArgument;
import cz.cuni.mff.d3s.deeco.model.runtime.api.RatingsProcess;
import cz.cuni.mff.d3s.deeco.model.runtime.api.RuntimeMetadata;
import cz.cuni.mff.d3s.deeco.model.runtime.api.SecurityRole;
import cz.cuni.mff.d3s.deeco.model.runtime.meta.RuntimeMetadataFactory;
import cz.cuni.mff.d3s.deeco.runtime.DEECoException;
import cz.cuni.mff.d3s.deeco.runtime.DEECoNode;
import cz.cuni.mff.d3s.deeco.runtime.DuplicateEnsembleDefinitionException;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.junit.Test;
import org.junit.rules.ExpectedException;

import cz.cuni.mff.d3s.deeco.annotations.checking.AnnotationChecker;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.ParseException;
import cz.cuni.mff.d3s.deeco.annotations.pathparser.PathOrigin;
import cz.cuni.mff.d3s.deeco.annotations.processor.ModelValidationError.Severity;
Expand Down

0 comments on commit 58c8b72

Please sign in to comment.