├── .gitignore
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── ThreatDragonModels
└── Test
│ └── Test.json
├── add-copyright-to-java.sh
├── associations.md
├── config
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ └── config
│ │ ├── AbstractMetadataConfiguration.java
│ │ ├── ConfigConstants.java
│ │ ├── ControllerConfiguration.java
│ │ ├── ControllerFactory.java
│ │ ├── CrudConfiguration.java
│ │ ├── DataSourceConfiguration.java
│ │ ├── DataSourcesConfiguration.java
│ │ ├── JsonTranslator.java
│ │ ├── LightblueFactory.java
│ │ ├── LightblueFactoryAware.java
│ │ ├── MetadataConfiguration.java
│ │ ├── SavedSearchConfiguration.java
│ │ └── SimpleHookResolver.java
│ └── test
│ ├── java
│ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ ├── config
│ │ ├── CRUDFactory.java
│ │ ├── CrudValidationTest.java
│ │ ├── LightblueFactoryTest.java
│ │ ├── MetadataConfigurationTest.java
│ │ ├── TestCRUDController.java
│ │ ├── TestConfig.java
│ │ ├── TestDataStoreParser.java
│ │ ├── TestHookConfigurationParser.java
│ │ └── TestPropertyParser.java
│ │ └── metadata
│ │ └── test
│ │ └── DatabaseMetadata.java
│ └── resources
│ ├── invalid-deletion-req.json
│ ├── lightblue-crud.json
│ ├── lightblue-metadata.json
│ ├── simplelogger.properties
│ └── valid-deletion-req.json
├── core-api
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ ├── BaseResponse.java
│ │ ├── ClientIdentification.java
│ │ ├── DataError.java
│ │ ├── EntityVersion.java
│ │ ├── ExecutionOptions.java
│ │ ├── JsonNodeBuilder.java
│ │ ├── OperationStatus.java
│ │ ├── Request.java
│ │ ├── Response.java
│ │ ├── ResultMetadata.java
│ │ ├── SessionInfo.java
│ │ └── crud
│ │ └── CRUDOperation.java
│ └── test
│ └── java
│ └── com
│ └── redhat
│ └── lightblue
│ ├── EntityVersionTest.java
│ ├── JsonNodeBuilderTest.java
│ ├── RequestTest.java
│ └── ResponseTest.java
├── crud
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── redhat
│ │ │ └── lightblue
│ │ │ ├── assoc
│ │ │ ├── AnalyzeQuery.java
│ │ │ ├── AssocConstants.java
│ │ │ ├── BindQuery.java
│ │ │ ├── Binder.java
│ │ │ ├── BoundList.java
│ │ │ ├── BoundObject.java
│ │ │ ├── BoundValue.java
│ │ │ ├── CompositeFindImpl.java
│ │ │ ├── Conjunct.java
│ │ │ ├── ConnMx.java
│ │ │ ├── QueryFieldInfo.java
│ │ │ ├── QueryPlan.java
│ │ │ ├── QueryPlanChooser.java
│ │ │ ├── QueryPlanData.java
│ │ │ ├── QueryPlanIterator.java
│ │ │ ├── QueryPlanNode.java
│ │ │ ├── QueryPlanScorer.java
│ │ │ ├── RewriteQuery.java
│ │ │ ├── ep
│ │ │ │ ├── AbstractSearchStep.java
│ │ │ │ ├── Assemble.java
│ │ │ │ ├── AssociationQuery.java
│ │ │ │ ├── ChildSlot.java
│ │ │ │ ├── Copy.java
│ │ │ │ ├── ExecutionBlock.java
│ │ │ │ ├── ExecutionContext.java
│ │ │ │ ├── ExecutionPlan.java
│ │ │ │ ├── Filter.java
│ │ │ │ ├── Join.java
│ │ │ │ ├── JoinSearch.java
│ │ │ │ ├── JoinTuple.java
│ │ │ │ ├── Limit.java
│ │ │ │ ├── ListStepResult.java
│ │ │ │ ├── MakeDocCtx.java
│ │ │ │ ├── Project.java
│ │ │ │ ├── ResultDocument.java
│ │ │ │ ├── Retrieve.java
│ │ │ │ ├── Search.java
│ │ │ │ ├── Searches.java
│ │ │ │ ├── Skip.java
│ │ │ │ ├── SortResults.java
│ │ │ │ ├── Source.java
│ │ │ │ ├── Step.java
│ │ │ │ ├── StepResult.java
│ │ │ │ ├── StepResultDocumentStream.java
│ │ │ │ ├── StepResultWrapper.java
│ │ │ │ └── Unique.java
│ │ │ ├── iterators
│ │ │ │ ├── BruteForceQueryPlanIterator.java
│ │ │ │ └── First.java
│ │ │ ├── qrew
│ │ │ │ ├── QueryRewriter.java
│ │ │ │ ├── Rewriter.java
│ │ │ │ └── rules
│ │ │ │ │ ├── CombineANDsToNIN.java
│ │ │ │ │ ├── CombineComparisonsToInNotIn.java
│ │ │ │ │ ├── CombineINsInOR.java
│ │ │ │ │ ├── CombineInsNotIns.java
│ │ │ │ │ ├── CombineNINsInAND.java
│ │ │ │ │ ├── CombineORsToIN.java
│ │ │ │ │ ├── EliminateNOT.java
│ │ │ │ │ ├── EliminateNOTNOT.java
│ │ │ │ │ ├── EliminateNOTOR.java
│ │ │ │ │ ├── EliminateSingleANDOR.java
│ │ │ │ │ ├── ExtendINsInOR.java
│ │ │ │ │ ├── ExtendNINsInAND.java
│ │ │ │ │ ├── ExtendRelationalInLogical.java
│ │ │ │ │ ├── PromoteNestedAND.java
│ │ │ │ │ └── SimpleElemMatchIsComparison.java
│ │ │ └── scorers
│ │ │ │ ├── CostAndSize.java
│ │ │ │ ├── IndexedFieldScorer.java
│ │ │ │ ├── IndexedFieldScorerData.java
│ │ │ │ └── SimpleScorer.java
│ │ │ ├── crud
│ │ │ ├── AbstractBulkJsonObject.java
│ │ │ ├── BulkRequest.java
│ │ │ ├── BulkResponse.java
│ │ │ ├── CRUDController.java
│ │ │ ├── CRUDDeleteResponse.java
│ │ │ ├── CRUDFindRequest.java
│ │ │ ├── CRUDFindResponse.java
│ │ │ ├── CRUDHealth.java
│ │ │ ├── CRUDInsertionResponse.java
│ │ │ ├── CRUDJsonNodeBuilder.java
│ │ │ ├── CRUDOperationContext.java
│ │ │ ├── CRUDSaveResponse.java
│ │ │ ├── CRUDUpdateResponse.java
│ │ │ ├── ConstraintValidator.java
│ │ │ ├── CrudConstants.java
│ │ │ ├── DeleteRequest.java
│ │ │ ├── DocCtx.java
│ │ │ ├── DocRequest.java
│ │ │ ├── DocumentStream.java
│ │ │ ├── EntityConstraintChecker.java
│ │ │ ├── ExplainQuerySupport.java
│ │ │ ├── Factory.java
│ │ │ ├── FieldConstraintChecker.java
│ │ │ ├── FieldConstraintDocChecker.java
│ │ │ ├── FieldConstraintValueChecker.java
│ │ │ ├── FindRequest.java
│ │ │ ├── InsertionRequest.java
│ │ │ ├── ListDocumentStream.java
│ │ │ ├── MetadataResolver.java
│ │ │ ├── RewindableDocumentStream.java
│ │ │ ├── SaveRequest.java
│ │ │ ├── UpdateRequest.java
│ │ │ ├── WithIfCurrent.java
│ │ │ ├── WithProjection.java
│ │ │ ├── WithQuery.java
│ │ │ ├── WithRange.java
│ │ │ ├── interceptors
│ │ │ │ └── UIDInterceptor.java
│ │ │ ├── validator
│ │ │ │ ├── ArrayElementIdChecker.java
│ │ │ │ ├── ArraySizeChecker.java
│ │ │ │ ├── DefaultFieldConstraintValidators.java
│ │ │ │ ├── EmptyEntityConstraintValidators.java
│ │ │ │ ├── EmptyFieldConstraintDocChecker.java
│ │ │ │ ├── EnumChecker.java
│ │ │ │ ├── IdentityChecker.java
│ │ │ │ ├── MatchesChecker.java
│ │ │ │ ├── MinMaxChecker.java
│ │ │ │ ├── RequiredChecker.java
│ │ │ │ └── StringLengthChecker.java
│ │ │ └── valuegenerators
│ │ │ │ ├── CurrentTimeGenerator.java
│ │ │ │ ├── GeneratedFieldInterceptor.java
│ │ │ │ ├── GeneratedFields.java
│ │ │ │ ├── GeneratorKey.java
│ │ │ │ ├── GeneratorsRegistry.java
│ │ │ │ └── UUIDGenerator.java
│ │ │ ├── eval
│ │ │ ├── ArrayAddExpressionEvaluator.java
│ │ │ ├── ArrayContainsEvaluator.java
│ │ │ ├── ArrayMatchEvaluator.java
│ │ │ ├── ArrayProjector.java
│ │ │ ├── ArrayQueryProjector.java
│ │ │ ├── ArrayRangeProjector.java
│ │ │ ├── EvaluationError.java
│ │ │ ├── FieldAccessRoleEvaluator.java
│ │ │ ├── FieldComparisonEvaluator.java
│ │ │ ├── FieldProjector.java
│ │ │ ├── ForEachExpressionEvaluator.java
│ │ │ ├── ListProjector.java
│ │ │ ├── NaryFieldRelationalExpressionEvaluator.java
│ │ │ ├── NaryLogicalExpressionEvaluator.java
│ │ │ ├── NaryValueRelationalExpressionEvaluator.java
│ │ │ ├── Projector.java
│ │ │ ├── QueryEvaluationContext.java
│ │ │ ├── QueryEvaluator.java
│ │ │ ├── RegexEvaluator.java
│ │ │ ├── SetExpressionEvaluator.java
│ │ │ ├── SortFieldInfo.java
│ │ │ ├── SortableItem.java
│ │ │ ├── UnaryLogicalExpressionEvaluator.java
│ │ │ ├── UnsetExpressionEvaluator.java
│ │ │ ├── UpdateExpressionListEvaluator.java
│ │ │ ├── Updater.java
│ │ │ └── ValueComparisonEvaluator.java
│ │ │ ├── hooks
│ │ │ ├── HookManager.java
│ │ │ ├── HookResolver.java
│ │ │ ├── MediatorHook.java
│ │ │ └── StopHookProcessing.java
│ │ │ ├── interceptor
│ │ │ ├── CRUDControllerInterceptor.java
│ │ │ ├── CRUDDocInterceptor.java
│ │ │ ├── InterceptPoint.java
│ │ │ ├── Interceptor.java
│ │ │ ├── InterceptorManager.java
│ │ │ └── MediatorInterceptor.java
│ │ │ ├── mediator
│ │ │ ├── BulkExecutionContext.java
│ │ │ ├── DefaultMetadataResolver.java
│ │ │ ├── Finder.java
│ │ │ ├── Mediator.java
│ │ │ ├── OperationContext.java
│ │ │ ├── ResponsePayloadSizeCalculator.java
│ │ │ ├── SimpleFindImpl.java
│ │ │ └── StreamingResponse.java
│ │ │ └── mindex
│ │ │ ├── ArrayKey.java
│ │ │ ├── ArrayKeySpec.java
│ │ │ ├── ArrayLookupSpec.java
│ │ │ ├── CompositeKeySpec.java
│ │ │ ├── CompositeLookupSpec.java
│ │ │ ├── GetIndexKeySpec.java
│ │ │ ├── GetIndexLookupSpec.java
│ │ │ ├── IndexQueryProcessorBase.java
│ │ │ ├── Key.java
│ │ │ ├── KeySpec.java
│ │ │ ├── LookupSpec.java
│ │ │ ├── MemDocIndex.java
│ │ │ ├── MultiValueLookupSpec.java
│ │ │ ├── PrefixLookupSpec.java
│ │ │ ├── RangeLookupSpec.java
│ │ │ ├── SimpleKey.java
│ │ │ ├── SimpleKeyLookupSpec.java
│ │ │ ├── SimpleKeySpec.java
│ │ │ └── ValueLookupSpec.java
│ └── resources
│ │ └── json-schema
│ │ ├── bulkRequest.json
│ │ ├── crudCommon.json
│ │ ├── deleteRequest.json
│ │ ├── findRequest.json
│ │ ├── insertRequest.json
│ │ ├── response.json
│ │ ├── saveRequest.json
│ │ └── updateRequest.json
│ └── test
│ ├── java
│ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ ├── TestDataStoreParser.java
│ │ ├── assoc
│ │ ├── AnalyzeQueryTest.java
│ │ ├── BindQueryTest.java
│ │ ├── QueryPlanChooserTest.java
│ │ ├── QueryPlanIteratorTest.java
│ │ ├── QueryPlanTest.java
│ │ ├── RewriteQueryTest.java
│ │ ├── ep
│ │ │ ├── ExecutionPlanTest.java
│ │ │ ├── JoinTest.java
│ │ │ └── SearchesTest.java
│ │ └── qrew
│ │ │ └── QueryRewriterTest.java
│ │ ├── crud
│ │ ├── CRUDFindRequestTest.java
│ │ ├── CRUDJsonNodeBuilderTest.java
│ │ ├── ConstraintValidatorTest.java
│ │ ├── CrudJsonSchemaTest.java
│ │ ├── test
│ │ │ ├── DatabaseConfiguration.java
│ │ │ └── TestCRUDController.java
│ │ ├── validator
│ │ │ ├── ArraySizeCheckerTest.java
│ │ │ ├── EnumCheckerTest.java
│ │ │ ├── IdentifyCheckerTest.java
│ │ │ ├── MinMaxCheckerTest.java
│ │ │ ├── RequiredCheckerTest.java
│ │ │ └── StringLengthCheckerTest.java
│ │ └── valuegenerators
│ │ │ └── GeneratedFieldsTest.java
│ │ ├── eval
│ │ ├── ArrayAddExpressionEvaluatorTest.java
│ │ ├── ArrayContainsEvaluatorTest.java
│ │ ├── ArrayMatchEvaluatorTest.java
│ │ ├── ArrayQueryProjectorTest.java
│ │ ├── ArrayRangeProjectorTest.java
│ │ ├── EvalTestContext.java
│ │ ├── FieldAccessRoleEvaluatorTest.java
│ │ ├── FieldComparisonEvaluatorTest.java
│ │ ├── FieldProjectorTest.java
│ │ ├── ForEachExpressionEvaluatorTest.java
│ │ ├── ListProjectorTest.java
│ │ ├── NaryLogicalExpressionEvaluatorTest.java
│ │ ├── NaryRelationalExpressionEvaluatorTest.java
│ │ ├── ProjectionTest.java
│ │ ├── ProjectorTest.java
│ │ ├── QueryEvalTest.java
│ │ ├── QueryTest.java
│ │ ├── RegexEvaluatorTest.java
│ │ ├── SetExpressionEvaluatorTest.java
│ │ ├── SortTest.java
│ │ ├── UnaryLogicalExpressionEvaluatorTest.java
│ │ ├── UnsetExpressionEvaluatorTest.java
│ │ ├── UpdateExpressionListEvaluatorTest.java
│ │ ├── UpdaterTest.java
│ │ └── ValueComparisonEvaluatorTest.java
│ │ ├── hooks
│ │ └── HookManagerTest.java
│ │ ├── mediator
│ │ ├── AbstractMediatorTest.java
│ │ ├── BulkTest.java
│ │ ├── CompositeFinderTest.java
│ │ ├── CompositeFinderWithIndexingTest.java
│ │ ├── MediatorTest.java
│ │ ├── MockCrudController.java
│ │ └── TestCrudController.java
│ │ ├── metadata
│ │ └── test
│ │ │ ├── DatabaseConfiguration.java
│ │ │ └── DatabaseMetadata.java
│ │ └── mindex
│ │ └── MemDocIndexTest.java
│ └── resources
│ ├── composite
│ ├── A.json
│ ├── A_data.json
│ ├── A_def.json
│ ├── A_def_data.json
│ ├── A_with_index.json
│ ├── A_with_index_data.json
│ ├── B.json
│ ├── B_data.json
│ ├── C.json
│ ├── C_data.json
│ ├── D.json
│ ├── D_data.json
│ ├── L.json
│ ├── L_data.json
│ ├── R.json
│ ├── U.json
│ ├── UC.json
│ ├── UC_data.json
│ ├── U_data.json
│ ├── arr_child.json
│ ├── arr_child_data.json
│ ├── arr_parent.json
│ ├── arr_parent_data.json
│ ├── child_loop.json
│ ├── child_loop_data.json
│ ├── child_w_elem.json
│ ├── child_w_elem_data.json
│ ├── child_w_elem_w_roles.json
│ ├── containerImage-self.json
│ ├── containerImage-self_data.json
│ ├── containerImage.json
│ ├── containerImage_data.json
│ ├── containerRepository.json
│ ├── containerRepository_data.json
│ ├── doc1.json
│ ├── jA.json
│ ├── jA_data.json
│ ├── jB.json
│ ├── jB_data.json
│ ├── parent_w_elem.json
│ ├── parent_w_elem_data.json
│ ├── parent_w_elem_w_roles.json
│ ├── root_loop.json
│ ├── root_loop_data.json
│ ├── root_loop_n_n.json
│ ├── self_ref.json
│ ├── self_ref_array_contains.json
│ ├── self_ref_array_contains_data.json
│ ├── self_ref_array_not_contains.json
│ ├── self_ref_array_not_contains_data.json
│ ├── self_ref_data.json
│ ├── self_ref_default.json
│ ├── self_ref_default_data.json
│ ├── self_ref_err.json
│ ├── self_ref_err_data.json
│ ├── vendors.json
│ └── vendors_data.json
│ ├── crud
│ ├── bulk
│ │ └── schema-test-bulk.json
│ ├── delete
│ │ └── schema-test-delete-simple.json
│ ├── find
│ │ ├── schema-test-find-noq.json
│ │ ├── schema-test-find-simple-0-max.json
│ │ ├── schema-test-find-simple-0-to.json
│ │ ├── schema-test-find-simple-1-max.json
│ │ ├── schema-test-find-simple-from-to.json
│ │ ├── schema-test-find-simple-from.json
│ │ ├── schema-test-find-simple-max.json
│ │ ├── schema-test-find-simple-null-to.json
│ │ ├── schema-test-find-simple-to.json
│ │ └── schema-test-find-simple.json
│ ├── insert
│ │ ├── schema-test-insert-many.json
│ │ └── schema-test-insert-simple.json
│ ├── response
│ │ └── schema-test-response-simple.json
│ ├── save
│ │ ├── schema-test-save-many.json
│ │ └── schema-test-save-simple.json
│ ├── update
│ │ ├── schema-test-update-many.json
│ │ └── schema-test-update-simple.json
│ └── validator
│ │ ├── invalid-simple-array-constraint-doc.json
│ │ ├── schema-test-validation-element-identity.json
│ │ ├── schema-test-validation-empty-array.json
│ │ ├── schema-test-validation-simple.json
│ │ ├── schema-test-validation-testFieldConstraint.json
│ │ ├── simple-array-enum-constraint-doc.json
│ │ ├── testSimpleArrayConstraint.json
│ │ ├── testSimpleArrayEnum.json
│ │ ├── valid-simple-array-constraint-doc.json
│ │ └── valid-simple-array-constraint-emptyarray.json
│ ├── dateCmp-1.json
│ ├── dateCmp-2.json
│ ├── doc-restricted.json
│ ├── gen-overwrite-testdata.json
│ ├── generator-md.json
│ ├── overwrite-md.json
│ ├── sample1.json
│ ├── simplelogger.properties
│ ├── termsdata.json
│ ├── termsmd.json
│ ├── testMetadata-restricted.json
│ ├── testMetadata.json
│ ├── user-complex-md.json
│ ├── user-complex.json
│ ├── userdata.json
│ └── usermd.json
├── etc
├── onFailure.sh
├── onSuccess.sh
├── release.sh
├── settings.xml
└── sonar.sh
├── extensions
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── redhat
│ └── lightblue
│ └── extensions
│ ├── Extension.java
│ ├── ExtensionSupport.java
│ ├── synch
│ ├── InvalidLockException.java
│ ├── Locking.java
│ └── LockingSupport.java
│ └── valuegenerator
│ └── ValueGeneratorSupport.java
├── metadata
├── README
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── redhat
│ │ │ └── lightblue
│ │ │ ├── hooks
│ │ │ ├── CRUDHook.java
│ │ │ └── HookDoc.java
│ │ │ └── metadata
│ │ │ ├── AbstractGetMetadata.java
│ │ │ ├── AbstractMetadata.java
│ │ │ ├── Access.java
│ │ │ ├── ArrayElement.java
│ │ │ ├── ArrayField.java
│ │ │ ├── CompositeMetadata.java
│ │ │ ├── CompositeSchema.java
│ │ │ ├── DataStore.java
│ │ │ ├── Dependency.java
│ │ │ ├── DocId.java
│ │ │ ├── DocIdExtractor.java
│ │ │ ├── EntityAccess.java
│ │ │ ├── EntityConstraint.java
│ │ │ ├── EntityInfo.java
│ │ │ ├── EntityMetadata.java
│ │ │ ├── EntitySchema.java
│ │ │ ├── Enum.java
│ │ │ ├── EnumValue.java
│ │ │ ├── Enums.java
│ │ │ ├── Field.java
│ │ │ ├── FieldAccess.java
│ │ │ ├── FieldConstraint.java
│ │ │ ├── FieldCursor.java
│ │ │ ├── FieldTreeNode.java
│ │ │ ├── Fields.java
│ │ │ ├── Hook.java
│ │ │ ├── HookConfiguration.java
│ │ │ ├── Hooks.java
│ │ │ ├── Index.java
│ │ │ ├── IndexSortKey.java
│ │ │ ├── Indexes.java
│ │ │ ├── Metadata.java
│ │ │ ├── MetadataAccess.java
│ │ │ ├── MetadataConstants.java
│ │ │ ├── MetadataListener.java
│ │ │ ├── MetadataObject.java
│ │ │ ├── MetadataRole.java
│ │ │ ├── MetadataStatus.java
│ │ │ ├── ObjectArrayElement.java
│ │ │ ├── ObjectField.java
│ │ │ ├── PredefinedFields.java
│ │ │ ├── ReferenceField.java
│ │ │ ├── ResolvedReferenceField.java
│ │ │ ├── SimpleArrayElement.java
│ │ │ ├── SimpleField.java
│ │ │ ├── StatusChange.java
│ │ │ ├── Type.java
│ │ │ ├── TypeResolver.java
│ │ │ ├── Types.java
│ │ │ ├── UIDFields.java
│ │ │ ├── ValueGenerator.java
│ │ │ ├── Version.java
│ │ │ ├── VersionInfo.java
│ │ │ ├── constraints
│ │ │ ├── AbstractIntFieldConstraint.java
│ │ │ ├── ArrayElementIdConstraint.java
│ │ │ ├── ArraySizeConstraint.java
│ │ │ ├── EnumConstraint.java
│ │ │ ├── IdentityConstraint.java
│ │ │ ├── MatchesConstraint.java
│ │ │ ├── MinMaxConstraint.java
│ │ │ ├── RequiredConstraint.java
│ │ │ └── StringLengthConstraint.java
│ │ │ ├── parser
│ │ │ ├── ArrayElementIdConstraintParser.java
│ │ │ ├── ArraySizeConstraintParser.java
│ │ │ ├── DataStoreParser.java
│ │ │ ├── DefaultEntityConstraintParsers.java
│ │ │ ├── DefaultFieldConstraintParsers.java
│ │ │ ├── EntityConstraintParser.java
│ │ │ ├── EnumConstraintParser.java
│ │ │ ├── Extensions.java
│ │ │ ├── FieldConstraintParser.java
│ │ │ ├── HookConfigurationParser.java
│ │ │ ├── IdentityConstraintParser.java
│ │ │ ├── JSONMetadataParser.java
│ │ │ ├── MatchesConstraintParser.java
│ │ │ ├── MetadataParser.java
│ │ │ ├── MinMaxConstraintParser.java
│ │ │ ├── Parser.java
│ │ │ ├── ParserRegistry.java
│ │ │ ├── PropertyParser.java
│ │ │ ├── RequiredConstraintParser.java
│ │ │ └── StringLengthConstraintParser.java
│ │ │ ├── translator
│ │ │ ├── NonPersistedPredefinedFieldTranslatorFromJson.java
│ │ │ ├── NonPersistedPredefinedFieldTranslatorToJson.java
│ │ │ ├── TranslatorFromJson.java
│ │ │ └── TranslatorToJson.java
│ │ │ └── types
│ │ │ ├── AnyType.java
│ │ │ ├── Arith.java
│ │ │ ├── ArrayType.java
│ │ │ ├── BigDecimalType.java
│ │ │ ├── BigIntegerType.java
│ │ │ ├── BinaryType.java
│ │ │ ├── BooleanType.java
│ │ │ ├── ContainerType.java
│ │ │ ├── DateType.java
│ │ │ ├── DefaultTypes.java
│ │ │ ├── DoubleType.java
│ │ │ ├── IntegerType.java
│ │ │ ├── ObjectType.java
│ │ │ ├── ReferenceType.java
│ │ │ ├── StringType.java
│ │ │ └── UIDType.java
│ └── resources
│ │ └── json-schema
│ │ └── metadata
│ │ ├── common.json
│ │ ├── entityInfo.json
│ │ ├── hook.json
│ │ ├── metadata.json
│ │ └── schema.json
│ └── test
│ ├── java
│ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ └── metadata
│ │ ├── AbstractGetMetadataTest.java
│ │ ├── CompositeMetadataTest.java
│ │ ├── FieldCursorTest.java
│ │ ├── FullPathResolverTest.java
│ │ ├── HookJsonSchemaInvalidTest.java
│ │ ├── HookJsonSchemaValidTest.java
│ │ ├── IdentityFieldsTest.java
│ │ ├── IndexCaseInsensitiveTest.java
│ │ ├── IndexUsefulnessTest.java
│ │ ├── MetadataJsonSchemaInvalidTest.java
│ │ ├── MetadataJsonSchemaValidTest.java
│ │ ├── MetadataValidationTest.java
│ │ ├── PathResolverTest.java
│ │ ├── PredefinedFieldsTest.java
│ │ ├── RelativePathResolverTest.java
│ │ ├── TestAbstractMetadataTest.java
│ │ ├── UIDTest.java
│ │ ├── ValueGeneratorTest.java
│ │ ├── constraints
│ │ ├── ArraySizeConstraintTest.java
│ │ ├── EntityMetadataTest.java
│ │ ├── EnumConstraintTest.java
│ │ ├── MatchesConstraintTest.java
│ │ ├── MinMaxConstraintTest.java
│ │ ├── RequiredConstraintTest.java
│ │ ├── StringLengthConstraintTest.java
│ │ └── UIDFieldsTest.java
│ │ ├── parser
│ │ ├── ExtensionsTest.java
│ │ ├── JSONMetadataParserTest.java
│ │ └── ParserRegistryTest.java
│ │ ├── test
│ │ ├── DatabaseConfiguration.java
│ │ └── DatabaseMetadata.java
│ │ ├── translator
│ │ ├── TranslatorFromJsonTest.java
│ │ └── TranslatorToJsonTest.java
│ │ └── types
│ │ ├── ArithTest.java
│ │ ├── ArrayTypeTest.java
│ │ ├── BigDecimalTypeTest.java
│ │ ├── BigIntegerTypeTest.java
│ │ ├── BinaryTypeTest.java
│ │ ├── BooleanTypeTest.java
│ │ ├── ContainerTypeTest.java
│ │ ├── DateTypeTest.java
│ │ ├── DefaultTypesTest.java
│ │ ├── DoubleTypeTest.java
│ │ ├── IntegerTypeTest.java
│ │ ├── ObjectTypeTest.java
│ │ ├── ReferenceTypeTest.java
│ │ └── StringTypeTest.java
│ ├── resources
│ ├── BinaryTypeTest-sample.pdf
│ ├── JSONMetadataParserTest-EntityInfo-properties.json
│ ├── JSONMetadataParserTest-array.json
│ ├── JSONMetadataParserTest-object-binary.json
│ ├── JSONMetadataParserTest-object-everything-no-hooks-extra-field.json
│ ├── JSONMetadataParserTest-object-everything-no-hooks.json
│ ├── JSONMetadataParserTest-object-everything.json
│ ├── JSONMetadataParserTest-properties.json
│ ├── JSONMetadataParserTest-valuegenerator.json
│ ├── composite
│ │ ├── A.json
│ │ ├── A_def.json
│ │ ├── B.json
│ │ ├── C.json
│ │ ├── D.json
│ │ ├── R.json
│ │ ├── rel.json
│ │ └── rel2.json
│ ├── hook-json-schema-test-invalid
│ │ └── schema-test-hook-invalid.json
│ ├── hook-json-schema-test-valid
│ │ ├── schema-test-hook-esb.json
│ │ ├── schema-test-hook-find.json
│ │ ├── schema-test-hook-insert.json
│ │ └── schema-test-hook-update.json
│ ├── metadata-json-schema-test-invalid
│ │ ├── schema-test-metadata-array-items-missing-type.json
│ │ ├── schema-test-metadata-invalid-field-access.json
│ │ ├── schema-test-metadata-many-constraints-invalid.json
│ │ └── schema-test-metadata-simple-defaultVersion.json
│ ├── metadata-json-schema-test-valid
│ │ ├── schema-test-metadata-array-enum.json
│ │ ├── schema-test-metadata-array-object.json
│ │ ├── schema-test-metadata-array-simple.json
│ │ ├── schema-test-metadata-array-uid.json
│ │ ├── schema-test-metadata-enum.json
│ │ ├── schema-test-metadata-many-constraints.json
│ │ ├── schema-test-metadata-object-array.json
│ │ ├── schema-test-metadata-object-enum-with-description.json
│ │ ├── schema-test-metadata-object-enum.json
│ │ ├── schema-test-metadata-object-everything.json
│ │ ├── schema-test-metadata-object-object.json
│ │ ├── schema-test-metadata-object-simple.json
│ │ ├── schema-test-metadata-object-valueGenerator.json
│ │ ├── schema-test-metadata-ref-everything.json
│ │ ├── schema-test-metadata-simple-binary.json
│ │ ├── schema-test-metadata-simple-field-access.json
│ │ └── schema-test-metadata-simple.json
│ ├── simplelogger.properties
│ ├── userdata.json
│ ├── usermd.json
│ └── usermdidf.json
│ └── scripts
│ └── junit-prep.sh
├── misc
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── redhat
│ │ │ └── lightblue
│ │ │ └── savedsearch
│ │ │ ├── FindRequestBuilder.java
│ │ │ └── SavedSearchCache.java
│ └── metadata
│ │ └── lb-saved-search.json
│ └── test
│ ├── java
│ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ ├── TestDataStoreParser.java
│ │ ├── metadata
│ │ └── savedsearch
│ │ ├── FindRequestBuilderTest.java
│ │ └── SavedSearchCacheTest.java
│ └── resources
│ ├── savedSearch.json
│ └── simplelogger.properties
├── pom.xml
├── query-api
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── redhat
│ │ │ └── lightblue
│ │ │ └── query
│ │ │ ├── AllMatchExpression.java
│ │ │ ├── ArrayAddExpression.java
│ │ │ ├── ArrayComparisonExpression.java
│ │ │ ├── ArrayContainsExpression.java
│ │ │ ├── ArrayMatchExpression.java
│ │ │ ├── ArrayProjection.java
│ │ │ ├── ArrayQueryMatchProjection.java
│ │ │ ├── ArrayRangeProjection.java
│ │ │ ├── ArrayUpdateExpression.java
│ │ │ ├── BasicProjection.java
│ │ │ ├── BinaryComparisonOperator.java
│ │ │ ├── BinaryRelationalExpression.java
│ │ │ ├── ComparisonExpression.java
│ │ │ ├── CompositeSortKey.java
│ │ │ ├── ContainsOperator.java
│ │ │ ├── FieldAndRValue.java
│ │ │ ├── FieldComparisonExpression.java
│ │ │ ├── FieldProjection.java
│ │ │ ├── ForEachExpression.java
│ │ │ ├── ForEachUpdateExpression.java
│ │ │ ├── LogicalExpression.java
│ │ │ ├── MapQueryFieldsIterator.java
│ │ │ ├── NaryFieldRelationalExpression.java
│ │ │ ├── NaryLogicalExpression.java
│ │ │ ├── NaryLogicalOperator.java
│ │ │ ├── NaryRelationalExpression.java
│ │ │ ├── NaryRelationalOperator.java
│ │ │ ├── NaryValueRelationalExpression.java
│ │ │ ├── PartialUpdateExpression.java
│ │ │ ├── PrimitiveUpdateExpression.java
│ │ │ ├── Projection.java
│ │ │ ├── ProjectionList.java
│ │ │ ├── QueryConstants.java
│ │ │ ├── QueryExpression.java
│ │ │ ├── QueryInContext.java
│ │ │ ├── QueryIterator.java
│ │ │ ├── QueryIteratorSkeleton.java
│ │ │ ├── RValueExpression.java
│ │ │ ├── RegexMatchExpression.java
│ │ │ ├── RelationalExpression.java
│ │ │ ├── RelativeRewriteIterator.java
│ │ │ ├── RemoveElementExpression.java
│ │ │ ├── SetExpression.java
│ │ │ ├── Sort.java
│ │ │ ├── SortKey.java
│ │ │ ├── UnaryLogicalExpression.java
│ │ │ ├── UnaryLogicalOperator.java
│ │ │ ├── UnsetExpression.java
│ │ │ ├── UpdateExpression.java
│ │ │ ├── UpdateExpressionList.java
│ │ │ ├── UpdateOperator.java
│ │ │ ├── UpdateQueryExpression.java
│ │ │ ├── Value.java
│ │ │ └── ValueComparisonExpression.java
│ └── resources
│ │ └── json-schema
│ │ ├── error
│ │ └── error.json
│ │ ├── projection
│ │ ├── choice.json
│ │ ├── field.json
│ │ ├── match.json
│ │ └── range.json
│ │ ├── query
│ │ ├── array-contains.json
│ │ ├── array-matches.json
│ │ ├── choice.json
│ │ ├── conditional.json
│ │ ├── field-binary-field.json
│ │ ├── field-binary-value.json
│ │ ├── field-nary-values.json
│ │ └── field-regex.json
│ │ └── sort
│ │ ├── choice.json
│ │ └── sort-key.json
│ └── test
│ ├── java
│ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ └── query
│ │ ├── AllMatchExpressionTest.java
│ │ ├── ArrayAddExpressionTest.java
│ │ ├── ArrayUpdateExpressionTest.java
│ │ ├── BinaryComparisonOperatorTest.java
│ │ ├── FieldAndRValueTest.java
│ │ ├── ForEachExpressionTest.java
│ │ ├── ForEachUpdateExpressionTest.java
│ │ ├── IsQueriedTest.java
│ │ ├── NaryRelationalOperatorTest.java
│ │ ├── PrimitiveUpdateExpressionTest.java
│ │ ├── ProjectionFieldReferenceTest.java
│ │ ├── ProjectionParseTest.java
│ │ ├── QueryConstantsTest.java
│ │ ├── QueryParseTest.java
│ │ ├── RValueExpressionTest.java
│ │ ├── RelativeRewriteIteratorTest.java
│ │ ├── RemoveElementExpressionTest.java
│ │ ├── SetExpressionTest.java
│ │ ├── SortParseTest.java
│ │ ├── UnaryLogicalOperatorTest.java
│ │ ├── UnsetExpressionTest.java
│ │ ├── UpdateExpressionListTest.java
│ │ ├── UpdateExpressionTest.java
│ │ ├── UpdateOperatorTest.java
│ │ ├── UpdateQueryExpressionTest.java
│ │ ├── ValueTest.java
│ │ └── schema
│ │ ├── ErrorJsonSchemaTest.java
│ │ ├── ProjectionJsonSchemaTest.java
│ │ ├── QueryJsonSchemaTest.java
│ │ └── SortJsonSchemaTest.java
│ └── resources
│ ├── error
│ └── schema-test-error-simple.json
│ ├── projection
│ ├── schema-test-projection-invalid.json
│ ├── schema-test-projection-single-field.json
│ ├── schema-test-projection-single-match-many-project.json
│ ├── schema-test-projection-single-match-single-project.json
│ ├── schema-test-projection-single-range-many-project.json
│ └── schema-test-projection-single-range-single-project.json
│ ├── query
│ ├── schema-test-query-all-array-nested.json
│ ├── schema-test-query-all-array-not.json
│ ├── schema-test-query-all-array.json
│ ├── schema-test-query-and-array-nested.json
│ ├── schema-test-query-and-array-not.json
│ ├── schema-test-query-and-array.json
│ ├── schema-test-query-any-array-nested.json
│ ├── schema-test-query-any-array.json
│ ├── schema-test-query-any-complete-simple.json
│ ├── schema-test-query-array-contains-all.json
│ ├── schema-test-query-array-contains-any.json
│ ├── schema-test-query-array-contains-none.json
│ ├── schema-test-query-array-match.json
│ ├── schema-test-query-field-binary-field.json
│ ├── schema-test-query-field-binary-value.json
│ ├── schema-test-query-field-nary-value.json
│ ├── schema-test-query-invalid.json
│ ├── schema-test-query-not-any-array-nested.json
│ ├── schema-test-query-not-any-array-not.json
│ ├── schema-test-query-not-any-array.json
│ ├── schema-test-query-not.json
│ ├── schema-test-query-or-array-nested.json
│ ├── schema-test-query-or-array.json
│ └── schema-test-query-or-complete-simple.json
│ ├── simplelogger.properties
│ └── sort
│ ├── schema-test-sort-invalid.json
│ └── schema-test-sort-key.json
├── test
├── pom.xml
└── src
│ ├── main
│ └── java
│ │ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ └── test
│ │ ├── Assert.java
│ │ ├── FakeClientIdentification.java
│ │ ├── LightblueTestHarness.java
│ │ ├── MetadataUtil.java
│ │ └── metadata
│ │ ├── FakeDataStore.java
│ │ ├── FakeMetadata.java
│ │ └── parser
│ │ └── FakeDataStoreParser.java
│ └── test
│ ├── java
│ └── com
│ │ └── redhat
│ │ └── lightblue
│ │ └── test
│ │ ├── AbstractCRUDTestControllerTest.java
│ │ ├── AssertTest.java
│ │ └── metadata
│ │ └── FakeMetadataTest.java
│ └── resources
│ └── metadata
│ ├── access.json
│ ├── datasource.json
│ └── hooks.json
├── tools
└── md2swagger.py
└── util
├── pom.xml
└── src
├── main
└── java
│ └── com
│ └── redhat
│ └── lightblue
│ └── util
│ ├── AbstractTreeCursor.java
│ ├── Constants.java
│ ├── CopyOnWriteIterator.java
│ ├── Cursor.java
│ ├── DefaultRegistry.java
│ ├── DefaultResolver.java
│ ├── DocComparator.java
│ ├── EmptyIterator.java
│ ├── Error.java
│ ├── InvalidPathException.java
│ ├── JsonCompare.java
│ ├── JsonDoc.java
│ ├── JsonInitializable.java
│ ├── JsonNodeCursor.java
│ ├── JsonObject.java
│ ├── JsonUtils.java
│ ├── KeyValueCursor.java
│ ├── KeyValueCursorIteratorAdapter.java
│ ├── Measure.java
│ ├── MemoryMonitor.java
│ ├── MutablePath.java
│ ├── Path.java
│ ├── PathRep.java
│ ├── Registry.java
│ ├── Resolver.java
│ ├── SimpleJsonObject.java
│ ├── Tuples.java
│ ├── Util.java
│ ├── UtilConstants.java
│ ├── metrics
│ ├── DefaultMetricNamer.java
│ ├── DropwizardRequestMetrics.java
│ ├── MetricRegistryFactory.java
│ ├── NoopRequestMetrics.java
│ ├── RequestMetric.java
│ └── RequestMetrics.java
│ ├── stopwatch
│ ├── Mnemos.java
│ ├── SizeCalculator.java
│ ├── StopWatch.java
│ ├── StopWatchAspect.java
│ └── StopWatchLogger.java
│ └── test
│ ├── AbstractJsonNodeTest.java
│ ├── AbstractJsonSchemaTest.java
│ └── FileUtil.java
└── test
├── java
└── com
│ └── redhat
│ └── lightblue
│ └── util
│ ├── AbstractDefaultRegistryTest.java
│ ├── AbstractMutablePathTest.java
│ ├── AbstractPathTest.java
│ ├── CopyOnWriteIteratorTest.java
│ ├── EmptyIteratorTest.java
│ ├── EmptyMutablePathTest.java
│ ├── EmptyPathTest.java
│ ├── ErrorTest.java
│ ├── FilterNullTest.java
│ ├── JsonCompareTest.java
│ ├── JsonDocRelativePathTest.java
│ ├── JsonNodeCursorTest.java
│ ├── JsonNodeDocTest.java
│ ├── JsonObjectTest.java
│ ├── JsonUtilsTest.java
│ ├── MemoryMonitorTest.java
│ ├── ModifyDocTest.java
│ ├── MutablePathMutablePathTest.java
│ ├── MutablePathPathTest.java
│ ├── NormalizeTest.java
│ ├── PathMutablePathTest.java
│ ├── PathParseTest.java
│ ├── PathPathTest.java
│ ├── PrefixSuffixTest.java
│ ├── StringDefaultRegistryTest.java
│ ├── StringMutablePathTest.java
│ ├── StringPathTest.java
│ ├── TuplesTest.java
│ ├── UtilConstantsTest.java
│ ├── UtilTest.java
│ ├── metrics
│ └── DropwizardRequestMetricsTest.java
│ └── stopwatch
│ └── StopWatchTest.java
└── resources
├── JsonNodeCursorTest-general.json
├── JsonNodeDocRelativeTest-complexarray.json
├── JsonNodeDocTest-array.json
├── JsonNodeDocTest-arraywithmissingelements.json
├── JsonNodeDocTest-complex.json
├── JsonNodeDocTest-complexarray.json
├── JsonNodeDocTest-object.json
├── JsonNodeDocTest-simple.json
└── test-JsonDocAdapter.json
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | target/*
3 | logs
4 | www/www-app/*/src/main/webapp/gwt
5 | www/*/src/main/webapp/gwt
6 | *cache.htm
7 | *cache.html
8 | *cache.xml
9 | *.swp
10 | .classpath
11 | .settings
12 | .project
13 | .idea
14 | .wtpmodules
15 | .wtpmodules
16 | .*.jsfdia
17 | *.iml
18 | *.ipr
19 | *.iws
20 | .rpminfo
21 | .rpminfo/*
22 | *~
23 | *.log
24 | *.log.*
25 | mf.pom.xml
26 | .idea
27 | bin
28 | bin/*
29 | *.bak
30 | rhc-port-forward-status
31 | etc/rhc-port-forward-status
32 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Guide lines for contribuition in our Gitbook!
2 | * [Development Process on Gitbook](http://dev.docs.lightblue.io/development_process/README.html)
3 | * Questions & suggestions? Share on our [dev forum](http://dev.forum.lightblue.io/)!
4 |
--------------------------------------------------------------------------------
/ThreatDragonModels/Test/Test.json:
--------------------------------------------------------------------------------
1 | {
2 | "summary": {
3 | "title": "Test"
4 | },
5 | "detail": {
6 | "contributors": [],
7 | "diagrams": [
8 | {
9 | "title": "teste",
10 | "thumbnail": "./public/content/images/thumbnail.jpg",
11 | "id": 0
12 | }
13 | ]
14 | }
15 | }
--------------------------------------------------------------------------------
/add-copyright-to-java.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | FILES=`find . -name "*.java"`
4 | FILES=`grep -r --files-without-match "Copyright [0-9]* Red Hat" $FILES`
5 | COPYRIGHT="/*\n Copyright 2015 Red Hat, Inc. and/or its affiliates.\n\n This file is part of lightblue.\n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n */"
6 |
7 | # add copyright to ALL java files
8 | sed -u -i "s#^package#$COPYRIGHT\npackage#" $FILES
9 |
10 |
--------------------------------------------------------------------------------
/config/src/main/java/com/redhat/lightblue/config/ConfigConstants.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2015 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.config;
20 |
21 | /**
22 | * Created by nmalik on 11/10/14.
23 | */
24 | public class ConfigConstants {
25 |
26 | public static final String ERR_VALIDATION_FAILED = "validation:fail";
27 |
28 | private ConfigConstants() {
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/config/src/main/java/com/redhat/lightblue/config/ControllerFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.config;
20 |
21 | import com.redhat.lightblue.crud.CRUDController;
22 |
23 | /**
24 | * Interface that specifies the factory that creates instances of controllers
25 | * for a particular backend.
26 | */
27 | public interface ControllerFactory {
28 | CRUDController createController(ControllerConfiguration cfg,
29 | DataSourcesConfiguration ds);
30 | }
31 |
--------------------------------------------------------------------------------
/config/src/main/java/com/redhat/lightblue/config/DataSourceConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.config;
20 |
21 | import java.io.Serializable;
22 |
23 | import com.redhat.lightblue.metadata.parser.DataStoreParser;
24 | import com.redhat.lightblue.util.JsonInitializable;
25 |
26 | /**
27 | * Base interface for backend configuration
28 | */
29 | public interface DataSourceConfiguration extends JsonInitializable, Serializable {
30 |
31 | /**
32 | * Returns the metadata backend parser class
33 | */
34 | Class extends DataStoreParser> getMetadataDataStoreParser();
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/config/src/main/java/com/redhat/lightblue/config/LightblueFactoryAware.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.config;
2 |
3 | /**
4 | * An interface indicating that an implementing class has knowledge of the
5 | * {@link LightblueFactory} that it is associated with.
6 | *
7 | * @author dcrissman
8 | */
9 | public interface LightblueFactoryAware {
10 |
11 | void setLightblueFactory(LightblueFactory factory);
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/config/src/main/java/com/redhat/lightblue/config/SimpleHookResolver.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.config;
2 |
3 | import java.util.HashMap;
4 | import java.util.List;
5 | import java.util.Map;
6 |
7 | import com.redhat.lightblue.hooks.CRUDHook;
8 | import com.redhat.lightblue.hooks.HookResolver;
9 | import com.redhat.lightblue.metadata.parser.HookConfigurationParser;
10 |
11 | /**
12 | * Created by lcestari on 4/17/15.
13 | */
14 | public class SimpleHookResolver implements HookResolver {
15 |
16 | private static final long serialVersionUID = 4033911991277254400L;
17 |
18 | private final Map map = new HashMap<>();
19 |
20 | public SimpleHookResolver(List hookConfigurationParsers, LightblueFactory lightblueFactory) {
21 | if (hookConfigurationParsers != null && !hookConfigurationParsers.isEmpty()) {
22 | for (HookConfigurationParser parser : hookConfigurationParsers) {
23 | lightblueFactory.injectDependencies(parser);
24 | CRUDHook hook = parser.getCRUDHook();
25 | lightblueFactory.injectDependencies(hook);
26 | map.put(parser.getName(), hook);
27 | }
28 | }
29 | }
30 |
31 | @Override
32 | public CRUDHook getHook(String name) {
33 | return map.get(name);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/config/src/test/java/com/redhat/lightblue/config/CRUDFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.config;
20 |
21 | import com.redhat.lightblue.crud.CRUDController;
22 |
23 | public class CRUDFactory implements ControllerFactory {
24 | @Override
25 | public CRUDController createController(ControllerConfiguration cfg, DataSourcesConfiguration ds) {
26 | return new TestCRUDController();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/config/src/test/java/com/redhat/lightblue/config/TestDataStoreParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.config;
20 |
21 | import com.redhat.lightblue.metadata.parser.DataStoreParser;
22 | import com.redhat.lightblue.metadata.parser.MetadataParser;
23 |
24 | public class TestDataStoreParser implements DataStoreParser {
25 | @Override
26 | public String getDefaultName() {
27 | return null;
28 | }
29 |
30 | @Override
31 | public Object parse(String name, MetadataParser p, Object node) {
32 | return null;
33 | }
34 |
35 | @Override
36 | public void convert(MetadataParser p, Object emptyNode, Object object) {
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/config/src/test/java/com/redhat/lightblue/config/TestPropertyParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.config;
20 |
21 | import com.redhat.lightblue.metadata.parser.MetadataParser;
22 | import com.redhat.lightblue.metadata.parser.PropertyParser;
23 |
24 | public class TestPropertyParser extends PropertyParser {
25 | }
26 |
--------------------------------------------------------------------------------
/config/src/test/java/com/redhat/lightblue/metadata/test/DatabaseMetadata.java:
--------------------------------------------------------------------------------
1 | ../../../../../../../../../metadata/src/test/java/com/redhat/lightblue/metadata/test/DatabaseMetadata.java
--------------------------------------------------------------------------------
/config/src/test/resources/invalid-deletion-req.json:
--------------------------------------------------------------------------------
1 | {
2 | "objectType": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/config/src/test/resources/lightblue-crud.json:
--------------------------------------------------------------------------------
1 | {
2 | "maxResultSetSizeForReadsB": 51,
3 | "maxResultSetSizeForWritesB": 52,
4 | "maxExecutionContextSizeForCompositeFindB": 53,
5 | "warnResultSetSizeB": 54,
6 | "validateRequests" : false,
7 | "controllers" : [
8 | {
9 | "backend" : "mongo",
10 | "controllerFactory" : "com.redhat.lightblue.config.CRUDFactory"
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/config/src/test/resources/simplelogger.properties:
--------------------------------------------------------------------------------
1 | org.slf4j.simpleLogger.defaultLogLevel=SEVERE
2 |
--------------------------------------------------------------------------------
/config/src/test/resources/valid-deletion-req.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/core-api/src/main/java/com/redhat/lightblue/OperationStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue;
20 |
21 | /**
22 | * The operation status
23 | *
24 | *
25 | * - COMPLETE: Operation completed successfully
26 | * - PARTIAL: Some of the documents were inserted/updated, and some
27 | * failed
28 | * - ASYNC: Execution continues asynchronously
29 | * - ERROR: None of the documents were updated because of errors
30 | *
31 | */
32 | public enum OperationStatus {
33 | COMPLETE, PARTIAL, ASYNC, ERROR;
34 | }
35 |
--------------------------------------------------------------------------------
/core-api/src/main/java/com/redhat/lightblue/SessionInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue;
20 |
21 | import com.redhat.lightblue.util.JsonObject;
22 |
23 | /**
24 | * Base class containing implementation dependent information to keep track of
25 | * sessions
26 | */
27 | public abstract class SessionInfo extends JsonObject {
28 | private static final long serialVersionUID = 1L;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/core-api/src/main/java/com/redhat/lightblue/crud/CRUDOperation.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.crud;
20 |
21 | public enum CRUDOperation {
22 | INSERT, SAVE, UPDATE, DELETE, FIND
23 | }
24 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/Binder.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.assoc;
20 |
21 | /**
22 | * A binder contains a field binding and its value
23 | */
24 | public class Binder {
25 | private final BoundObject binding;
26 | private final Object value;
27 |
28 | public Binder(BoundObject binding, Object value) {
29 | this.binding = binding;
30 | this.value = value;
31 | }
32 |
33 | public BoundObject getBinding() {
34 | return binding;
35 | }
36 |
37 | /**
38 | * This is either a Value or a List
39 | */
40 | public Object getValue() {
41 | return value;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/BoundObject.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.assoc;
20 |
21 | /**
22 | * Interface definition for BoundObject
23 | */
24 | public interface BoundObject {
25 | QueryFieldInfo getFieldInfo();
26 | }
27 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/ep/ListStepResult.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.assoc.ep;
2 |
3 | import java.util.List;
4 | import java.util.stream.Stream;
5 |
6 | /**
7 | * A step result backed by a list
8 | */
9 | public class ListStepResult implements StepResult {
10 |
11 | protected List list;
12 |
13 | public ListStepResult(List list) {
14 | this.list = list;
15 | }
16 |
17 | protected ListStepResult() {
18 | }
19 |
20 | @Override
21 | public Stream stream() {
22 | return list.stream();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/ep/MakeDocCtx.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.assoc.ep;
2 |
3 | import java.util.stream.Stream;
4 |
5 | import com.redhat.lightblue.crud.DocCtx;
6 |
7 | /**
8 | * Decorator interface that gets a StepResult and return StepResult
9 | */
10 | public class MakeDocCtx implements StepResult {
11 |
12 | private final StepResult result;
13 |
14 | public MakeDocCtx(StepResult result) {
15 | this.result=result;
16 | }
17 |
18 | @Override
19 | public Stream stream() {
20 | return result.stream().map(d->new DocCtx(d.getDoc()));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/ep/StepResult.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.assoc.ep;
2 |
3 | import java.util.stream.Stream;
4 |
5 | /**
6 | * The result type returned from steps. Contains stream() to return the result
7 | * stream.
8 | */
9 | public interface StepResult {
10 |
11 | public static StepResult EMPTY = new StepResult() {
12 | @Override
13 | public Stream stream() {
14 | return Stream.empty();
15 | }
16 | };
17 |
18 | /**
19 | * Returns a stream of results. Once the stream processing is complete,
20 | * stream is closed, and should not be used. The caller can call stream()
21 | * again to get a new stream.
22 | */
23 | Stream stream();
24 | }
25 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/ep/StepResultDocumentStream.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.assoc.ep;
2 |
3 | import java.util.Iterator;
4 | import java.util.ArrayList;
5 | import java.util.function.Consumer;
6 | import java.util.stream.Stream;
7 |
8 | import com.redhat.lightblue.crud.DocCtx;
9 | import com.redhat.lightblue.crud.DocumentStream;
10 |
11 | /**
12 | * Interface between DocumentStream used in CRUDOperationContext, and StepResult
13 | */
14 | public class StepResultDocumentStream implements DocumentStream {
15 |
16 | private final Iterator itr;
17 | private final ArrayList> listeners=new ArrayList<>();
18 |
19 | public StepResultDocumentStream(StepResult result) {
20 | this.itr=result.stream().iterator();
21 | }
22 |
23 | @Override
24 | public boolean hasNext() {
25 | return itr.hasNext();
26 | }
27 |
28 | @Override
29 | public DocCtx next() {
30 | DocCtx doc=itr.next();
31 | for(Consumer c:listeners)
32 | c.accept(doc);
33 | return doc;
34 | }
35 |
36 | @Override
37 | public void close() {}
38 |
39 | @Override
40 | public void addListener(Consumer listener) {
41 | listeners.add(listener);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/ep/StepResultWrapper.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.assoc.ep;
2 |
3 | import java.util.stream.Stream;
4 |
5 | /**
6 | * Wraps a step result. Convenience class for other result implementations
7 | */
8 | public class StepResultWrapper implements StepResult {
9 |
10 | protected final StepResult wrapped;
11 |
12 | public StepResultWrapper(StepResult wrapped) {
13 | this.wrapped = wrapped;
14 | }
15 |
16 | @Override
17 | public Stream stream() {
18 | return wrapped.stream();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/assoc/scorers/CostAndSize.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.assoc.scorers;
20 |
21 | import java.math.BigInteger;
22 |
23 | class CostAndSize {
24 | BigInteger cost = BigInteger.ONE;
25 | BigInteger size = BigInteger.ONE;
26 |
27 | public CostAndSize(BigInteger cost, BigInteger size) {
28 | this.cost = cost;
29 | this.size = size;
30 | }
31 |
32 | public CostAndSize() {
33 | }
34 |
35 | public String toString() {
36 | return "cost:" + cost + " size:" + size;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/crud/CRUDDeleteResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.crud;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * Deletion operation response
25 | */
26 | public class CRUDDeleteResponse implements Serializable {
27 |
28 | private static final long serialVersionUID = 1l;
29 |
30 | private int numDeleted;
31 |
32 | /**
33 | * Number of records deleted
34 | */
35 | public int getNumDeleted() {
36 | return numDeleted;
37 | }
38 |
39 | /**
40 | * Number of records deleted
41 | */
42 | public void setNumDeleted(int n) {
43 | numDeleted = n;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/crud/CRUDInsertionResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.crud;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * CRUD layer insertion response
25 | */
26 | public class CRUDInsertionResponse implements Serializable {
27 |
28 | private static final long serialVersionUID = 1l;
29 |
30 | private int numInserted;
31 |
32 | /**
33 | * Number of docs inserted
34 | */
35 | public int getNumInserted() {
36 | return numInserted;
37 | }
38 |
39 | /**
40 | * Number of docs inserted
41 | */
42 | public void setNumInserted(int n) {
43 | numInserted = n;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/crud/CRUDSaveResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.crud;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * CRUD layer save response
25 | */
26 | public class CRUDSaveResponse implements Serializable {
27 |
28 | private static final long serialVersionUID = 1l;
29 |
30 | private int numSaved;
31 |
32 | /**
33 | * Number of documents saved
34 | */
35 | public int getNumSaved() {
36 | return numSaved;
37 | }
38 |
39 | /**
40 | * Number of documents saved
41 | */
42 | public void setNumSaved(int n) {
43 | numSaved = n;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/crud/WithProjection.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.crud;
20 |
21 | import com.redhat.lightblue.query.Projection;
22 |
23 | /**
24 | * Marker interface for requests containing a projection
25 | */
26 | public interface WithProjection {
27 |
28 | Projection getProjection();
29 | }
30 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/crud/WithQuery.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.crud;
20 |
21 | import com.redhat.lightblue.query.QueryExpression;
22 |
23 | /**
24 | * Marker interface for requests containing a query expression
25 | */
26 | public interface WithQuery {
27 |
28 | QueryExpression getQuery();
29 | }
30 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/eval/EvaluationError.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.eval;
20 |
21 | import com.redhat.lightblue.util.JsonObject;
22 |
23 | public class EvaluationError extends RuntimeException {
24 | private static final long serialVersionUID = 1L;
25 |
26 | public EvaluationError(JsonObject expr,
27 | String msg) {
28 | super(expr.toString() + ":" + msg);
29 | }
30 |
31 | public EvaluationError(JsonObject expr) {
32 | super(expr.toString());
33 | }
34 |
35 | public EvaluationError(String msg) {
36 | super(msg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/hooks/HookResolver.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.hooks;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * Instances of HookResolver are used to get an instance of a hook
25 | */
26 | public interface HookResolver extends Serializable {
27 | /**
28 | * Returns an instance of the hook with the given name
29 | */
30 | CRUDHook getHook(String name);
31 | }
32 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/hooks/MediatorHook.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.hooks;
20 |
21 | /**
22 | * Marker interface for hooks that are to be called at the mediator level,
23 | * instead of the CRUD level. If the operation is on composite entities, these
24 | * hooks are called only for top-level entities, instead of each contained
25 | * entity.
26 | */
27 | public interface MediatorHook extends CRUDHook {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/hooks/StopHookProcessing.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.hooks;
20 |
21 | import java.lang.annotation.RetentionPolicy;
22 | import java.lang.annotation.ElementType;
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * Exceptions during hook processing will stop the processing of the current
28 | * hook, but processing of the remaining hooks will continue. If an exception
29 | * marked with this annotation is thrown, all hook processing is stopped.
30 | */
31 | @Retention(RetentionPolicy.RUNTIME)
32 | @Target(ElementType.TYPE)
33 | public @interface StopHookProcessing {
34 | }
35 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/interceptor/CRUDControllerInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.interceptor;
20 |
21 | import com.redhat.lightblue.crud.CRUDOperationContext;
22 |
23 | public interface CRUDControllerInterceptor extends Interceptor {
24 | void run(CRUDOperationContext ctx);
25 | }
26 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/interceptor/CRUDDocInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.interceptor;
20 |
21 | import com.redhat.lightblue.crud.CRUDOperationContext;
22 | import com.redhat.lightblue.crud.DocCtx;
23 |
24 | public interface CRUDDocInterceptor extends Interceptor {
25 | void run(CRUDOperationContext ctx, DocCtx doc);
26 | }
27 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/interceptor/Interceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.interceptor;
20 |
21 | import java.io.Serializable;
22 |
23 | public interface Interceptor extends Serializable {
24 | }
25 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/interceptor/MediatorInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.interceptor;
20 |
21 | import com.redhat.lightblue.mediator.OperationContext;
22 |
23 | public interface MediatorInterceptor extends Interceptor {
24 | void run(OperationContext ctx);
25 | }
26 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/mediator/Finder.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
4 |
5 | This file is part of lightblue.
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 | package com.redhat.lightblue.mediator;
21 |
22 | import com.redhat.lightblue.crud.CRUDFindRequest;
23 | import com.redhat.lightblue.crud.CRUDFindResponse;
24 |
25 | public interface Finder {
26 |
27 | CRUDFindResponse find(OperationContext ctx, CRUDFindRequest req);
28 |
29 | void explain(OperationContext ctx, CRUDFindRequest req);
30 | }
31 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/mediator/ResponsePayloadSizeCalculator.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.mediator;
2 |
3 | import com.redhat.lightblue.Response;
4 | import com.redhat.lightblue.util.JsonUtils;
5 | import com.redhat.lightblue.util.stopwatch.SizeCalculator;
6 |
7 | public class ResponsePayloadSizeCalculator implements SizeCalculator{
8 |
9 | @Override
10 | public int size(Response response) {
11 | return JsonUtils.size(response.getEntityData());
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/mindex/Key.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.mindex;
20 |
21 | /**
22 | * Marker interface for index key
23 | */
24 | interface Key {
25 | }
26 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/mindex/KeySpec.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.mindex;
20 |
21 | import java.util.Set;
22 |
23 | import com.redhat.lightblue.util.JsonDoc;
24 |
25 | /**
26 | * A key specification, the public interface. This can be a simple or a array key specification
27 | */
28 | public interface KeySpec {
29 | /**
30 | * Compare two keys
31 | */
32 | int compareKeys(Key k1,Key k2);
33 |
34 | /**
35 | * Extract key values from the doc, store in dest. Return dest. Allocate dest if dest is null
36 | */
37 | Set extract(JsonDoc doc,Set dest);
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/crud/src/main/java/com/redhat/lightblue/mindex/SimpleKeyLookupSpec.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.mindex;
20 |
21 | public abstract class SimpleKeyLookupSpec extends LookupSpec {
22 | final SimpleKeySpec key;
23 |
24 | public SimpleKeyLookupSpec(SimpleKeySpec key) {
25 | this.key=key;
26 | }
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/crud/src/test/java/com/redhat/lightblue/mediator/CompositeFinderWithIndexingTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.mediator;
20 |
21 | import org.junit.Before;
22 |
23 | public class CompositeFinderWithIndexingTest extends CompositeFinderTest {
24 |
25 | @Before
26 | public void initMediator() throws Exception {
27 | // use in memory index regardless of result set size
28 | initMediator(0);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/crud/src/test/java/com/redhat/lightblue/metadata/test/DatabaseMetadata.java:
--------------------------------------------------------------------------------
1 | ../../../../../../../../../metadata/src/test/java/com/redhat/lightblue/metadata/test/DatabaseMetadata.java
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/A_def_data.json:
--------------------------------------------------------------------------------
1 | [{
2 | "_id":"A01",
3 | "objectType":"A_def",
4 | "field1":"8nH0wBwk7C",
5 | "obj1":{
6 | "field1":"WImgCng",
7 | "c_ref":"C01"
8 | },
9 | "b_ref":"B01"
10 | },{
11 | "_id":"A02",
12 | "objectType":"A_def",
13 | "field1":"PvbBP",
14 | "obj1":{
15 | "field1":"7f-ADUF1A",
16 | "c_ref":"C02"
17 | },
18 | "b_ref":"B02"
19 | }]
20 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/A_with_index_data.json:
--------------------------------------------------------------------------------
1 | [{
2 | "_id":"A99",
3 | "objectType":"A",
4 | "field1":"dwzedQr4hw5HdHwWhvE7SkvZB22",
5 | "obj1":{
6 | "field1":"d6gdfa8wh7F6l6Iq.KV8",
7 | "c_ref":"C99"
8 | },
9 | "b_ref":"B99"
10 | },{
11 | "_id":"ADEEP",
12 | "objectType":"A",
13 | "level1": {
14 | "arr1": [
15 | {
16 | "b_ref":"BDEEP1"
17 | },
18 | {
19 | "b_ref":"BDEEP2"
20 | }
21 | ]
22 | }
23 | },{
24 | "_id":"MANYB1",
25 | "objectType":"A",
26 | "nonid_b_ref":"MANYB1"
27 | },{
28 | "_id":"MANYB2",
29 | "objectType":"A",
30 | "nonid_b_ref":"MANYB2"
31 | }
32 | ]
33 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/B.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "B",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "user"
8 | },
9 | "defaultVersion":"1.0.0"
10 | },
11 | "schema" : {
12 | "name" : "B",
13 | "version": {
14 | "value": "1.0.0",
15 | "changelog": "Test"
16 | },
17 | "status": {
18 | "value": "active"
19 | },
20 | "access" : {
21 | "insert": ["anyone"],
22 | "find":["anyone"],
23 | "update":["anyone"],
24 | "delete":["anyone"]
25 | },
26 | "fields": {
27 | "_id": {"type": "string", "constraints":{ "identity":1 } },
28 | "objectType": {"type": "string"},
29 | "field1": { "type": "string" },
30 | "field2": { "type": "string" }
31 | }
32 | }
33 | }
34 |
35 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/D.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "D",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "user"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "D",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "field1": { "type": "string" }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/L_data.json:
--------------------------------------------------------------------------------
1 | [ { "_id":1, "status":"active","name":"l1","objectType":"L","arr":["arr0","arr1"]},
2 | { "_id":2, "status":"active","name":"l2","objectType":"L"} ]
3 |
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/UC_data.json:
--------------------------------------------------------------------------------
1 | [ { "_id":1, "userId":1,"userRedHatPrincipal":"a" } ]
2 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/U_data.json:
--------------------------------------------------------------------------------
1 | [ { "_id":1,"status":"active","authentications":[ { "uid":"1","principal":"a","providerName":"p" } ],"legalEntities":[ {"legalEntityId":1,"title":"s","emails":[{"address":"email@x.com"}] } ],"objectType":"U" },
2 | { "_id":2,"status":"active","authentications":[ { "uid":"1","principal":"a" } ],"legalEntities":[ {"legalEntityId":1,"title":"s" } ],"objectType":"U" },
3 | { "_id":3,"status":"active","authentications":[ { "uid":"1","principal":"b" } ],"legalEntities":[ {"legalEntityId":2,"title":"s" } ],"objectType":"U" }
4 | ]
5 |
6 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/arr_child.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "arr_child",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "arr_child"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "arr_child",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "name":{"type":"string"}
29 | }
30 | }
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/arr_child_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {"_id":"1","objectType":"arr_child","name":"1"},
3 | {"_id":"2","objectType":"arr_child","name":"2"},
4 | {"_id":"3","objectType":"arr_child","name":"3"},
5 | {"_id":"4","objectType":"arr_child","name":"4"},
6 | {"_id":"5","objectType":"arr_child","name":"5"},
7 | {"_id":"6","objectType":"arr_child","name":"6"},
8 | {"_id":"7","objectType":"arr_child","name":"7"}
9 | ]
10 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/arr_parent.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "arr_parent",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "arr_parent"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "arr_parent",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "ref": {
29 | "entity":"arr_child",
30 | "versionValue":"1.0.0",
31 | "type":"reference",
32 | "query":{"field":"_id","op":"$in","rfield":"$parent.arr" }
33 | },
34 | "arr":{
35 | "type":"array",
36 | "items":{
37 | "type":"string"
38 | }
39 | }
40 | }
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/arr_parent_data.json:
--------------------------------------------------------------------------------
1 | [
2 | { "_id":"1","objectType":"arr_parent","arr":["1","2","3"]},
3 | { "_id":"2","objectType":"arr_parent","arr":[]},
4 | { "_id":"3","objectType":"arr_parent"}
5 | ]
6 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/child_loop_data.json:
--------------------------------------------------------------------------------
1 | [
2 | { "_id":"1","objectType":"child_loop","field1":true,"field2":true,"refvalue":"1","array":[{"field1":"value1","field2":"value2"}]},
3 | { "_id":"2","objectType":"child_loop","field1":true,"field2":true,"refvalue":"2","array":[{"field1":"value1","field2":"value2"}]},
4 | { "_id":"3","objectType":"child_loop","field1":false,"field2":true,"refvalue":"3","array":[{"field1":"value1","field2":"value2"}]},
5 | { "_id":"4","objectType":"child_loop","field1":true,"field2":true,"refvalue":"4","array":[{"field1":"value1","field2":"value2"}]},
6 | { "_id":"5","objectType":"child_loop","field1":false,"field2":true,"refvalue":"5","array":[{"field1":"value1","field2":"value2"}]},
7 | { "_id":"6","objectType":"child_loop","field1":false,"field2":false,"refvalue": "6","array":[{"field1":"value1","field2":"value2"}]}
8 | ]
9 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/child_w_elem_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_id":"child1",
4 | "objectType":"child_w_elem",
5 | "tree" :[
6 | {
7 | "child": {
8 | "code1":"A",
9 | "code2":"A"
10 | },
11 | "parent": {
12 | "code1":"B",
13 | "code2":"B"
14 | }
15 | }
16 | ]
17 | }
18 | ]
19 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/containerImage-self_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {"_id":"img1","objectType":"containerImage","repositories":[{"repository":"repo1","registry":"registry1"}],"vulnerabilities":[{"packages":[{"srpm_nevra":"srpm"}]}]},
3 | {"_id":"img2","objectType":"containerImage","repositories":[{"repository":"repo1","registry":"registry1"}],"parsed_data":{"rpm_manifest":[{"srpm_nevra":"srpm"}]}}
4 |
5 | ]
6 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/containerImage_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {"_id":"img1","objectType":"containerImage","certified":"true","repositories":[{"repository":"repo1","registry":"registry1","published":true}]},
3 | {"_id":"img2","objectType":"containerImage","certified":"true","repositories":[{"repository":"repo2","registry":"registry2","published":true}]},
4 | {"_id":"img3","objectType":"containerImage","certified":"true","repositories":[{"repository":"repo3","registry":"registry3","published":true}]},
5 | {"_id":"img4","objectType":"containerImage","certified":"true","repositories":[{"repository":"repo4","registry":"registry4","published":false}]},
6 | {"_id":"img5","objectType":"containerImage","certified":"true","repositories":[{"repository":"repo4","registry":"registry4","published":false}]},
7 | {"_id":"img6","objectType":"containerImage","certified":"true","repositories":[{"repository":"repo4","registry":"registry4","published":false}]},
8 | {"_id":"img7","objectType":"containerImage","certified":"true","repositories":[{"repository":"repo4","registry":"registry4","published":false}]},
9 | {"_id":"img8","objectType":"containerImage","certified":"false","repositories":[{"repository":"repo5","registry":"registry5","published":true}]},
10 | {"_id":"img9","objectType":"containerImage","certified":"false","repositories":[{"repository":"repo5","registry":"registry5","published":true}]}
11 |
12 | ]
13 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/containerRepository_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {"_id":"1","objectType":"containerRepository","repository":"repo1","registry":"registry1","vendorLabel":"Red Hat"},
3 | {"_id":"2","objectType":"containerRepository","repository":"repo2","registry":"registry2","vendorLabel":"Red Hat"},
4 | {"_id":"3","objectType":"containerRepository","repository":"repo3","registry":"registry3","vendorLabel":"Not Red Hat"},
5 | {"_id":"4","objectType":"containerRepository","repository":"repo4","registry":"registry4","vendorLabel":"Not Red Hat"},
6 | {"_id":"5","objectType":"containerRepository","repository":"repo5","registry":"registry5","vendorLabel":"Not Red Hat"}
7 | ]
8 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/doc1.json:
--------------------------------------------------------------------------------
1 | {
2 | "objectType":"A",
3 | "field1":"value1",
4 | "obj1":{
5 | "field1":"obj.value1",
6 | "c_ref":"crefvalue",
7 | "c": [
8 | {
9 | "_id":"c1",
10 | "objectType":"C",
11 | "field1":"cvalue1",
12 | "obj1": {
13 | "field1":"cobjvalue1",
14 | "d_ref":"drefvalue",
15 | "d": [
16 | {
17 | "_id":"d1",
18 | "objectType":"d",
19 | "field1":"dvalue1"
20 | }
21 | ]
22 | }
23 | },
24 | {
25 | "_id":"c2",
26 | "objectType":"C",
27 | "field1":"cvalue2",
28 | "obj1": {
29 | "field1":"cobjvalue2",
30 | "d_ref":"drefvalue",
31 | "d": [
32 | {
33 | "_id":"d2",
34 | "objectType":"d",
35 | "field1":"dvalue2"
36 | }
37 | ]
38 | }
39 | }
40 | ]
41 | },
42 | "b_ref":"brefvalue",
43 | "b":[
44 | {
45 | "_id":"b1",
46 | "objectType":"B",
47 | "field1":"bvalue01",
48 | "field2":"bvalue02"
49 | },
50 | {
51 | "_id":"b2",
52 | "objectType":"B",
53 | "field1":"bvalue11",
54 | "field2":"bvalue12"
55 | }
56 | ]
57 | }
58 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/jA.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo":{
3 | "name":"jA",
4 | "indexes":[
5 | {
6 | "name":null,
7 | "unique":true,
8 | "fields":[
9 | {
10 | "field":"_id",
11 | "dir":"$asc"
12 | }
13 | ]
14 | }
15 | ],
16 | "datastore":{
17 | "datasource":"mongodata",
18 | "collection":"jA",
19 | "backend":"mongo"
20 | }
21 | },
22 | "schema":{
23 | "name":"jA",
24 | "version":{
25 | "value":"1.0.1-SNAPSHOT",
26 | "changelog":"Association test"
27 | },
28 | "status":{
29 | "value":"active"
30 | },
31 | "access":{
32 | "insert":[
33 | "anyone"
34 | ],
35 | "update":[
36 | "anyone"
37 | ],
38 | "find":[
39 | "anyone"
40 | ],
41 | "delete":[
42 | "anyone"
43 | ]
44 | },
45 | "fields":{
46 | "_id":{
47 | "type":"uid",
48 | "constraints":{
49 | "identity":true
50 | }
51 | },
52 | "objectType":{
53 | "type":"string",
54 | "access":{
55 | "find":[
56 | "anyone"
57 | ],
58 | "update":[
59 | "noone"
60 | ]
61 | },
62 | "constraints":{
63 | "minLength":1,
64 | "required":true
65 | }
66 | },
67 | "thing":{
68 | "type":"string"
69 | }
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/jA_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_id": "26f1b656-5560-415f-948b-bf31d72020c8",
4 | "objectType": "jA",
5 | "thing": "blah"
6 | },
7 | {
8 | "_id": "88cd8c3a-0bf1-49cf-9641-2abd3700c0d3",
9 | "objectType": "jA",
10 | "thing": "blah"
11 | },
12 | {
13 | "_id": "29d13392-d06a-461c-8c89-b8b75a3227a3",
14 | "objectType": "jA",
15 | "thing": "blaha"
16 | },
17 | {
18 | "_id": "8281d854-b8bf-468c-b285-f804e39e4a27",
19 | "objectType": "jA",
20 | "thing": "blaha"
21 | }
22 | ]
23 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/jB.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo":{
3 | "name":"jB",
4 | "indexes":[
5 | {
6 | "name":null,
7 | "unique":true,
8 | "fields":[
9 | {
10 | "field":"_id",
11 | "dir":"$asc"
12 | }
13 | ]
14 | }
15 | ],
16 | "datastore":{
17 | "datasource":"mongodata",
18 | "collection":"jB",
19 | "backend":"mongo"
20 | }
21 | },
22 | "schema":{
23 | "name":"jB",
24 | "version":{
25 | "value":"1.0.1-SNAPSHOT",
26 | "changelog":"Association test 2"
27 | },
28 | "status":{
29 | "value":"active"
30 | },
31 | "access":{
32 | "insert":[
33 | "anyone"
34 | ],
35 | "update":[
36 | "anyone"
37 | ],
38 | "find":[
39 | "anyone"
40 | ],
41 | "delete":[
42 | "anyone"
43 | ]
44 | },
45 | "fields":{
46 | "a_thing":{
47 | "type":"string"
48 | },
49 | "_id":{
50 | "type":"uid",
51 | "constraints":{
52 | "identity":true
53 | }
54 | },
55 | "A":{
56 | "type":"reference",
57 | "entity":"jA",
58 | "versionValue":"1.0.1-SNAPSHOT",
59 | "projection":{
60 | "field":"*",
61 | "include":true,
62 | "recursive":true
63 | },
64 | "query":{
65 | "field":"thing",
66 | "op":"$eq",
67 | "rfield":"$parent.a_thing"
68 | },
69 | "sort":[
70 | {
71 | "_id":"$asc"
72 | }
73 | ]
74 | },
75 | "objectType":{
76 | "type":"string",
77 | "access":{
78 | "find":[
79 | "anyone"
80 | ],
81 | "update":[
82 | "noone"
83 | ]
84 | },
85 | "constraints":{
86 | "minLength":1,
87 | "required":true
88 | }
89 | }
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/jB_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_id": "230171bc-d672-4d73-b751-007c36c4ebb0",
4 | "a_thing": "blah",
5 | "objectType": "jB"
6 | },
7 | {
8 | "_id": "e0d97484-c4bc-4f04-ade2-e3cb35529427",
9 | "a_thing": "blaha",
10 | "objectType": "jB"
11 | }
12 | ]
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/parent_w_elem_data.json:
--------------------------------------------------------------------------------
1 | [{
2 | "_id": "1",
3 | "code1":"A",
4 | "code2":"A",
5 | "objectType":"parent_w_elem"
6 | }
7 | ]
8 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/root_loop.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "root_loop",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "root_loop"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "root_loop",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "field1": { "type": "string" },
29 | "field2": { "type":"boolean" },
30 | "field3": { "type":"string" },
31 | "refvalue":{"type":"string"},
32 | "refchild": {
33 | "type":"reference",
34 | "entity":"child_loop",
35 | "versionValue":"1.0.0",
36 | "query":{"field":"_id","op":"$eq","rfield":"$parent.refvalue"}
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/root_loop_data.json:
--------------------------------------------------------------------------------
1 | [
2 | { "_id":"1","objectType":"root_loop","field1":"f1value","field2":true,"field3":"f3value","refvalue":"1"},
3 | { "_id":"2","objectType":"root_loop","field1":"f1value","field2":true,"field3":"f3value","refvalue":"2"},
4 | { "_id":"3","objectType":"root_loop","field1":"f1value","field2":true,"field3":"f3value","refvalue":"3"},
5 | { "_id":"4","objectType":"root_loop","field1":"f1value","field2":true,"field3":"f3valueOther","refvalue":"4"},
6 | { "_id":"5","objectType":"root_loop","field1":"f1value","field2":true,"field3":"f3valueOther","refvalue":"5"},
7 | { "_id":"6","objectType":"root_loop","field1":"f1value","field2":false,"field3":"f3valueOther","refvalue":"6"}
8 | ]
9 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/root_loop_n_n.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "root_loop_n_n",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "root_loop_n_n"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "root_loop_n_n",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "field1": { "type": "string" },
29 | "field2": { "type":"boolean" },
30 | "field3": { "type":"string" },
31 | "refchild": {
32 | "type":"reference",
33 | "entity":"child_loop",
34 | "versionValue":"1.0.0",
35 | "query":{"field":"_id","op":"$eq","rfield":"$parent.refvalue"}
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "self_ref",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "self_ref"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "self_ref",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "name":{"type":"string"},
29 | "base_images": {
30 | "type": "reference",
31 | "entity": "self_ref",
32 | "query": {
33 | "$and": [
34 | {
35 | "field": "_id",
36 | "op": "$eq",
37 | "rfield": "$parent._id"
38 | },
39 | {
40 | "field": "name",
41 | "op": "$eq",
42 | "rfield": "$parent.name"
43 | }
44 | ]
45 | },
46 | "versionValue": "1.0.0"
47 | }
48 | }
49 | }
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref_array_contains_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {"_id":"Q","a":["a","b","c"]},
3 | {"_id":"R","a":["d","b","c"]},
4 | {"_id":"S","a":["b","c"]},
5 | {"_id":"T","a":["c"]}
6 | ]
7 |
8 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref_array_not_contains_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {"_id":"Q","a":["a","b","c"]},
3 | {"_id":"R","a":["d","b","c"]},
4 | {"_id":"S","a":["b","c"]},
5 | {"_id":"T","a":["c"]}
6 | ]
7 |
8 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref_data.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref_default.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "self_ref_default",
4 | "defaultVersion": "1.0.0",
5 | "datastore": {
6 | "backend":"mongo",
7 | "datasource": "mongodata",
8 | "collection": "self_ref_default"
9 | }
10 | },
11 | "schema" : {
12 | "name" : "self_ref_default",
13 | "version": {
14 | "value": "1.0.0",
15 | "changelog": "Test"
16 | },
17 | "status": {
18 | "value": "active"
19 | },
20 | "access" : {
21 | "insert": ["anyone"],
22 | "find":["anyone"],
23 | "update":["anyone"],
24 | "delete":["anyone"]
25 | },
26 | "fields": {
27 | "_id": {"type": "string", "constraints":{ "identity":1 } },
28 | "objectType": {"type": "string"},
29 | "name":{"type":"string"},
30 | "base_images": {
31 | "type": "reference",
32 | "entity": "self_ref_default",
33 | "query": {
34 | "$and": [
35 | {
36 | "field": "_id",
37 | "op": "$eq",
38 | "rfield": "$parent._id"
39 | },
40 | {
41 | "field": "name",
42 | "op": "$eq",
43 | "rfield": "$parent.name"
44 | }
45 | ]
46 | }
47 | }
48 | }
49 | }
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref_default_data.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref_err.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "self_ref_err",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "self_ref"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "self_ref_err",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "name":{"type":"string"},
29 | "base_images": {
30 | "type": "reference",
31 | "entity": "self_ref_err",
32 | "query": {
33 | "$and": [
34 | {
35 | "field": "_id",
36 | "op": "$eq",
37 | "rfield": "$parent._id"
38 | },
39 | {
40 | "field": "name",
41 | "op": "$eq",
42 | "rfield": "$parent.name"
43 | }
44 | ]
45 | },
46 | "versionValue": "0.0.1"
47 | }
48 | }
49 | }
50 | }
51 |
52 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/self_ref_err_data.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/vendors.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "vendors",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "vendors"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "vendors",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string", "constraints":{ "identity":1 } },
27 | "objectType": {"type": "string"},
28 | "label": { "type": "string" }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/crud/src/test/resources/composite/vendors_data.json:
--------------------------------------------------------------------------------
1 | [
2 | {"_id":"1","objectType":"vendors","label":"Red Hat" }
3 | ]
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/delete/schema-test-delete-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-noq.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "range": [
14 | 0,
15 | 10
16 | ],
17 | "sort": {
18 | "login": "$asc"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-0-max.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "maxResults": 0,
19 | "sort": {
20 | "login": "$asc"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-0-to.json:
--------------------------------------------------------------------------------
1 | {
2 | "objectType": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "to": 0,
19 | "sort": {
20 | "login": "$asc"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-1-max.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "maxResults": 1,
19 | "sort": {
20 | "login": "$asc"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-from-to.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "from": 100,
19 | "to": 200,
20 | "sort": {
21 | "login": "$asc"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-from.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "from": 100,
19 | "sort": {
20 | "login": "$asc"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-max.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "maxResults": 100,
19 | "sort": {
20 | "login": "$asc"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-null-to.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "range": [
19 | 0,
20 | null
21 | ],
22 | "sort": {
23 | "login": "$asc"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple-to.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "to": 200,
19 | "sort": {
20 | "login": "$asc"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/find/schema-test-find-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "range": [
19 | 0,
20 | 10
21 | ],
22 | "sort": {
23 | "login": "$asc"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/insert/schema-test-insert-many.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "data": [
14 | {
15 | "objectType": "some_entity",
16 | "login": "nmalik1"
17 | },
18 | {
19 | "objectType": "some_entity",
20 | "login": "nmalik2"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/insert/schema-test-insert-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "data": {
14 | "objectType": "some_entity",
15 | "login": "nmalik"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/response/schema-test-response-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "status": "COMPLETE",
3 | "modifiedCount": 1,
4 | "matchCount": 1,
5 | "taskHandle": "handle",
6 | "session": {
7 | "content": "TBD"
8 | },
9 | "processed": [
10 | {
11 | "foo": "bar"
12 | }
13 | ],
14 | "dataErrors": [
15 | {
16 | "data": {
17 | "foo": "bar"
18 | },
19 | "errors": [
20 | {
21 | "objectType": "error",
22 | "context": "c1/c2/c3/...",
23 | "errorCode": "SomeErrorCode",
24 | "msg": "Error message"
25 | }
26 | ]
27 | }
28 | ],
29 | "errors": [
30 | {
31 | "objectType": "error",
32 | "context": "c1/c2/c3/...",
33 | "errorCode": "SomeErrorCode",
34 | "msg": "Error message"
35 | }
36 | ]
37 | }
38 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/save/schema-test-save-many.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "data": [
14 | {
15 | "objectType": "some_entity",
16 | "login": "nmalik1"
17 | },
18 | {
19 | "objectType": "some_entity",
20 | "login": "nmalik2"
21 | }
22 | ],
23 | "upsert": true
24 | }
25 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/save/schema-test-save-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "data": {
14 | "objectType": "some_entity",
15 | "login": "nmalik"
16 | },
17 | "upsert": true
18 | }
19 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/update/schema-test-update-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entity": "some_entity",
3 | "client": {"id": "1"},
4 | "execution": {
5 | "timeLimit": 5000,
6 | "asynchronous": 4500
7 | },
8 | "projection": {
9 | "field": "firstname",
10 | "include": true,
11 | "recursive": true
12 | },
13 | "query": {
14 | "field": "login",
15 | "op": "$eq",
16 | "rfield": "someuser"
17 | },
18 | "update": {
19 | "$set": {
20 | "firstName": "new name"
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/invalid-simple-array-constraint-doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "array1": [ "1" ]
3 | }
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/schema-test-validation-element-identity.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "datastore": {
5 | "backend":"mongo",
6 | "collection": "test"
7 | }
8 | },
9 | "schema": {
10 | "name": "validationTest",
11 | "version": {
12 | "value": "1.0",
13 | "changelog": "blahblah"
14 | },
15 | "status": {
16 | "value": "active"
17 | },
18 | "fields": {
19 | "field1": {
20 | "type": "array",
21 | "items": {
22 | "type":"object",
23 | "fields": {
24 | "f1":{"type":"string"},
25 | "id":{"type":"string","constraints":{"element-identity":true}}
26 | }
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/schema-test-validation-empty-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "array1": [ ]
3 | }
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/schema-test-validation-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "datastore": {
5 | "backend":"mongo",
6 | "collection": "test"
7 | }
8 | },
9 | "schema": {
10 | "name": "validationTest",
11 | "version": {
12 | "value": "1.0",
13 | "changelog": "blahblah"
14 | },
15 | "status": {
16 | "value": "active"
17 | },
18 | "fields": {
19 | "field1": {
20 | "type": "string",
21 | "constraints": {
22 | "minLength": 5,
23 | "required": true
24 | }
25 | }
26 | }
27 | },
28 | "field1":"12345"
29 | }
30 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/schema-test-validation-testFieldConstraint.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "datastore": {
5 | "backend":"mongo",
6 | "collection": "test"
7 | }
8 | },
9 | "schema": {
10 | "name": "validationTest",
11 | "version": {
12 | "value": "1.0",
13 | "changelog": "blahblah"
14 | },
15 | "status": {
16 | "value": "active"
17 | },
18 | "fields": {
19 | "field1": {
20 | "type": "string",
21 | "constraints": {
22 | "testFieldConstraint": true
23 | }
24 | }
25 | }
26 | },
27 | "field1":"12345"
28 | }
29 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/simple-array-enum-constraint-doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "array1": [ "v1", "v2", "failure" ]
3 | }
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/testSimpleArrayConstraint.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "datastore": {
5 | "backend":"mongo",
6 | "collection": "test"
7 | }
8 | },
9 | "schema": {
10 | "name": "validationTest",
11 | "version": {
12 | "value": "1.0",
13 | "changelog": "blahblah"
14 | },
15 | "status": {
16 | "value": "active"
17 | },
18 | "fields": {
19 | "array1": {
20 | "type":"array",
21 | "items" : {
22 | "type":"string",
23 | "constraints": {
24 | "minLength":2
25 | }
26 | }
27 | }
28 | }
29 | },
30 | "field1":"12345"
31 | }
32 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/testSimpleArrayEnum.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "testEnum",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource":"mongodata",
7 | "collection":"testEnum"
8 | },
9 | "enums":[
10 | {
11 | "name":"testEnum",
12 | "values":["v1","v2"]
13 | }
14 | ]
15 | },
16 | "schema": {
17 | "access":{
18 | "insert":["anyone"],
19 | "find":["anyone"],
20 | "update":["anyone"]
21 | },
22 | "name": "testEnum",
23 | "version": {
24 | "value": "1.0.0-SNAPSHOT",
25 | "changelog": "blahblah"
26 | },
27 | "status": {
28 | "value": "active"
29 | },
30 | "fields": {
31 | "array1": {
32 | "type":"array",
33 | "items" : {
34 | "type":"string",
35 | "constraints": {
36 | "enum":"testEnum"
37 | }
38 | }
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/valid-simple-array-constraint-doc.json:
--------------------------------------------------------------------------------
1 | {
2 | "array1": [ "213", "123", "12324" ]
3 | }
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/crud/validator/valid-simple-array-constraint-emptyarray.json:
--------------------------------------------------------------------------------
1 | {
2 | "array1": [ ]
3 | }
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/dateCmp-1.json:
--------------------------------------------------------------------------------
1 | {
2 | "objectType": "test",
3 | "dateField":"20151217T04:47:01.890-0500"
4 | }
5 |
--------------------------------------------------------------------------------
/crud/src/test/resources/dateCmp-2.json:
--------------------------------------------------------------------------------
1 | {
2 | "objectType": "test",
3 | "dateField":"20151217T09:47:01.890-0000"
4 | }
5 |
--------------------------------------------------------------------------------
/crud/src/test/resources/gen-overwrite-testdata.json:
--------------------------------------------------------------------------------
1 | {
2 | "_id":"this_wont_change",
3 | "objectType":"user",
4 | "today":"20000101T00:00:00.000+0000"
5 | }
6 |
--------------------------------------------------------------------------------
/crud/src/test/resources/overwrite-md.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "user",
4 | "enums" : [
5 | {
6 | "name":"site_type_enum",
7 | "values": [ "billing", "marketing", "service", "shipping" ]
8 | }
9 | ],
10 | "datastore": {
11 | "backend":"mongo",
12 | "datasource": "mongodata",
13 | "collection": "user"
14 | }
15 | },
16 | "schema" : {
17 | "name" : "user",
18 | "version": {
19 | "value": "5.0.0",
20 | "changelog": "UID Test version"
21 | },
22 | "status": {
23 | "value": "active"
24 | },
25 | "access" : {
26 | "insert": ["anyone"],
27 | "find":["anyone"],
28 | "update":["anyone"],
29 | "delete":["anyone"]
30 | },
31 | "fields": {
32 | "_id": {"type": "string",
33 | "constraints" : {
34 | "identity":1
35 | },
36 | "valueGenerator": {
37 | "type":"IntSequence"
38 | }
39 | },
40 | "objectType": {"type": "string"},
41 | "today":{"type":"date",
42 | "valueGenerator": {
43 | "type":"CurrentTime",
44 | "overwrite":true
45 | }
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/crud/src/test/resources/simplelogger.properties:
--------------------------------------------------------------------------------
1 | org.slf4j.simpleLogger.defaultLogLevel=WARN
2 | org.slf4j.simpleLogger.log.com.redhat.lightblue=WARN
3 | org.slf4j.simpleLogger.log.com.redhat.lightblue.util.Error=ERROR
4 |
--------------------------------------------------------------------------------
/crud/src/test/resources/termsdata.json:
--------------------------------------------------------------------------------
1 | {
2 | "termsVerbiage":[
3 | {
4 | "uid":"1",
5 | "statusCode":"active",
6 | "termsVerbiageTranslation":[
7 | {"statusCode":"inactive",
8 | "localeCode":"en",
9 | "localeText":"English",
10 | "version":1},
11 | {"statusCode":"inactive",
12 | "localeCode":"en",
13 | "localeText":"English",
14 | "version":2},
15 | {"localeCode":"en",
16 | "statusCode":"inactive",
17 | "localeText":"English",
18 | "version":3}],
19 | "name":"New Term",
20 | "termsVerbiageTranslation#":2}],
21 | "lastUpdateDate":"20141021T20:51:26.973+0000",
22 | "statusCode":"active",
23 | "creationDate":"20141021T20:51:26.973+0000",
24 | "termsCategoryCode":"user",
25 | "termsTypeCode":"NDA",
26 | "createdBy":"Marek",
27 | "_id":"5446c74fe4b02251a5376918",
28 | "termsVerbiage#":1,
29 | "lastUpdatedBy":"Marek",
30 | "objectType":"terms"
31 | }
32 |
--------------------------------------------------------------------------------
/etc/onFailure.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | echo "DEBUG BUILD FAILURE"
4 | echo "Current directory is $(pwd)"
5 | echo "Sunfire reports"
6 | for i in `find . -type d -name surefire-reports` ; do for f in $i/*.txt; do echo $f : `cat $f`; done done
7 |
--------------------------------------------------------------------------------
/etc/onSuccess.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "after_success script"
4 |
5 | if [ "$BRANCH" == "master" ]; then
6 | if [ "$JDK_VERSION" == "oraclejdk8" ] && [ "$PULL_REQUEST" == "false" ]; then
7 | echo "DEPLOY MASTER BUILD"
8 | echo "Current directory is $(pwd)"
9 | mvn clean deploy -DskipTests;
10 | fi
11 | fi
12 |
13 |
--------------------------------------------------------------------------------
/etc/sonar.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # kill any previous port forward and the previous mark file about its status
4 | pkill -9 -f "rhc port-forward sonar [-]n lightblue"
5 | rm -f rhc-port-forward-status
6 |
7 | # forward ports from openshift (assumes current server is openshift online and you're a member of the lightblue namespace). A new mark file will eb created if the return value of the rhc command is different than 0
8 | rhc port-forward sonar -n lightblue || echo $? > rhc-port-forward-status &
9 |
10 | # wait a bit for port forwarding to fire up
11 | sleep 10
12 |
13 | # if the file exists, log the error and exit 1
14 | if [ -f "rhc-port-forward-status" ]
15 | then
16 | echo "Error on rhc port-forward. Error code:"
17 | cat rhc-port-forward-status
18 | rm -f rhc-port-forward-status
19 | # rhc process should dead, so it would not need pkill -9 -f "rhc port-forward sonar [-]n lightblue"
20 | exit 1
21 | fi
22 |
23 | # build and publish
24 | mvn clean install -Dmaven.test.failure.ignore=true
25 | mvn -e -B sonar:sonar
26 |
27 | # cleanup port forwarding & mark file
28 | pkill -9 -f "rhc port-forward sonar [-]n lightblue"
29 | rm -f rhc-port-forward-status
30 |
--------------------------------------------------------------------------------
/extensions/src/main/java/com/redhat/lightblue/extensions/Extension.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.extensions;
20 |
21 | /**
22 | * Marker interface for all extension implementations
23 | *
24 | * Here's how it all comes together:
25 | *
26 | * - XXXCrudController: implement ExtensionSupport interface. Implement the
27 | * getExtensionInstance that returns an instance of the requested extension. -
28 | * The extension implementation extends Extension interface.
29 | */
30 | public interface Extension {
31 | }
32 |
--------------------------------------------------------------------------------
/extensions/src/main/java/com/redhat/lightblue/extensions/synch/InvalidLockException.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.extensions.synch;
2 |
3 | public class InvalidLockException extends RuntimeException {
4 | public InvalidLockException(String resourceId) {
5 | super(resourceId);
6 | }
7 |
8 | public InvalidLockException() {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/extensions/src/main/java/com/redhat/lightblue/extensions/valuegenerator/ValueGeneratorSupport.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.extensions.valuegenerator;
2 |
3 | import com.redhat.lightblue.extensions.Extension;
4 |
5 | import com.redhat.lightblue.metadata.ValueGenerator;
6 | import com.redhat.lightblue.metadata.EntityMetadata;
7 |
8 | /**
9 | * Value generation interface.
10 | *
11 | */
12 | public interface ValueGeneratorSupport extends Extension {
13 |
14 | /**
15 | * Returns the value generators this back end supports
16 | */
17 | ValueGenerator.ValueGeneratorType[] getSupportedGeneratorTypes();
18 |
19 | /**
20 | * Generates a new value. The returned value is a Java value object.
21 | *
22 | */
23 | Object generateValue(EntityMetadata md, ValueGenerator generator);
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/metadata/README:
--------------------------------------------------------------------------------
1 | For testing json schemas just add a new json document in the appropriate test resource directory.
2 | In src/test/resources directories named -json-schema-test-{invalid,valid} will have their
3 | contents tested against the given .json file. If the directory ends in "invalid" the test
4 | will expect the json to be invalid against the schema. If the directory ends in "valid" the test
5 | will fail if the json doesn't validate against the schema.
6 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/DataStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * Interface for datastore metadata implementations. The actual contents are
25 | * defined by the implementation.
26 | */
27 | public interface DataStore extends Serializable {
28 |
29 | /**
30 | * Returns the type of the backend
31 | */
32 | String getBackend();
33 | }
34 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/EntityConstraint.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * Defines a constraint that applies to the entity
25 | */
26 | public interface EntityConstraint extends Serializable {
27 |
28 | /**
29 | * Returns the constraint type
30 | */
31 | String getType();
32 | }
33 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/FieldConstraint.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata;
20 |
21 | /**
22 | * Interface for constraints that apply to a field
23 | */
24 | public interface FieldConstraint {
25 | /**
26 | * Return the constraint type
27 | */
28 | String getType();
29 |
30 | /**
31 | * Determines if the constraint is valid for the given field type
32 | */
33 | boolean isValidForFieldType(Type fieldType);
34 | }
35 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/HookConfiguration.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata;
20 |
21 | import java.io.Serializable;
22 |
23 | /**
24 | * Interface that denotes a hook configuration
25 | */
26 | public interface HookConfiguration extends Serializable {
27 | }
28 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/IndexSortKey.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package com.redhat.lightblue.metadata;
5 |
6 | import com.redhat.lightblue.query.SortKey;
7 | import com.redhat.lightblue.util.Path;
8 |
9 | /**
10 | * @author bvulaj
11 | *
12 | */
13 | public class IndexSortKey extends SortKey {
14 |
15 | private static final long serialVersionUID = 1L;
16 |
17 | private final boolean caseInsensitive;
18 |
19 | /**
20 | * @param field
21 | * @param desc
22 | */
23 | public IndexSortKey(Path field, boolean desc) {
24 | super(field, desc);
25 | caseInsensitive = false;
26 | }
27 |
28 | /**
29 | * @param field
30 | * @param desc
31 | * @param caseInsensitive
32 | */
33 | public IndexSortKey(Path field, boolean desc, boolean caseInsensitive) {
34 | super(field, desc);
35 | this.caseInsensitive = caseInsensitive;
36 |
37 | }
38 |
39 | public boolean isCaseInsensitive() {
40 | return this.caseInsensitive;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/MetadataAccess.java:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
4 |
5 | This file is part of lightblue.
6 |
7 | This program is free software: you can redistribute it and/or modify
8 | it under the terms of the GNU General Public License as published by
9 | the Free Software Foundation, either version 3 of the License, or
10 | (at your option) any later version.
11 |
12 | This program is distributed in the hope that it will be useful,
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | GNU General Public License for more details.
16 |
17 | You should have received a copy of the GNU General Public License
18 | along with this program. If not, see .
19 | */
20 | package com.redhat.lightblue.metadata;
21 |
22 | /**
23 | * Marker interface to indicate objects that represent some portion of access in
24 | * a metadata document.
25 | *
26 | * @author nmalik
27 | */
28 | public interface MetadataAccess {
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/MetadataStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata;
20 |
21 | public enum MetadataStatus {
22 | ACTIVE, DEPRECATED, DISABLED
23 | }
24 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/TypeResolver.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata;
20 |
21 | /**
22 | * Interface for classes that resolve types
23 | */
24 | public interface TypeResolver {
25 |
26 | /**
27 | * Return the type object for the given type. If not found, return null.
28 | */
29 | Type getType(String typeName);
30 | }
31 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/ValueGenerator.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.metadata;
2 |
3 | import java.io.Serializable;
4 | import java.util.Properties;
5 |
6 | /**
7 | * Represents value generator definition located in entityInfo.
8 | *
9 | * @author mpatercz
10 | *
11 | */
12 | public class ValueGenerator implements Serializable {
13 |
14 | private static final long serialVersionUID = 1L;
15 |
16 | public enum ValueGeneratorType {
17 | IntSequence,
18 | UUID,
19 | CurrentTime
20 | }
21 |
22 | // defines how values are generated
23 | private final ValueGeneratorType valueGeneratorType;
24 | private final Properties properties = new Properties();
25 | private boolean overwrite = false;
26 |
27 | public ValueGenerator(ValueGeneratorType valueGeneratorType) {
28 | super();
29 | this.valueGeneratorType = valueGeneratorType;
30 | }
31 |
32 | public ValueGeneratorType getValueGeneratorType() {
33 | return valueGeneratorType;
34 | }
35 |
36 | public Properties getProperties() {
37 | return properties;
38 | }
39 |
40 | public boolean isOverwrite() {
41 | return overwrite;
42 | }
43 |
44 | public void setOverwrite(boolean b) {
45 | overwrite = b;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/VersionInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata;
20 |
21 | public class VersionInfo extends Version {
22 |
23 | private MetadataStatus status;
24 | private boolean defaultFlag;
25 |
26 | public MetadataStatus getStatus() {
27 | return status;
28 | }
29 |
30 | public void setStatus(MetadataStatus st) {
31 | status = st;
32 | }
33 |
34 | public boolean isDefault() {
35 | return defaultFlag;
36 | }
37 |
38 | public void setDefault(boolean d) {
39 | defaultFlag = d;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/parser/DataStoreParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.parser;
20 |
21 | import com.redhat.lightblue.metadata.DataStore;
22 |
23 | /**
24 | * Interface for datastore parsers
25 | */
26 | public interface DataStoreParser extends Parser {
27 | String getDefaultName();
28 | }
29 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/parser/DefaultEntityConstraintParsers.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.parser;
20 |
21 | import com.redhat.lightblue.metadata.EntityConstraint;
22 | import com.redhat.lightblue.util.DefaultResolver;
23 |
24 | /**
25 | * Convenience class to register all predefined constraint parsers to
26 | * MetadataParser
27 | */
28 | public class DefaultEntityConstraintParsers
29 | extends DefaultResolver> {
30 |
31 | public DefaultEntityConstraintParsers() {
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/parser/EntityConstraintParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.parser;
20 |
21 | import com.redhat.lightblue.metadata.EntityConstraint;
22 |
23 | /**
24 | * Interface for entity constraint parsers
25 | */
26 | public interface EntityConstraintParser
27 | extends Parser {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/parser/FieldConstraintParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.parser;
20 |
21 | import com.redhat.lightblue.metadata.FieldConstraint;
22 |
23 | /**
24 | * Interface for field constraint parsers
25 | */
26 | public interface FieldConstraintParser extends Parser {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/parser/HookConfigurationParser.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.parser;
20 |
21 | import com.redhat.lightblue.hooks.CRUDHook;
22 | import com.redhat.lightblue.metadata.HookConfiguration;
23 |
24 | /**
25 | * Interface for hook configuration parsers.
26 | */
27 | public interface HookConfigurationParser extends Parser {
28 |
29 | /**
30 | * The name of the hook the config parser is used for. TODO consider
31 | * accepting many names?
32 | *
33 | * @return the name of the hook
34 | */
35 | String getName();
36 |
37 | CRUDHook getCRUDHook();
38 | }
39 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/parser/ParserRegistry.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.parser;
20 |
21 | import com.redhat.lightblue.util.DefaultRegistry;
22 |
23 | /**
24 | * Allows parser extensions to be registered with the metadata parser
25 | */
26 | public class ParserRegistry extends DefaultRegistry> {
27 | }
28 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/types/ArrayType.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.types;
20 |
21 | public final class ArrayType extends ContainerType {
22 |
23 | public static final String NAME = "array";
24 | public static final ArrayType TYPE = new ArrayType();
25 |
26 | private ArrayType() {
27 | super(NAME);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/types/ObjectType.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.types;
20 |
21 | public final class ObjectType extends ContainerType {
22 |
23 | public static final String NAME = "object";
24 | public static final ObjectType TYPE = new ObjectType();
25 |
26 | private ObjectType() {
27 | super(NAME);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/metadata/src/main/java/com/redhat/lightblue/metadata/types/ReferenceType.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.types;
20 |
21 | public final class ReferenceType extends ContainerType {
22 |
23 | public static final String NAME = "reference";
24 | public static final ReferenceType TYPE = new ReferenceType();
25 |
26 | private ReferenceType() {
27 | super(NAME);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/metadata/src/main/resources/json-schema/metadata/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "copyright": [
3 | "Copyright 2013 Red Hat, Inc. and/or its affiliates.",
4 | "This file is part of lightblue.",
5 | "This program is free software: you can redistribute it and/or modify",
6 | "it under the terms of the GNU General Public License as published by",
7 | "the Free Software Foundation, either version 3 of the License, or",
8 | "(at your option) any later version.",
9 | "This program is distributed in the hope that it will be useful,",
10 | "but WITHOUT ANY WARRANTY; without even the implied warranty of",
11 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
12 | "GNU General Public License for more details.",
13 | "You should have received a copy of the GNU General Public License",
14 | "along with this program. If not, see ."
15 | ],
16 | "$schema": "http://json-schema.org/draft-04/schema#",
17 | "type": "object",
18 | "properties": {
19 | "entityInfo": {
20 | "$ref": "entityInfo.json#"
21 | },
22 | "schema": {
23 | "$ref": "schema.json#"
24 | }
25 | },
26 | "required": [
27 | "entityInfo",
28 | "schema"
29 | ],
30 | "additionalProperties": false
31 | }
32 |
--------------------------------------------------------------------------------
/metadata/src/test/java/com/redhat/lightblue/metadata/types/ArrayTypeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.types;
20 |
21 | import org.junit.Test;
22 |
23 | import static org.junit.Assert.assertTrue;
24 |
25 | public class ArrayTypeTest {
26 |
27 | @Test
28 | public void testIsAContainerType() {
29 | assertTrue(ContainerType.class.isAssignableFrom(ArrayType.class));
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/metadata/src/test/java/com/redhat/lightblue/metadata/types/ObjectTypeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.types;
20 |
21 | import org.junit.After;
22 | import org.junit.Before;
23 | import org.junit.Test;
24 |
25 | import static org.junit.Assert.assertNotNull;
26 |
27 | public class ObjectTypeTest {
28 |
29 | @Before
30 | public void setUp() throws Exception {
31 | }
32 |
33 | @After
34 | public void tearDown() throws Exception {
35 | }
36 |
37 | @Test
38 | public void testType() {
39 | ObjectType objectType = ObjectType.TYPE;
40 | assertNotNull(objectType);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/metadata/src/test/java/com/redhat/lightblue/metadata/types/ReferenceTypeTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.metadata.types;
20 |
21 | import org.junit.After;
22 | import org.junit.Before;
23 | import org.junit.Test;
24 |
25 | import static org.junit.Assert.assertNotNull;
26 |
27 | public class ReferenceTypeTest {
28 |
29 | @Before
30 | public void setUp() throws Exception {
31 | }
32 |
33 | @After
34 | public void tearDown() throws Exception {
35 | }
36 |
37 | @Test
38 | public void testType() {
39 | ReferenceType referenceType = ReferenceType.TYPE;
40 | assertNotNull(referenceType);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/BinaryTypeTest-sample.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lightblue-platform/lightblue-core/64fe63cf0131eb0afc11c1c1e8824c7b8fa03215/metadata/src/test/resources/BinaryTypeTest-sample.pdf
--------------------------------------------------------------------------------
/metadata/src/test/resources/JSONMetadataParserTest-EntityInfo-properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "user",
3 | "enums" : [
4 | {
5 | "name":"site_type_enum",
6 | "values": [ "billing", "marketing", "service", "shipping" ]
7 | }
8 | ],
9 | "datastore": {
10 | "backend":"empty"
11 | },
12 | "manageIndexes": false
13 | }
14 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/JSONMetadataParserTest-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "version": {
4 | "value": "1.0.0",
5 | "changelog": "Initial version"
6 | },
7 | "status": {
8 | "value": "active"
9 | },
10 | "access": {
11 | "insert": ["admin"],
12 | "find": ["admin", "all"],
13 | "update": ["admin"],
14 | "delete": ["admin"]
15 | },
16 | "datastore": {
17 | "backend": "empty"
18 | },
19 | "fields": {
20 | "name": {
21 | "type": "array",
22 | "items": {
23 | "type":"string",
24 | "constraints": {
25 | "required":true
26 | }
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/JSONMetadataParserTest-object-binary.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "enums": [
5 | {
6 | "name": "customerType",
7 | "values": ["person", "organization"]
8 | }
9 | ],
10 | "indexes": [
11 | {
12 | "unique": true,
13 | "fields": [{
14 | "field": "person",
15 | "dir": "$asc"
16 | }]
17 | }
18 | ],
19 | "datastore": {
20 | "backend": "empty"
21 | }
22 | },
23 | "schema": {
24 | "name": "test",
25 | "version": {
26 | "value": "1.0",
27 | "changelog": "Initial version"
28 | },
29 | "status": {
30 | "value": "active"
31 | },
32 | "access": {
33 | "insert": ["admin"],
34 | "update": ["admin"],
35 | "find": ["admin", "all"],
36 | "delete": ["admin"]
37 | },
38 | "fields": {
39 | "binaryData": {
40 | "type": "binary",
41 | "constraints": {
42 | "required": true
43 | }
44 | }
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/JSONMetadataParserTest-properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "version": {
4 | "value": "1.0.0",
5 | "changelog": "Initial version"
6 | },
7 | "status": {
8 | "value": "active"
9 | },
10 | "access": {
11 | "insert": ["admin"],
12 | "find": ["admin", "all"],
13 | "update": ["admin"],
14 | "delete": ["admin"],
15 | "accessProperty": [1,2,3,4,5]
16 | },
17 | "datastore": {
18 | "backend": "empty"
19 | },
20 | "fields": {
21 | "name": {
22 | "type": "string",
23 | "valueGenerator": {
24 | "type":"IntSequence",
25 | "configuration":{
26 | "name":"seq",
27 | "initialValue":1000
28 | }
29 | },
30 | "nameProperty":{ "x":"y"}
31 | },
32 | "customerType": {
33 | "type": "string",
34 | "enum": ["person", "organization"],
35 | "customerTypeProperty":1
36 | },
37 | "creationDate": {
38 | "type": "date"
39 | },
40 | "lastUpdateDate": {
41 | "type": "date"
42 | }
43 | },
44 | "schemaProperty":{"a":{"b":"c"}}
45 | }
46 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/JSONMetadataParserTest-valuegenerator.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "test",
3 | "version": {
4 | "value": "1.0.0",
5 | "changelog": "Initial version"
6 | },
7 | "status": {
8 | "value": "active"
9 | },
10 | "access": {
11 | "insert": ["admin"],
12 | "find": ["admin", "all"],
13 | "update": ["admin"],
14 | "delete": ["admin"]
15 | },
16 | "datastore": {
17 | "backend": "empty"
18 | },
19 | "fields": {
20 | "name": {
21 | "type": "string",
22 | "valueGenerator": {
23 | "type":"IntSequence",
24 | "configuration":{
25 | "name":"seq",
26 | "initialValue":1000
27 | }
28 | }
29 | },
30 | "customerType": {
31 | "type": "string",
32 | "enum": ["person", "organization"]
33 | },
34 | "creationDate": {
35 | "type": "date"
36 | },
37 | "lastUpdateDate": {
38 | "type": "date"
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/composite/A_def.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "A_def",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "user"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "A_def",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string" },
27 | "objectType": {"type": "string"},
28 | "field1": { "type": "string" },
29 | "obj1": {
30 | "type":"object",
31 | "fields": {
32 | "field1": { "type":"string" },
33 | "c_ref":{"type":"string"},
34 | "c": {
35 | "type":"reference",
36 | "entity":"C",
37 | "query":{"field":"_id","op":"$eq","rfield":"$parent.c_ref"}
38 | }
39 | }
40 | },
41 | "b_ref": { "type": "string" },
42 | "b" : {
43 | "type":"reference",
44 | "entity":"B",
45 | "query":{ "field":"_id","op":"$eq","rfield":"$parent.b_ref"}
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/composite/B.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "B",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "user"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "B",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string" },
27 | "objectType": {"type": "string"},
28 | "field1": { "type": "string" },
29 | "field2": { "type": "string" }
30 | }
31 | }
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/composite/D.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo" : {
3 | "name": "D",
4 | "datastore": {
5 | "backend":"mongo",
6 | "datasource": "mongodata",
7 | "collection": "user"
8 | }
9 | },
10 | "schema" : {
11 | "name" : "D",
12 | "version": {
13 | "value": "1.0.0",
14 | "changelog": "Test"
15 | },
16 | "status": {
17 | "value": "active"
18 | },
19 | "access" : {
20 | "insert": ["anyone"],
21 | "find":["anyone"],
22 | "update":["anyone"],
23 | "delete":["anyone"]
24 | },
25 | "fields": {
26 | "_id": {"type": "string" },
27 | "objectType": {"type": "string"},
28 | "field1": { "type": "string" }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/hook-json-schema-test-invalid/schema-test-hook-invalid.json:
--------------------------------------------------------------------------------
1 | {
2 | "date": "20131108 1120000000",
3 | "clientId": "asdf"
4 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/hook-json-schema-test-valid/schema-test-hook-esb.json:
--------------------------------------------------------------------------------
1 | {
2 | "date": "20131108 1120000000",
3 | "clientId": "asdf",
4 | "after": {
5 | "objectType": "some_entity",
6 | "login": "jdoe",
7 | "firstname": "John",
8 | "lastname": "Doe"
9 | }
10 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/hook-json-schema-test-valid/schema-test-hook-find.json:
--------------------------------------------------------------------------------
1 | {
2 | "date": "20131108 1120000000",
3 | "clientId": "asdf",
4 | "request": {
5 | "find": {
6 | "objectType": "some_entity",
7 | "clientId": "1",
8 | "execution": {
9 | "timeLimit": 5000,
10 | "asynchronous": 4500
11 | },
12 | "projection": {
13 | "field": "firstname",
14 | "include": true,
15 | "recursive": true
16 | },
17 | "query": {
18 | "field": "login",
19 | "op": "$eq",
20 | "rfield": "someuser"
21 | },
22 | "range": [
23 | 0,
24 | 10
25 | ],
26 | "sort": {
27 | "login": "$asc"
28 | }
29 | }
30 | },
31 | "response": {
32 | "objectType": "some_entity",
33 | "login": "asdf",
34 | "somefield": "asdf"
35 | }
36 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/hook-json-schema-test-valid/schema-test-hook-insert.json:
--------------------------------------------------------------------------------
1 | {
2 | "date": "20131108 1120000000",
3 | "clientId": "asdf",
4 | "request": {
5 | "insert": {
6 | "objectType": "some_entity",
7 | "clientId": "asdf",
8 | "execution": {
9 | "timeLimit": 5000,
10 | "asynchronous": 4500
11 | },
12 | "projection": {
13 | "field": "firstname",
14 | "include": true,
15 | "recursive": true
16 | },
17 | "data": {
18 | "objectType": "some_entity",
19 | "login": "jdoe",
20 | "firstname": "John",
21 | "lastname": "Doe"
22 | }
23 | }
24 | },
25 | "response": {
26 | "firstname": "John"
27 | },
28 | "after": {
29 | "objectType": "some_entity",
30 | "login": "jdoe",
31 | "firstname": "John",
32 | "lastname": "Doe"
33 | }
34 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/hook-json-schema-test-valid/schema-test-hook-update.json:
--------------------------------------------------------------------------------
1 | {
2 | "date": "20131108 1120000000",
3 | "clientId": "asdf",
4 | "request": {
5 | "update": {
6 | "objectType": "some_entity",
7 | "clientId": "asdf",
8 | "execution": {
9 | "timeLimit": 5000,
10 | "asynchronous": 4500
11 | },
12 | "projection": {
13 | "field": "firstname",
14 | "include": true,
15 | "recursive": true
16 | },
17 | "query": {
18 | "field": "login",
19 | "op": "$eq",
20 | "rfield": "someuser"
21 | },
22 | "update": {
23 | "$set": {
24 | "firstName": "new name"
25 | }
26 | }
27 | }
28 | },
29 | "response": {
30 | "objectType": "some_entity",
31 | "firstname": "new name"
32 | },
33 | "before": {
34 | "firstname": "old name"
35 | },
36 | "after": {
37 | "firstname": "new name"
38 | }
39 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-invalid/schema-test-metadata-array-items-missing-type.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "datastore": {
5 | "backend":"empty"
6 | }
7 | },
8 | "schema": {
9 | "name": "test",
10 | "version": {
11 | "value": "1.0",
12 | "changelog": "Initial version"
13 | },
14 | "status": {
15 | "value": "active"
16 | },
17 | "access": {
18 | "insert": ["admin"],
19 | "find": ["admin", "all"],
20 | "update": ["admin"],
21 | "delete": ["admin"]
22 | },
23 | "constraints": [
24 | {
25 | "unique": ["name"]
26 | }
27 | ],
28 | "fields": {
29 | "theArray": {
30 | "type": "array",
31 | "items": {
32 | "fields": {
33 | "value": {
34 | "type": "string"
35 | }
36 | }
37 | }
38 | }
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-invalid/schema-test-metadata-simple-defaultVersion.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "defaultVersion": {
5 | "invalid": "1.0"
6 | },
7 | "indexes": [
8 | {
9 | "unique": true,
10 | "fields": [{"field":"name"}]
11 | }
12 | ],
13 | "datastore": {
14 | "backend":"empty"
15 | }
16 | },
17 | "schema": {
18 | "name": "test",
19 | "version": {
20 | "value": "1.0",
21 | "changelog": "Initial version"
22 | },
23 | "status": {
24 | "value": "active"
25 | },
26 | "access": {
27 | "insert": ["admin"],
28 | "find": ["admin", "all"],
29 | "update": ["admin"],
30 | "delete": ["admin"]
31 | },
32 | "fields": {
33 | "name": {
34 | "type": "string"
35 | },
36 | "counter": {
37 | "type": "integer"
38 | }
39 | }
40 | }
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-array-enum.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | }
9 | ],
10 | "enums": [
11 | {
12 | "name": "streetArray",
13 | "values": ["one", "two"]
14 | }
15 | ],
16 | "datastore": {
17 | "backend":"empty"
18 | }
19 | },
20 | "schema": {
21 | "name": "test",
22 | "version": {
23 | "value": "1.0",
24 | "changelog": "Initial version"
25 | },
26 | "status": {
27 | "value": "active"
28 | },
29 | "access": {
30 | "insert": ["admin"],
31 | "find": ["admin", "all"],
32 | "update": ["admin"],
33 | "delete": ["admin"]
34 | },
35 | "fields": {
36 | "street": {
37 | "type": "array",
38 | "items": {
39 | "type": "string",
40 | "constraints": {
41 | "enum": "streetArray"
42 | }
43 | }
44 | }
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-array-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | }
9 | ],
10 | "datastore": {
11 | "backend":"empty"
12 | }
13 | },
14 | "schema": {
15 | "name": "test",
16 | "version": {
17 | "value": "1.0",
18 | "changelog": "Initial version"
19 | },
20 | "status": {
21 | "value": "active"
22 | },
23 | "access": {
24 | "insert": ["admin"],
25 | "find": ["admin", "all"],
26 | "update": ["admin"],
27 | "delete": ["admin"]
28 | },
29 | "fields": {
30 | "street": {
31 | "type": "array",
32 | "items": {
33 | "type": "string"
34 | }
35 | }
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-enum.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | }
9 | ],
10 | "enums": [
11 | {
12 | "name": "cusotmerType",
13 | "values": ["person", "organization"]
14 | }
15 | ],
16 | "datastore": {
17 | "backend":"empty"
18 | }
19 | },
20 | "schema": {
21 | "name": "test",
22 | "version": {
23 | "value": "1.0",
24 | "changelog": "Initial version"
25 | },
26 | "status": {
27 | "value": "active"
28 | },
29 | "access": {
30 | "insert": ["admin"],
31 | "find": ["admin", "all"],
32 | "update": ["admin"],
33 | "delete": ["admin"]
34 | },
35 | "fields": {
36 | "customerType": {
37 | "type": "string",
38 | "constraints": {
39 | "enum": "customerType"
40 | }
41 | }
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-many-constraints.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | },
9 | {
10 | "unique": true,
11 | "fields": [{"field":"counter","dir": "$asc"}]
12 | }
13 | ],
14 | "datastore": {
15 | "backend":"empty"
16 | }
17 | },
18 | "schema": {
19 | "name": "test",
20 | "version": {
21 | "value": "1.0",
22 | "changelog": "Initial version"
23 | },
24 | "status": {
25 | "value": "active"
26 | },
27 | "access": {
28 | "insert": ["admin"],
29 | "find": ["admin", "all"],
30 | "update": ["admin"],
31 | "delete": ["admin"]
32 | },
33 | "fields": {
34 | "name": {
35 | "type": "string"
36 | },
37 | "counter": {
38 | "type": "integer"
39 | }
40 | }
41 | }
42 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-object-enum-with-description.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | }
9 | ],
10 | "enums": [
11 | {
12 | "name": "customerType",
13 | "annotatedValues": [
14 | {"name": "person", "description": "a person customer"},
15 | {"name": "organization", "description": "a organization customer"}
16 | ]
17 | }
18 | ],
19 | "datastore": {
20 | "backend":"empty"
21 | }
22 | },
23 | "schema": {
24 | "name": "test",
25 | "version": {
26 | "value": "1.0",
27 | "changelog": "Initial version"
28 | },
29 | "status": {
30 | "value": "active"
31 | },
32 | "access": {
33 | "insert": ["admin"],
34 | "find": ["admin", "all"],
35 | "update": ["admin"],
36 | "delete": ["admin"]
37 | },
38 | "fields": {
39 | "customerType": {
40 | "type": "string",
41 | "constraints": {
42 | "enum": "customerType"
43 | }
44 | }
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-object-enum.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | }
9 | ],
10 | "enums": [
11 | {
12 | "name": "cusotmerType",
13 | "values": ["person", "organization"]
14 | }
15 | ],
16 | "datastore": {
17 | "backend":"empty"
18 | }
19 | },
20 | "schema": {
21 | "name": "test",
22 | "version": {
23 | "value": "1.0",
24 | "changelog": "Initial version"
25 | },
26 | "status": {
27 | "value": "active"
28 | },
29 | "access": {
30 | "insert": ["admin"],
31 | "find": ["admin", "all"],
32 | "update": ["admin"],
33 | "delete": ["admin"]
34 | },
35 | "fields": {
36 | "customerType": {
37 | "type": "string",
38 | "constraints": {
39 | "enum": "customerType"
40 | }
41 | }
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-object-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | }
9 | ],
10 | "datastore": {
11 | "backend":"empty"
12 | }
13 | },
14 | "schema": {
15 | "name": "test",
16 | "version": {
17 | "value": "1.0",
18 | "changelog": "Initial version"
19 | },
20 | "status": {
21 | "value": "active"
22 | },
23 | "access": {
24 | "insert": ["admin"],
25 | "find": ["admin", "all"],
26 | "update": ["admin"],
27 | "delete": ["admin"]
28 | },
29 | "fields": {
30 | "name": {
31 | "type": "string"
32 | },
33 | "creationDate": {
34 | "type": "date",
35 | "constraints": {
36 | "required": true
37 | }
38 | },
39 | "lastUpdateDate": {
40 | "type": "date"
41 | }
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-object-valueGenerator.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "datastore": {
5 | "backend":"empty"
6 | }
7 | },
8 | "schema": {
9 | "name": "test",
10 | "version": {
11 | "value": "1.0",
12 | "changelog": "Initial version"
13 | },
14 | "status": {
15 | "value": "active"
16 | },
17 | "access": {
18 | "insert": ["admin"],
19 | "find": ["admin", "all"],
20 | "update": ["admin"],
21 | "delete": ["admin"]
22 | },
23 | "fields": {
24 | "customerId": {
25 | "type": "integer",
26 | "valueGenerator": {
27 | "type": "IntSequence",
28 | "configuration": {
29 | "min": "10000",
30 | "max": "99999"
31 | }
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-ref-everything.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name","dir": "$asc"}]
8 | }
9 | ],
10 | "enums": [
11 | {
12 | "name": "streetArray",
13 | "values": ["one", "two"]
14 | }
15 | ],
16 | "datastore": {
17 | "backend":"empty"
18 | }
19 | },
20 | "schema": {
21 | "name": "test",
22 | "version": {
23 | "value": "1.0",
24 | "changelog": "Initial version"
25 | },
26 | "status": {
27 | "value": "active"
28 | },
29 | "access": {
30 | "insert": ["admin"],
31 | "find": ["admin", "all"],
32 | "update": ["admin"],
33 | "delete": ["admin"]
34 | },
35 | "fields": {
36 | "_id" : { "type":"string" },
37 | "something": {
38 | "type": "reference",
39 | "entity": "otherEntity",
40 | "versionValue": "1.0.0",
41 | "projection": { "field":"*", "recursive":true, "include":true },
42 | "query": {"field":"_id","op":"$eq","rfield":"$parent._id"}
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-simple-binary.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "defaultVersion": "1.0",
5 | "indexes": [
6 | {
7 | "unique": true,
8 | "fields": [{
9 | "field": "name",
10 | "dir": "$asc"
11 | }]
12 | }
13 | ],
14 | "datastore": {
15 | "backend": "empty"
16 | }
17 | },
18 | "schema": {
19 | "name": "test",
20 | "version": {
21 | "value": "1.0",
22 | "changelog": "Initial version"
23 | },
24 | "status": {
25 | "value": "active"
26 | },
27 | "access": {
28 | "insert": ["admin"],
29 | "find": ["admin", "all"],
30 | "update": ["admin"],
31 | "delete": ["admin"]
32 | },
33 | "fields": {
34 | "name": {
35 | "type": "string"
36 | },
37 | "counter": {
38 | "type": "integer"
39 | },
40 | "binaryField": {
41 | "type": "binary"
42 | }
43 | }
44 | }
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-simple-field-access.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "indexes": [
5 | {
6 | "unique": true,
7 | "fields": [{"field":"name", "dir": "$asc"}]
8 | }
9 | ],
10 | "datastore": {
11 | "backend":"empty"
12 | }
13 | },
14 | "schema": {
15 | "name": "test",
16 | "version": {
17 | "value": "1.0",
18 | "changelog": "Initial version"
19 | },
20 | "status": {
21 | "value": "active"
22 | },
23 | "access": {
24 | "insert": ["admin"],
25 | "find": ["admin", "all"],
26 | "update": ["admin"],
27 | "delete": ["admin"]
28 | },
29 | "fields": {
30 | "name": {
31 | "type": "string",
32 | "access": {
33 | "find": [
34 | "all"
35 | ],
36 | "update": [
37 | "admin"
38 | ]
39 | }
40 | },
41 | "counter": {
42 | "type": "integer"
43 | }
44 | }
45 | }
46 | }
--------------------------------------------------------------------------------
/metadata/src/test/resources/metadata-json-schema-test-valid/schema-test-metadata-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "name": "test",
4 | "defaultVersion": "1.0",
5 | "indexes": [
6 | {
7 | "unique": true,
8 | "fields": [{"field":"name", "dir":"$asc"}]
9 | }
10 | ],
11 | "datastore": {
12 | "backend":"empty"
13 | }
14 | },
15 | "schema": {
16 | "name": "test",
17 | "version": {
18 | "value": "1.0",
19 | "changelog": "Initial version"
20 | },
21 | "status": {
22 | "value": "active"
23 | },
24 | "access": {
25 | "insert": ["admin"],
26 | "find": ["admin", "all"],
27 | "update": ["admin"],
28 | "delete": ["admin"]
29 | },
30 | "fields": {
31 | "name": {
32 | "type": "string"
33 | },
34 | "counter": {
35 | "type": "integer"
36 | }
37 | }
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/metadata/src/test/resources/simplelogger.properties:
--------------------------------------------------------------------------------
1 | org.slf4j.simpleLogger.defaultLogLevel=WARN
2 | org.slf4j.simpleLogger.log.com.redhat.lightblue=WARN
3 | org.slf4j.simpleLogger.log.com.redhat.lightblue.util.Error=ERROR
4 |
5 |
--------------------------------------------------------------------------------
/metadata/src/test/scripts/junit-prep.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | mkdir -p target/test-classes
4 |
5 | for x in `ls -1 -d src/test/resources/*json-schema-test*/`;
6 | do
7 | BASE=`echo $x | sed 's#.*/\([^/]*\)/#\1#g'`
8 | ls -1 $x*.json | sed 's#src/test/resources/\(.*\)#\1#g' > target/test-classes/junit-files-$BASE.log
9 | # ls -1 $x | sed 's#src/test/resources/\(.*\)#\1#g' > target/test-classes/junit-files-$BASE.log
10 | done
11 |
--------------------------------------------------------------------------------
/misc/src/test/java/com/redhat/lightblue/TestDataStoreParser.java:
--------------------------------------------------------------------------------
1 | ../../../../../../../crud/src/test/java/com/redhat/lightblue/TestDataStoreParser.java
--------------------------------------------------------------------------------
/misc/src/test/java/com/redhat/lightblue/metadata:
--------------------------------------------------------------------------------
1 | ../../../../../../../crud/src/test/java/com/redhat/lightblue/metadata
--------------------------------------------------------------------------------
/misc/src/test/resources/savedSearch.json:
--------------------------------------------------------------------------------
1 | ../../../src/main/metadata/lb-saved-search.json
--------------------------------------------------------------------------------
/misc/src/test/resources/simplelogger.properties:
--------------------------------------------------------------------------------
1 | org.slf4j.simpleLogger.defaultLogLevel=ERROR
2 | org.slf4j.simpleLogger.log.com.redhat.lightblue=DEBUG
3 | org.slf4j.simpleLogger.log.com.redhat.lightblue.util.Error=ERROR
4 |
--------------------------------------------------------------------------------
/query-api/src/main/java/com/redhat/lightblue/query/LogicalExpression.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.query;
20 |
21 | /**
22 | * Base class for unary and nary logical expressions
23 | */
24 | public abstract class LogicalExpression extends QueryExpression {
25 | private static final long serialVersionUID = 1L;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/query-api/src/main/resources/json-schema/projection/field.json:
--------------------------------------------------------------------------------
1 | {
2 | "copyright": [
3 | "Copyright 2013 Red Hat, Inc. and/or its affiliates.",
4 | "This file is part of lightblue.",
5 | "This program is free software: you can redistribute it and/or modify",
6 | "it under the terms of the GNU General Public License as published by",
7 | "the Free Software Foundation, either version 3 of the License, or",
8 | "(at your option) any later version.",
9 | "This program is distributed in the hope that it will be useful,",
10 | "but WITHOUT ANY WARRANTY; without even the implied warranty of",
11 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
12 | "GNU General Public License for more details.",
13 | "You should have received a copy of the GNU General Public License",
14 | "along with this program. If not, see ."],
15 | "id": "#field",
16 | "$schema": "http://json-schema.org/draft-04/schema#",
17 | "type": "object",
18 | "properties": {
19 | "field": {
20 | "type": "string"
21 | },
22 | "include": {
23 | "type": "boolean"
24 | },
25 | "recursive": {
26 | "type": "boolean",
27 | "default": false
28 | }
29 | },
30 | "required": [
31 | "field"
32 | ],
33 | "additionalProperties": false
34 | }
35 |
--------------------------------------------------------------------------------
/query-api/src/main/resources/json-schema/query/array-matches.json:
--------------------------------------------------------------------------------
1 | {
2 | "copyright": [
3 | "Copyright 2013 Red Hat, Inc. and/or its affiliates.",
4 | "This file is part of lightblue.",
5 | "This program is free software: you can redistribute it and/or modify",
6 | "it under the terms of the GNU General Public License as published by",
7 | "the Free Software Foundation, either version 3 of the License, or",
8 | "(at your option) any later version.",
9 | "This program is distributed in the hope that it will be useful,",
10 | "but WITHOUT ANY WARRANTY; without even the implied warranty of",
11 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
12 | "GNU General Public License for more details.",
13 | "You should have received a copy of the GNU General Public License",
14 | "along with this program. If not, see ."],
15 | "id": "#arraymatches",
16 | "$schema": "http://json-schema.org/draft-04/schema#",
17 | "type": "object",
18 | "properties": {
19 | "array": {
20 | "type": "string"
21 | },
22 | "elemMatch": {
23 | "$ref": "choice.json#/definitions/query"
24 | }
25 | },
26 | "required": [
27 | "array",
28 | "elemMatch"
29 | ],
30 | "additionalProperties": false
31 | }
32 |
--------------------------------------------------------------------------------
/query-api/src/main/resources/json-schema/sort/sort-key.json:
--------------------------------------------------------------------------------
1 | {
2 | "copyright": [
3 | "Copyright 2013 Red Hat, Inc. and/or its affiliates.",
4 | "This file is part of lightblue.",
5 | "This program is free software: you can redistribute it and/or modify",
6 | "it under the terms of the GNU General Public License as published by",
7 | "the Free Software Foundation, either version 3 of the License, or",
8 | "(at your option) any later version.",
9 | "This program is distributed in the hope that it will be useful,",
10 | "but WITHOUT ANY WARRANTY; without even the implied warranty of",
11 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
12 | "GNU General Public License for more details.",
13 | "You should have received a copy of the GNU General Public License",
14 | "along with this program. If not, see ."],
15 | "id": "#sortkey",
16 | "$schema": "http://json-schema.org/draft-04/schema#",
17 | "type": "object",
18 | "patternProperties": {
19 | ".*": {
20 | "enum": ["$asc", "$desc"]
21 | }
22 | },
23 | "additionalProperties": false
24 | }
25 |
--------------------------------------------------------------------------------
/query-api/src/test/java/com/redhat/lightblue/query/IsQueriedTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.query;
20 |
21 | import org.junit.Assert;
22 | import org.junit.Test;
23 | import com.redhat.lightblue.util.Path;
24 |
25 | public class IsQueriedTest {
26 | @Test
27 | public void elemMatch() throws Exception {
28 | QueryExpression q = new ArrayMatchExpression(new Path("arr"), new ValueComparisonExpression(new Path("X"), BinaryComparisonOperator._eq, new Value("a")));
29 | Assert.assertTrue(q.isRequired(new Path("arr")));
30 | Assert.assertTrue(q.isRequired(new Path("arr.0.X")));
31 | Assert.assertFalse(q.isRequired(new Path("X")));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/query-api/src/test/java/com/redhat/lightblue/query/UnaryLogicalOperatorTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.query;
20 |
21 | import org.junit.Assert;
22 | import org.junit.Test;
23 |
24 | /**
25 | *
26 | * @author nmalik
27 | */
28 | public class UnaryLogicalOperatorTest {
29 | @Test
30 | public void apply() {
31 | UnaryLogicalOperator op = UnaryLogicalOperator._not;
32 |
33 | Assert.assertFalse(op.apply(true));
34 | Assert.assertTrue(op.apply(false));
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/error/schema-test-error-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "objectType": "error",
3 | "context": "c1/c2/c3/...",
4 | "errorCode": "SomeErrorCode",
5 | "msg": "Error message"
6 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/projection/schema-test-projection-invalid.json:
--------------------------------------------------------------------------------
1 | {
2 | "projection": {
3 | "field": "firstname",
4 | "include": true,
5 | "recursive": true,
6 | "bob": "wuzhere"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/projection/schema-test-projection-single-field.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "firstname",
3 | "include": true,
4 | "recursive": true
5 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/projection/schema-test-projection-single-match-many-project.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "address.*",
3 | "include": true,
4 | "match": {
5 | "field": "login",
6 | "op": "$eq",
7 | "rfield": "someuser"
8 | },
9 | "project": [
10 | {
11 | "field": "streetaddress",
12 | "include": true
13 | },
14 | {
15 | "field": "city",
16 | "include": true
17 | }
18 | ],
19 | "projection": [
20 | {
21 | "field": "streetaddress",
22 | "include": true
23 | },
24 | {
25 | "field": "city",
26 | "include": true
27 | }
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/projection/schema-test-projection-single-match-single-project.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "address.*",
3 | "include": true,
4 | "match": {
5 | "field": "login",
6 | "op": "$eq",
7 | "rfield": "someuser"
8 | },
9 | "project": {
10 | "field": "streetaddress",
11 | "include": true
12 | },
13 | "projection": {
14 | "field": "streetaddress",
15 | "include": true
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/projection/schema-test-projection-single-range-many-project.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "address.*",
3 | "include": true,
4 | "range": [
5 | 0,
6 | 4
7 | ],
8 | "projection": [
9 | {
10 | "field": "streetaddress",
11 | "include": true
12 | },
13 | {
14 | "field": "city",
15 | "include": true
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/projection/schema-test-projection-single-range-single-project.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "address.*",
3 | "include": true,
4 | "range": [
5 | 0,
6 | 4
7 | ],
8 | "projection": {
9 | "field": ".*",
10 | "include": true,
11 | "recursive": true
12 | }
13 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-all-array-nested.json:
--------------------------------------------------------------------------------
1 | {
2 | "$all": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "$any": [
10 | {
11 | "field": "login",
12 | "op": "$eq",
13 | "rfield": "someuser"
14 | },
15 | {
16 | "field": "login",
17 | "op": "$eq",
18 | "rfield": "someuser"
19 | }
20 | ]
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-all-array-not.json:
--------------------------------------------------------------------------------
1 | {
2 | "$all": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "$not": {
10 | "field": "login",
11 | "op": "$eq",
12 | "rfield": "someuser"
13 | }
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-all-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "$all": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "field": "login",
10 | "op": "$eq",
11 | "rfield": "someuser"
12 | }
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-and-array-nested.json:
--------------------------------------------------------------------------------
1 | {
2 | "$and": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "$or": [
10 | {
11 | "field": "login",
12 | "op": "$eq",
13 | "rfield": "someuser"
14 | },
15 | {
16 | "field": "login",
17 | "op": "$eq",
18 | "rfield": "someuser"
19 | }
20 | ]
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-and-array-not.json:
--------------------------------------------------------------------------------
1 | {
2 | "$and": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "$not": {
10 | "field": "login",
11 | "op": "$eq",
12 | "rfield": "someuser"
13 | }
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-and-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "$and": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "field": "login",
10 | "op": "$eq",
11 | "rfield": "someuser"
12 | }
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-any-array-nested.json:
--------------------------------------------------------------------------------
1 | {
2 | "$any": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "$all": [
10 | {
11 | "field": "login",
12 | "op": "$eq",
13 | "rfield": "someuser"
14 | },
15 | {
16 | "field": "login",
17 | "op": "$eq",
18 | "rfield": "someuser"
19 | }
20 | ]
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-any-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "$any": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "field": "login",
10 | "op": "$eq",
11 | "rfield": "someuser"
12 | }
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-array-contains-all.json:
--------------------------------------------------------------------------------
1 | {
2 | "array": "email",
3 | "contains": "$all",
4 | "values": [
5 | "1",
6 | "2"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-array-contains-any.json:
--------------------------------------------------------------------------------
1 | {
2 | "array": "email",
3 | "contains": "$any",
4 | "values": [
5 | "1",
6 | "2"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-array-contains-none.json:
--------------------------------------------------------------------------------
1 | {
2 | "array": "email",
3 | "contains": "$none",
4 | "values": [
5 | "1",
6 | "2"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-array-match.json:
--------------------------------------------------------------------------------
1 | {
2 | "array": "email",
3 | "elemMatch": {
4 | "field": "secondaryEmail",
5 | "op": "$neq",
6 | "rfield": "email"
7 | }
8 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-field-binary-field.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "login",
3 | "op": "$eq",
4 | "rfield": "someuser"
5 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-field-binary-value.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "login",
3 | "op": "$eq",
4 | "rvalue": "somevalue"
5 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-field-nary-value.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "login",
3 | "op": "$in",
4 | "values": ["1", "asdf"]
5 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-invalid.json:
--------------------------------------------------------------------------------
1 | {
2 | "invalid": "search"
3 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-not-any-array-nested.json:
--------------------------------------------------------------------------------
1 | {
2 | "$not": {
3 | "$all": [
4 | {
5 | "field": "age",
6 | "op": "$gte",
7 | "rfield": "18"
8 | },
9 | {
10 | "$any": [
11 | {
12 | "field": "login",
13 | "op": "$eq",
14 | "rfield": "someuser"
15 | },
16 | {
17 | "field": "login",
18 | "op": "$eq",
19 | "rfield": "someuser"
20 | }
21 | ]
22 | }
23 | ]
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-not-any-array-not.json:
--------------------------------------------------------------------------------
1 | {
2 | "$not": {
3 | "$any": [
4 | {
5 | "field": "age",
6 | "op": "$gte",
7 | "rfield": "18"
8 | },
9 | {
10 | "$not": {
11 | "field": "login",
12 | "op": "$eq",
13 | "rfield": "someuser"
14 | }
15 | }
16 | ]
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-not-any-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "$not": {
3 | "$any": [
4 | {
5 | "op": "$gte",
6 | "field": "age",
7 | "rfield": "18"
8 | },
9 | {
10 | "field": "login",
11 | "op": "$eq",
12 | "rfield": "someuser"
13 | }
14 | ]
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-not.json:
--------------------------------------------------------------------------------
1 | {
2 | "$not": {
3 | "field": "login",
4 | "op": "$eq",
5 | "rfield": "someuser"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-or-array-nested.json:
--------------------------------------------------------------------------------
1 | {
2 | "$or": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "$and": [
10 | {
11 | "field": "login",
12 | "op": "$eq",
13 | "rfield": "someuser"
14 | },
15 | {
16 | "field": "login",
17 | "op": "$eq",
18 | "rfield": "someuser"
19 | }
20 | ]
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/query/schema-test-query-or-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "$or": [
3 | {
4 | "field": "age",
5 | "op": "$gte",
6 | "rfield": "18"
7 | },
8 | {
9 | "field": "login",
10 | "op": "$eq",
11 | "rfield": "someuser"
12 | }
13 | ]
14 | }
15 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/simplelogger.properties:
--------------------------------------------------------------------------------
1 | org.slf4j.simpleLogger.defaultLogLevel=ERROR
2 |
--------------------------------------------------------------------------------
/query-api/src/test/resources/sort/schema-test-sort-invalid.json:
--------------------------------------------------------------------------------
1 | {
2 | "other.key": "$invalid"
3 | }
--------------------------------------------------------------------------------
/query-api/src/test/resources/sort/schema-test-sort-key.json:
--------------------------------------------------------------------------------
1 | {
2 | "login": "$asc"
3 | }
--------------------------------------------------------------------------------
/test/src/main/java/com/redhat/lightblue/test/metadata/FakeDataStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2015 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.test.metadata;
20 |
21 | import com.redhat.lightblue.metadata.DataStore;
22 |
23 | public class FakeDataStore implements DataStore {
24 |
25 | private static final long serialVersionUID = 6467478406388312375L;
26 |
27 | private final String backend;
28 |
29 | public FakeDataStore(String backend) {
30 | this.backend = backend;
31 | }
32 |
33 | @Override
34 | public String getBackend() {
35 | return backend;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/test/src/test/resources/metadata/datasource.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "datastore": {
4 | "datasource": "somedatasource"
5 | }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/test/src/test/resources/metadata/hooks.json:
--------------------------------------------------------------------------------
1 | {
2 | "entityInfo": {
3 | "hooks": [
4 | {
5 | "name": "someHook",
6 | "actions": [
7 | "insert",
8 | "update",
9 | "delete"
10 | ]
11 | },
12 | {
13 | "name": "someOtherHook",
14 | "actions": [
15 | "insert",
16 | "update",
17 | "delete"
18 | ]
19 | },
20 | {
21 | "name": "yetAnotherHook",
22 | "actions": [
23 | "insert",
24 | "update",
25 | "delete"
26 | ]
27 | }
28 | ]
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/Constants.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.util;
2 |
3 | import java.text.DateFormat;
4 | import java.text.SimpleDateFormat;
5 |
6 | public final class Constants {
7 |
8 | public static final String DATE_FORMAT_STR = "yyyyMMdd'T'HH:mm:ss.SSSZ";
9 | /**
10 | * Contains the lightblue {@link DateFormat} for each Thread.
11 | */
12 | private static final ThreadLocal DATE_FORMATS = new ThreadLocal<>();
13 | /**
14 | * It is faster to clone than to create new {@link DateFormat} instances.
15 | * This is the base instance from which others are cloned.
16 | */
17 | private static final DateFormat BASE_DATE_FORMAT = new SimpleDateFormat(DATE_FORMAT_STR);
18 |
19 | /**
20 | * Returns a DateFormat instance using the DATE_FORMAT_STR. Clone of the
21 | * static internal variable, because SimpleDateFormat is not thread safe
22 | */
23 | public static DateFormat getDateFormat() {
24 | if (DATE_FORMATS.get() == null) {
25 | DATE_FORMATS.set((DateFormat) BASE_DATE_FORMAT.clone());
26 | }
27 | return DATE_FORMATS.get();
28 | }
29 |
30 | private Constants() {
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/Cursor.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | /**
22 | * Interface representing a cursor into a collection. Upon construction, cursor
23 | * points to the location before the first element, so calling next() is
24 | * required.
25 | */
26 | public interface Cursor {
27 |
28 | /**
29 | * Returns if there is a next element
30 | */
31 | boolean hasNext();
32 |
33 | /**
34 | * Position the cursor to the next element.
35 | */
36 | void next();
37 |
38 | /**
39 | * Get the current value
40 | */
41 | V getCurrentValue();
42 | }
43 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/DefaultResolver.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | import java.util.HashMap;
22 | import java.util.Map;
23 |
24 | public class DefaultResolver implements Resolver {
25 |
26 | private final Map map = new HashMap<>();
27 |
28 | public void addValue(K name, V value) {
29 | map.put(name, value);
30 | }
31 |
32 | @Override
33 | public V find(K name) {
34 | return map.get(name);
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/InvalidPathException.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | public class InvalidPathException extends RuntimeException {
22 |
23 | private static final long serialVersionUID = 1L;
24 |
25 | public InvalidPathException(String path) {
26 | super(path);
27 | }
28 |
29 | public InvalidPathException(String message, String path) {
30 | super(message + ": " + path);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/JsonInitializable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 | *
4 | * This file is part of lightblue.
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | import com.fasterxml.jackson.databind.JsonNode;
22 |
23 | /**
24 | * Created by lcestari on 3/25/14.
25 | */
26 | public interface JsonInitializable {
27 | void initializeFromJson(JsonNode node);
28 | }
29 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/KeyValueCursor.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | /**
22 | * Interface representing a cursor into a key-value collection. Upon
23 | * construction, cursor points to the location before the first element, so
24 | * calling next() is required.
25 | */
26 | public interface KeyValueCursor extends Cursor {
27 |
28 | /**
29 | * Get the current key
30 | */
31 | K getCurrentKey();
32 | }
33 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/Registry.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | /**
22 | * A registry is a mapper that contains key-value pairs and resolver of
23 | * key/value pairs.
24 | */
25 | public interface Registry extends Resolver {
26 | /**
27 | * Adds a collection of items to this registry.
28 | */
29 | void add(Resolver resolver);
30 |
31 | /**
32 | * Adds an item to the registry
33 | */
34 | void add(K name, V value);
35 | }
36 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/Resolver.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | /**
22 | * A resolver is a key-value pair. The value is a resource (parser, constraint
23 | * checker, etc) that is tied to a key.
24 | */
25 | public interface Resolver {
26 |
27 | /**
28 | * Find the object with the given name
29 | */
30 | V find(K name);
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/SimpleJsonObject.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | import com.fasterxml.jackson.databind.JsonNode;
22 |
23 | public class SimpleJsonObject extends JsonObject {
24 |
25 | public SimpleJsonObject(JsonNode node) {
26 | super(node);
27 | }
28 |
29 | @Override
30 | public JsonNode toJson() {
31 | return getSourceNode();
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/Util.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | public final class Util {
22 |
23 | public static boolean isNumber(String value) {
24 | if (value != null) {
25 | int n = value.length();
26 | for (int i = 0; i < n; i++) {
27 | char x = value.charAt(i);
28 | if (!Character.isDigit(x)
29 | && !(i == 0 && (x == '-' || x == '+'))) {
30 | return false;
31 | }
32 | }
33 | return n > 0;
34 | }
35 | return false;
36 | }
37 |
38 | private Util() {
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/metrics/RequestMetric.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.util.metrics;
2 |
3 | import com.codahale.metrics.Counter;
4 | import com.codahale.metrics.Meter;
5 | import com.codahale.metrics.MetricRegistry;
6 | import com.codahale.metrics.Timer;
7 |
8 | public interface RequestMetric {
9 | Timer requestTimer(MetricRegistry registry);
10 |
11 | Counter activeRequestCounter(MetricRegistry registry);
12 |
13 | Meter errorMeter(MetricRegistry registry, String errorTypeOrCode);
14 | }
15 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/stopwatch/SizeCalculator.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.util.stopwatch;
2 |
3 | public interface SizeCalculator {
4 |
5 | public int size(T object);
6 |
7 | }
8 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/stopwatch/StopWatch.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.util.stopwatch;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Use stopwatch to measure method execute time and log a warning if it's higher than threshold.
10 | *
11 | * @author mpatercz
12 | *
13 | */
14 | @Retention(RetentionPolicy.RUNTIME)
15 | @Target(ElementType.METHOD)
16 | public @interface StopWatch {
17 |
18 | /**
19 | * -1 means use global value
20 | */
21 | int warnThresholdMS() default -1;
22 |
23 | /**
24 | * slf4j logger name
25 | */
26 | String loggerName() default "com.redhat.lightblue.crud.stopwatch";
27 |
28 | /**
29 | * Class name used to calculate result size.
30 | *
31 | */
32 | String sizeCalculatorClass() default "null";
33 |
34 | int warnThresholdSizeB() default -1;
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/util/src/main/java/com/redhat/lightblue/util/stopwatch/StopWatchLogger.java:
--------------------------------------------------------------------------------
1 | package com.redhat.lightblue.util.stopwatch;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 |
6 | /**
7 | * A logging wrapper to make unit tests easier.
8 | *
9 | * @author mpatercz
10 | *
11 | */
12 | public class StopWatchLogger {
13 |
14 | private Logger getLogger(String loggerName) {
15 | return LoggerFactory.getLogger(loggerName);
16 | }
17 |
18 | public void warn(String loggerName, String message) {
19 | getLogger(loggerName).warn(message);
20 | }
21 |
22 | public void debug(String loggerName, String message) {
23 | getLogger(loggerName).debug(message);
24 | }
25 |
26 | public boolean isDebugEnabled(String loggerName) {
27 | return getLogger(loggerName).isDebugEnabled();
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/util/src/test/java/com/redhat/lightblue/util/EmptyMutablePathTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | public class EmptyMutablePathTest extends AbstractMutablePathTest {
22 |
23 | @Override
24 | public MutablePath createPath() {
25 | return new MutablePath();
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/util/src/test/java/com/redhat/lightblue/util/EmptyPathTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | public class EmptyPathTest extends AbstractPathTest {
22 |
23 | @Override
24 | public Path createPath() {
25 | return new Path();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/util/src/test/java/com/redhat/lightblue/util/MutablePathPathTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | public class MutablePathPathTest extends StringPathTest {
22 |
23 | @Override
24 | public Path createPath() {
25 | return new Path(new MutablePath(createPathString(segments)));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/util/src/test/java/com/redhat/lightblue/util/PathMutablePathTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | public class PathMutablePathTest extends StringPathTest {
22 |
23 | @Override
24 | public MutablePath createPath() {
25 | return new MutablePath(super.createPath());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/util/src/test/java/com/redhat/lightblue/util/PathPathTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2013 Red Hat, Inc. and/or its affiliates.
3 |
4 | This file is part of lightblue.
5 |
6 | This program is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 | */
19 | package com.redhat.lightblue.util;
20 |
21 | public class PathPathTest extends StringPathTest {
22 |
23 | @Override
24 | public Path createPath() {
25 | return new Path(super.createPath());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeCursorTest-general.json:
--------------------------------------------------------------------------------
1 | {
2 | "text": "value",
3 | "object": {
4 | "text": "value",
5 | "foo": "bar"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeDocRelativeTest-complexarray.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "object": {
4 | "simple": "value",
5 | "nested1": {
6 | "simplenested": "nestedvalue",
7 | "doublenested1": {
8 | "doublenestedsimple": "doublenestedvalue",
9 | "triplenested1" : {
10 | "triplenestedsimple" : "triplenestedvalue"
11 | }
12 | },
13 | "doublenested2": {
14 | "doublenestedsimple2": "doublenestedvalue2",
15 | "triplenested2" : {
16 | "triplenestedsimple2" : "triplenestedvalue2"
17 | }
18 | }
19 | }
20 | },
21 |
22 | "field1": "value",
23 | "array1": [
24 | {
25 | "nested1": [1, 2, 3, 4]
26 | },
27 | {
28 | "nested1": [1, 2, 3, 4, 5]
29 | },
30 | {
31 | "nested1": [1, 2]
32 | },
33 | "3",
34 | {
35 | "deep": [
36 | {
37 | "deeper": [1, 2, 3, 4]
38 | },
39 | {
40 | "deepest": [
41 | 1,
42 | {
43 | "z": "x",
44 | "k": [1, 2, 3]
45 | }
46 | ]
47 | }
48 | ]
49 | }
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeDocTest-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "array": [
3 | "0",
4 | "1",
5 | "2",
6 | "3"
7 | ]
8 | }
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeDocTest-arraywithmissingelements.json:
--------------------------------------------------------------------------------
1 | {
2 | "field1": "value",
3 | "array1":[
4 | {
5 | "fld1":1,
6 | "fld2":2
7 | },
8 | {
9 | "fld3":3,
10 | "fld2":2
11 | }
12 | ],
13 | "array2": [
14 | {
15 | "fld1":1,
16 | "nested": [
17 | {
18 | "fld1":1,
19 | "fld2":2
20 | },
21 | {
22 | "fld3":3,
23 | "fld4":4
24 | }
25 | ]
26 | },
27 | {
28 | "fld1":2,
29 | "nested": [
30 | {
31 | "fld5":5,
32 |
33 | "fld6":6
34 | },
35 | {
36 | "fld1":7
37 | }
38 | ]
39 | }
40 | ]
41 | }
42 |
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeDocTest-complex.json:
--------------------------------------------------------------------------------
1 | {
2 | "object1": {
3 | "array1": [
4 | {
5 | "simple1": "value1"
6 | },
7 | {
8 | "simple2": "value2"
9 | }
10 | ]
11 | },
12 | "object2": {
13 | "simple3": "value3",
14 | "array2": [
15 | {
16 | "simple4": "value1"
17 | },
18 | {
19 | "simple5": "value2"
20 | }
21 | ]
22 | }
23 | }
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeDocTest-complexarray.json:
--------------------------------------------------------------------------------
1 | {
2 | "field1": "value",
3 | "array1": [
4 | {
5 | "nested1": [1, 2, 3, 4]
6 | },
7 | {
8 | "nested1": [1, 2, 3, 4, 5]
9 | },
10 | {
11 | "nested1": [1, 2]
12 | },
13 | "3",
14 | {
15 | "deep": [
16 | {
17 | "deeper": [1, 2, 3, 4]
18 | },
19 | {
20 | "deepest": [
21 | 1,
22 | {
23 | "z": "x",
24 | "k": [1, 2, 3]
25 | }
26 | ]
27 | }
28 | ]
29 | }
30 | ]
31 | }
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeDocTest-object.json:
--------------------------------------------------------------------------------
1 | {
2 | "object": {
3 | "simple": "value"
4 | }
5 | }
--------------------------------------------------------------------------------
/util/src/test/resources/JsonNodeDocTest-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "simple": "value"
3 | }
--------------------------------------------------------------------------------